Would installing PHP-FPM on my web-server help? Any benefits?

Neutral Singh

Well-known member
Ladies and Gentlemen!

Finally, upgraded my production server to EasyApache 4, so now I can go back and forth from PHP 5.4 to PHP 7.2 with a single click... :love::love::love:

Everything seems to be working fine... Need your advice....

In WHM > EasyApache4, i am seeing this message... Should I go ahead and install PHP-FPM? Any benefits?

To use PHP-FPM on accounts using PHP 5.4, 5.5, 5.6, 7.1, and 7.2, you must install PHP-FPM for those PHP versions. To do so, perform the following steps below:

Click Install to open EasyApache 4 in a new window.
Install the following packages:
ea-php54-php-fpm
ea-php55-php-fpm
ea-php56-php-fpm
ea-php71-php-fpm
ea-php72-php-fpm
ea-apache24-mod_proxy_fcgi

After you install the desired packages, return to the previous window and click Refresh. The system will display your updated PHP-FPM packages.
 
Last edited:
I would also recommend adding these to apache:

mod_http2
mod_mpm_worker

To take advantage of http2

If you're using modsecurity make sure the php handler is cgi and not suphp, suphp causes a few errors at the moment.
 
If you're not allowing any other users to use php without fpm then you don't need to worry about the handler.

Exec is probably now disabled so you may want to re-enable that if you have the media gallery. I would also adjust the default pool options as they aren't great.
 
Exec is probably now disabled so you may want to re-enable that if you have the media gallery. I would also adjust the default pool options as they aren't great.

What's the best method to re-enable it? I saw some issues with PHP-FPM and Exec being disabled by default and only being able to fix it via command line (according to the cpanel forums). Is that still the only method?

Reference:
https://forums.cpanel.net/threads/enabling-php-fpm-forces-disable_functions.590799/#post-2391379
https://forums.cpanel.net/threads/php-fpm-default-settings.603183/

Also, any suggestion on pool settings?

Thanks!
 
Unfortunately yes, it hasn't made its way into WHM yet.

It's pretty straight forward if you have root access as per the instructions in your first link.
 
My webhost has this explanation against installing PHP-FPM, mod_http2, mod_mpm_worker ... :unsure:

We generally do not recommend PHP-FPM primarily due to a variety of issues associated with cPanel's particular implementation. In many cases, due to how cPanel handles it, FPM will cause far more problems than it solves, making it very much something we recommend avoiding until cPanel improves their implementation, and even then, PHP-FPM requires good understanding of how to configure it, as without understanding, PHP-FPM can end up trying to use more resources than the server can provide, or cause serious performance issues for the rest of the server. It's overall something that requires know-how on configuration, and cPanel's implementation makes that even more difficult.

As for HTTP/2 and the Worker MPM, HTTP2 isn't compatible with the Prefork MPM, meaning either the Worker or Event MPMs would need to be used, and both MPMs require additional customization and configuration compared to Prefork, as well as is incompatible with the Ruid2 security system, which is used to sandbox Apache processes to the user's permissions instead of the "nobody" user. Without that, some security issues are exposed, which then make both CGI and DSO insecure to use, leaving SuExec and either SuPHP or the defective PHP-FPM implementation as the only options for secure Apache and PHP processes.

Generally, for HTTP/2 support, we recommend LiteSpeed, due to the information above. LiteSpeed, while a monthly licensing cost, provides HTTP/2 through its own integrated MPM and PHP handler, which contain the security features and sandboxing while implementing an integrated PHP handler and threading MPM capabilities, essentially making it the most secure option that can just be dropped in to replace Apache. It provides both the features you want and the security that we recommend along with the simplicity of management that just can't be found by trying to implement through cPanel's current arrangements.
 
We generally do not recommend PHP-FPM primarily due to a variety of issues associated with cPanel's particular implementation. In many cases, due to how cPanel handles it, FPM will cause far more problems than it solves, making it very much something we recommend avoiding until cPanel improves their implementation, and even then, PHP-FPM requires good understanding of how to configure it, as without understanding, PHP-FPM can end up trying to use more resources than the server can provide, or cause serious performance issues for the rest of the server. It's overall something that requires know-how on configuration, and cPanel's implementation makes that even more difficult.

It is true that cPanels application of PHP-FPM is a little strange but still very effective, it has a small learning curve when it comes to configuration but once understood it's quite straight forward.

As for HTTP/2 and the Worker MPM, HTTP2 isn't compatible with the Prefork MPM, meaning either the Worker or Event MPMs would need to be used, and both MPMs require additional customization and configuration compared to Prefork, as well as is incompatible with the Ruid2 security system, which is used to sandbox Apache processes to the user's permissions instead of the "nobody" user. Without that, some security issues are exposed, which then make both CGI and DSO insecure to use, leaving SuExec and either SuPHP or the defective PHP-FPM implementation as the only options for secure Apache and PHP processes.

Configuring the worker MPM is just a few lines of configuration, plenty of help on google for some suggested settings if you're uncertain. The cPanel forum are also quite helpful. We've gone from particular implementation to defective implementation in the space of a paragraph :) Unusual yes, defective no.

Your host has likely had issues with inexperienced users breaking their servers through bad PHP-FPM configurations, once you've had to put a few right you'll soon start recommending people don't use it. If you feel you can manage it then I suggest you try it, you obviously have the ability to revert at any time through Easyapache if it breaks. There are thousands of people using it on cPanel servers, myself included, many were using it before cPanel even implemented it.

I do agree with your host though, i would prefer that cPanel implement it better with a full WHM configuration section.
 
My webhost has this explanation against installing PHP-FPM, mod_http2, mod_mpm_worker ... :unsure:

Reading between the lines, it sounds like @Bryan is correct; your host is saying that it's not worth all the hassles....for them. Most of what I've read seems to support the idea that implemented correctly using a PHP-FPM pool will increase performance managing multiple requests.

Assuming this is on a full dedicated server that you control, correct? If so, I'd read up on it and give it a try.
 
Top Bottom