I recently moved a PHP5 application from Apache 2.4 + mod_php to Apache 2.4 + php-fpm. Apache is configured to forward all * .php requests through Unix Domain Sockets to php-fpm. The application required the PHP settings to increase the memory limit to 384 MB, which was the case when using mod_php, and this setting is preserved under PHP-FPM.
After switching to php-fpm, some requests consume about 1 GB of memory before they are terminated by the Linux OOM. The same requirements in mod_php did not consume the same amount of memory and were therefore not terminated.
Note that I downgraded Apache's event MPM to only 2 processes and 8 threads each. The pm of PHP-FPM is set to ondemand and only 2 processes. I can see that only this request is being executed at this time. The PHP FPM process memory is steadily increasing to 1 GB and will be shut down before it can return.
My questions are:
1] Why does php-fpm exceed the php.ini memory_limit setting of 384MB?
2] If Apache uses a proxy function for PHP FPM over a Unix domain socket, does it really matter to empty the buffer? I assume no
3] Do you have a recommendation to correct this problem?