php-fpm virtual memory
I always get this triggered report comes to my email many times a day.
Account: bizzindex
Resource: Virtual Memory Size
Exceeded: 520 > 512 (MB)
Executable: /opt/cpanel/ea-php74/root/usr/sbin/php-fpm
Command Line: php-fpm: pool bizzindex_com
PID: 20055 (Parent PID:1504)
Killed: No
I adjusted the memory size in WHM to 2048 and php.ini to 1024mb but, it did not seem to help.
What is the best solution? Thanks
2 Replies
Hello! There can be multiple places to change the PHP memory limit, and PHP-FPM has it's own configuration file, usually at /etc/phpX/fpm/php-fpm.conf
where "phpX" is your version of PHP. There's a Stack Overflow post with further suggestions here:
https://stackoverflow.com/questions/15962634/nginx-or-php-fpm-ignores-memory-limit-in-php-ini
@mjones writes:
Hello! There can be multiple places to change the PHP memory limit, and PHP-FPM has it's own configuration file, usually at /etc/phpX/fpm/php-fpm.conf where "phpX" is your version of PHP. There's a Stack Overflow post with further suggestions here:
https://stackoverflow.com/questions/15962634/nginx-or-php-fpm-ignores-memory-limit-in-php-ini
Since the OP mentions php 7.4:
Executable: /opt/cpanel/ea-php74/root/usr/sbin/php-fpm
On Debian/Ubuntu, since the advent of PHP 7 or so, php.ini has been centralized in a single place /etc/php:
- /etc/php/<version>/cli/php.ini
- /etc/php/<version>/apache2/php.ini
- /etc/php/<version>/fpm/php.ini
where <version> is the PHP version number and {cli, apache2, fpm} are the operational php.ini's for the command-line, the apache2 plug-in and the fastcgi process manager, respectively.
PHP comes with two native functions to show which config file is loaded:
- php_ini_loaded_file returns the path of the loaded .ini file; and
- php_ini_scanned_files returns a list of .ini files parsed from the additional .ini directory.
You can try each one of these out with something like:
php -r 'echo php_ini_loaded_file();'
-- sw