Choosing PHP Handlers in cPanel

This works hand in hand with Apache / Litespeed depending upon your installation.

Web server fetches the PHP requests to the PHP handler which processes it and gives back to the web server.

There are mainly 4 types of PHP handlers in cPanel servers.

1) DSO

2) CGI

3) FastCGI

4) suPHP

In this tutorial, we will see in detail how each of these handlers function and what are their pros and cons.

1) DSO

DSO stands for Dynamic Shared Object and is also referred to as mod_php. It runs as an Apache module like other Apache modules such as mod_rewrite, mod_deflate etc and it runs as Apache user and by default it is ‘nobody’. It is the default handler on cPanel servers.

Pros:- It understands Apache directives and hence the PHP directives can be specified in Apache configuration file (httpd.conf or .htaccess). It is fast and it can cache opcodes.

Cons:- Since it runs as the Apache user, if any user is abusing, we won’t be able to identify the abusive user in majority of the cases.

Before going on with rest of the handlers, let us see what Suexec is.

suEXEC

Apache suEXEC is a feature of Apache web server which allows CGI and SSI scripts as a user other than Apache user.

2) CGI

CGI stands for Common Gateway Interface. As the name implies there is a seperate gateway for PHP processing i.e, Apache is not processing PHP and it runs as CGI module.

Pros:- It is highly configurable. It can work with Suexec and run PHP scripts as the user who owns the script.

Cons:- It is slow and insecure, does not understand Apache directives, so cannot use Apache directives for PHP in .htaccess file.

3) FastCGI

FastCGI is an advanced version of CGI PHP handler. Like CGI, it also runs as a seperate CGI module and Apache is not processing PHP. It is highly configurable.

Pros:- It is fast, can work with Suexec and run the PHP scripts as the user who owns the script, better CPU performance, Opcode cache.

Cons:- Does not understand Apache directives, so cannot use Apache directives for PHP in .htaccess file. Requires more RAM to work.

4) SuPHP

SuPHP stands for Single User PHP. It offers maximum security for the scripts and runs the scripts as the owner of the script. It also runs as a CGI module and Apache is not processing PHP.

We have implemented SuPHP as the default handler in most of our servers.

Pros:- Stronger security, highly configurable and easy permissions.

Cons:- It is slower than DSO, does not support Opcode caching like APC, memcached etc.

Switch PHP handler via WHM

This might me useful for our dedicated customers who wants to switch the PHP handler. WHM provides an incredibly easy interface for switching PHP handler.

Go to WHM >> Service Configuration >> Configure PHP and suEXEC

handler

As you can see from the screenshot, just select the PHP handler from the dropdown. Also you can turn Apache suEXEC on and off from the dropdown.

If you check the tick box ‘Do a dryrun’ you’ll abe able to see the new PHP configuration without actually applying the new configuration.

Just make your selections and click on ‘Save New Configuration’.

Isn’t it really simple? For any questions, just contact our 24/7 support team and we are glad to assist.

 

Leave a Reply

Your email address will not be published. Required fields are marked *