Rocky 9 comes with PHP 8.1 and 8.2 by default. It doesn’t natively come with PHP 7.4 - where did you install PHP 7.4 from? Remi’s repositories?
Usually PHP performance issues could be due to incorrect PHP configuration or a problem with the application itself and the way the PHP code is written.
I installed 7.4 specifically to support my software. i also moved the configs from php, all the settings that were made for php. but the problem is still the same
Moving configs from an old system to a new one isn’t recommended. Better would have been to manually edit the new ones installed on Rocky 9 when you installed PHP and make the changes you require - or even better use Ansible to do that for you since that way you can configure PHP exactly how you want it irrespective of the system and it will always be the same in terms of the config applied.
You also didn’t answer the question, where did you install PHP 7.4 from? Remi’s repo or somewhere else?
Sounds to me though that the configuration is most likely to be the problem especially since it seems to have been copied over from an old system.
Can you clarify. Are these scripts running outside of a web server, e.g. from CLI, or are they being run when people browse to a web site? Which web server, what kind of MPM. You could isolate a single script, either run as CLI or as a single process web server, to identify where it’s causing the high load.
We are using PHP 7.4 in Rocky Linux 8. PHP 7.4 is officially will be supported untill 2029 in Rocky Linux 8 ( As of RHEL 8 ).
Installing all required PHP modules in 3 steps
First install all required modules from official OS repos only.
The modules which are not available in OS repos (like oci8 , solr, sodium , redis etc ) , install these from PECL repos ( pecl install redis )
If still some module cloud not found ( like pdo_dblib etc ) , try to install by using PHP 7.4 source like
tar -xzvf php-7.4.19.tar.gz
cd php-7.4.19/ext/pdo_dblib/
phpize
./configure
make
make install
echo “extension=pdo_dblib.so” > /etc/php.d/50-pdo_dblib.ini
Rocky Linux 8 is by default using PHP FPM with EVENT MPM which is very efficient.
You can tune the /etc/php-fpm.conf according to your traffic and avaible system resources.
PHP FPM provide very good mechanism to log the PHP scripts which are causing delay . you can enable it to indetify the scripts
( you need to set the timeout for defining the slow query like )
request_slowlog_timeout = 6s
slowlog = /var/log/php-fpm/slowlog-site.log