PHP is an important part of your cPanel server. One aspect of PHP’s configuration that can be overlooked is the PHP handler. The PHP handler is the specific implementation of PHP on your server that interfaces with Apache. On a cPanel server, there are four main PHP Handlers:
Each has a distinct way of processing PHP code. One or the other may be the best fit for your server.
DSO is the default PHP handler on cPanel servers. It runs as an apache module, just like any other apache module. This means that any PHP scripts that you want to run have to be owned by the “nobody” user and group, which is Apache’s user and group.
One of the plusses of running DSO is that, because it is an Apache module, it understands Apache server directives. It can take specific directives either in the main apache configuration (httpd.conf) or in an .htaccess file for a domain. This makes DSO highly configurable.
SuPHP also runs as an Apache module. It was written with stronger security in mind. To this end, it executes PHP scripts as the owner of the domain. Instead of the “nobody” user and group, PHP scripts are owned by the Linux user for the domain. It is also very configurable.
Of course, the security benefits do come with a downside. Unlike DSO, SuPHP does not understand Apache directives in .htaccess; if you wish to use Apache directives, they must be in httpd.conf. Also, SuPHP can run slower than DSO.
FastCGI was written with speed in mind. It is fast. Combined with Suexec, it can run PHP scripts owned as either “nobody” or the linux user for the domain. Just from these positives, it sounds like a good candidate for replacing all other PHP handlers; but, like all PHP handlers, it comes with its own drawbacks.
FastCGI does not understand Apache directives. If you wish to use Apache directives for PHP, FastCGI is not the handler for you. Also, it has a high memory footprint. If your server does not have much extra RAM hanging around, FastCGI is probably not the best choice.
CGI is written not as an apache module, but as a Common Gateway Interface. It is very configurable, moreso than any other handler. Like FastCGI, it too works with Suexec, and can work with either ownership of PHP scripts.
The big problem with PHP’s CGI handler is that it is slow. The fact that it is slow is the reason that FastCGI has “Fast” in its name. Like FastCGI, it does not handle Apache directives. Unless you need the extra configurability, it is not recommended.
Switching from one PHP handler to another can be a detailed process, especially when changing the ownership of PHP scripts is involved. PHP is fully managed by Martfox Support Team, so if you are thinking that you need to switch handlers, feel free to contact them at the information below to guide you through that transition.
Comments are closed.