Best PHP handler for your Website

  • Post author:
  • Post category:General
Best PHP handler for your Website

PHP Handler

You must have heard about PHP handlers if your website was developed using PHP codes. This article narrates how PHP handlers work for the websites. Before setting up the PHP handler, it’s advisable to understand the working of each PHP handler so that you can choose the best option for the PHP scripts used.

The available PHP handlers are briefly described below:

(1) DSO (Dynamic Shared Objects)

DSO is the fastest and oldest PHP handler that is available to process your PHP scripts. It executes the PHP scripts as apache ‘nobody’ user. It is the ideal choice for high-performance websites and provides better cache experience with eAccelerator, APC, and Xcache. Also, it helps in using .htaccess file for the PHP directives

Besides, DSO handler comes with some disadvantages even though it has the ability to process the requests faster than any other handlers. Some of the disadvantages are –

(a) As the processes are executing as apache ‘nobody’ user, the server will not grant access to the system files.

(b) If the account gets hacked, then the hacker can access the directories, files etc. of other accounts in the same server.

(c) If the server hosts only one website, then DSO handler is the best option but it is not recommended for shared servers.

(2) suPHP(Single User PHP)

suPHP handler is the best and secure way of handling your PHP scripts. Here the script always run under the control of the account owner (suEXEC) instead of apache ‘nobody’ user and every PHP request is processed as a separate PHP process so that the system administrator can easily track, which user is running more scripts and utilizing the server resources. Also, suPHP handler can isolate a user from other system users. This makes the account more secure as none of the users will be able to execute PHP scripts owned by another user. In other words, a malicious script in one account will not run in any other user accounts.

As it creates a separate process for each of the PHP request, it can slow down the server load during high traffic. This is considered as the main disadvantage of suPHP handler.

(3) CGI (Common Gateway Interface)

CGI PHP handler is one of the oldest PHP handlers and hence possesses lots of demerits. Here enabling suEXEC will help in running each of the PHP scripts by its file owner rather than apache ‘nobody’ user. This helps in monitoring the server and tracking the user who is running more number of PHP scripts on the system. Another advantage of CGI handler is that you can use vhost php.ini(customized php.ini file for each user).

Some disadvantages associated with CGI are:

(a) Slow performance and less security than suPHP.

(b) The number of CGI users are lesser when compared to other PHP handlers.

(4) FastCGI

FastCGI is one of the advanced CGI handler, which gives better performance. FastCGI is recommendable, as it has the ability to process the PHP scripts fast. But still the performance of FastCGI is lesser than DSO handler. It doesn’t require separate PHP processes for each new request, so the CPU usage of FastCGI is lesser than any other PHP handlers such as suPHP. But it is possible to use the suEXEC feature of suPHP in this handler. Normally, FastCGI keeps PHP scripts in server memory, so that the processing of PHP scripts will be very fast like DSO handler. This is mostly recommended for high traffic sites.

Like all other PHP handlers, FastCGI has some disadvantages as follows:

(a) Memory usage is the main disadvantage of FastCGI. Here, PHP handler keeps PHP scripts in memory for faster access even if no request is made for the page.

(b) Not useful for sites having average number of visitors

Despite its disadvantages, FastCGI can be effectively used for high traffic websites.

We hope the above details can provide a good overview on the different PHP handlers and its functions. Selection of suitable PHP handler is one of the trickiest ways to speed up the website. So keep an eye on your site and choose the correct option. If you believe that your current PHP handler doesn’t match your website, then it’s high time to move to a suitable one now.

Good luck..!!!

Leave a Reply