Apache does not natively support PHP scripts without a special module. The module that tells Apache how to handle PHP scripts is referred to as a PHP handler. Without a properly configured module, Apache will just send you the PHP file as a download since it doesn't know what else to do.
cPanel | Plesk |
---|---|
DSO/mod_php | Apache Module/mod_php |
CGI | CGI |
FCGI/FastCGI | FCGI/FastCGI |
PHP-FPM | PHP-FPM |
suPHP | -- (CGI w/ suExec enabled) |
LSAPI | -- (unless LiteSpeed Web Server is installed) |
Each module provides a different method of parsing PHP.
This is also referred to as mod_php. This module allows Apache itself to directly parse and display PHP files. PHP scripts parsed by mod_php run as the same user that Apache itself does (rather than the user account that hosts the PHP files.
Pros
Cons
Stands for Common Gateway Interface. Using this handler, the system will run PHP scripts as the user that owns the domain or subdomain.
Pros
Cons
FastCGI is a variation of the CGI protocol that provides a number of benefits over the older CGI handler. Using this module, the system will run PHP scripts as the user that owns the domain or subdomain. There are some differences between mod_fastcgi and mod_fcgid, but none that are relevant to the scope of this article.
Pros
Cons
FPM stands for FastCGI Process Manager. It is an improved way of implementing FastCGI processing of PHP. Using this handler, the system will run PHP scripts as the user that owns the domain or subdomain. Each FPM pool can have independent settings.
Pros
Cons
This handler was specifically designed to serve PHP scripts as the owner of the domain or subdomain that is executing the PHP script. On cPanel servers, it is also configured to disallow execution of files with unsafe permissions. cPanel their copy of suPHP with the latest security fixes.
Pros
Cons
This handler implements the LiteSpeed Web Server (LSWS) SAPI. This handler requires CloudLiunx or LSWS for the maximum benefits. Using this handler, the system will run PHP scripts as the user that owns the domain or subdomain.
Pros
Cons
What you should use depends on your server's resources and the types of PHP sites you need to serve. On cPanel, we recommend defaulting to suPHP, LSAPI or FCGI. On Plesk we recommend FastCGI. Once you understand how PHP-FPM works, you may want to try enabling it for at least some sites and see if it helps at all.
Do not change the PHP handler you are using without fully understanding what the handler will do. If you switch from a handler that does run scripts as the user to one that doesn't, or vice versa, you may need to adjust the permissions of some files or directories so that Apache can access things properly. |
On cPanel, you can adjust the PHP handler in WHM by clicking on MultiPHP Manager and then select the PHP Handler tab and adjust the hander as needed.
The settings in this area of cPanel only apply if you haven't configured a site to use PHP-FPM on the main MultiPHP Manager screen. |
On Plesk, navigate to Service Plans > Example plan > PHP Settings > run PHP as and select the handler you want to use.
If you have service with HostDime and you are unsure what to do about your PHP handlers, please contact us for assistance before trying to make any changes.