PHP Handler: DSO vs CGI vs SuPHP vs FastCGI

What is PHP Handler?

PHP handler supplies the required library to interpret PHP code. Each handler delivers the libraries through different files and implementations. Each file and implementation affects Apache’s performance, because it determines how Apache serves PHP.

You need to make the right decision on how Apache should handle your websites or web applications. I am using WHM/cPanel to manage Apache and PHP, I will focus more on advantages and disadvantages from cPanel point of view rather than how to install, implement or switch between each handler.


PHP runtime is loaded once, when Apache starts up and then reused for all requests.



  • Since DSO is only loaded once, it is faster than CGI and SuPHP
  • PHP can direct access to some Apache-specific calls, which gives you some more fine-grained control on the HTTP-level.
  • Allow for most common PHP .htaccess (php_flag) directives to be used.
  • Good for single sites that require performance over ease of use and security
  • Suitable environment to run PHP optcode caching addon such as eAcclerator, APC or Xcache
  • Well suited for low and high traffic sites but not for CMS systems like Joomla


  • PHP processes are handled by the user that is running httpd. In most cases, this user is the ‘nobody’ user. This means when PHP interacts with files on the file system, they have to be accessible by the ‘nobody’ user. This creates permissions issues as your normal cPanel based user will not have access to read/write files that are owned by the ‘nobody’ user without the correct permissions changes. Most PHP web scripts need to write to files and directories and if they are owned by the cPanel user, without changing the permissions on the files or directories to 777, it will cause issues and in some cases, break your website
  • Runs not under user who owner of the site, so you will have to manually manage the permissions on a per user basis to ensure that your PHP apps/scripts can read and write to the files and directories of which it needs to function
  • Any changes on PHP configuration, will required to restart Apache service to make sure the module being reloaded


A new PHP CGI process is invoked on each Apache request for PHP processing.



Setup NTP Server and Sync Time with Client

I show you how to setup and sync time with your client to a server for example when you want to have successful master/slave MySQL replication. Most of replication or client/server services should have time sync and identical to make sure no duplicate or backdated data.

In this case we will using 2 servers. Variables as follow:

Server1 =
Client1 =

Now we setup NTP server in Server1:

1. Install NTP via yum:

yum install ntp -y

2. Enable NTP services to be auto start upon boot:

chkconfig ntpd on

3. Open /etc/ntp.conf via text editor and add following line:

restrict mask

4. Save the file and allow the port 123 in your firewall in iptables:

iptables -A INPUT -s -m state --state NEW -p udp --dport 123 -j ACCEPT

5. Start NTP service:

service ntpd start

Now we need to configure Client1 to sync time with our NTP server. Login to your client and as follow:

1. Install NTP service:

yum install ntp -y

2. Sync the time with Server1:

ntpdate -u

3. Start the NTP service:

service ntpd start

4. Verify the synchronization with command date: