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.
- Good for shared hosting environment. Well suited for medium traffic sites
- Continue reading “PHP Handler: DSO vs CGI vs SuPHP vs FastCGI” »