Monday, January 25, 2016

Php Handlers List

PHP Handlers
==========
                                Mod_php(DSO)  CGI         suPHP FastCGI
Memory usage            Low                    Low        Low            High
CPU Usage                 Low                    High        High Low
Security                      Low                    Low        High High
Run as file owner        No                       No          Yes             Yes
Overall Performance   Fast                     Slow       Slow           Fast


Mod_php(DSO) :

This is another default handler, and is commonly considered the fastest PHP handler available. DSO runs PHP as an Apache Module, meaning PHP scripts will run as Apache’s default user “nobody” instead of the cPanel user.

Pros:

    Considered the fastest PHP Handler.
    Low CPU and Memory usage.
    Option to use caching extensions
    You can enable Mod_Ruid2, which will give DSO the strength in security similar to SuPHP. It creates the permissions for PHP to run as the cPanel user instead of “Nobody”.

Cons:

    Best used if you are only running one or a very small amount of accounts on the server
    If using Mod_Ruid2, you can not use Apache Mod_userdir for temporary links to view sites (Ex: http://ServerIP/~User)
    Easily exploitable if compromised due to permissions owned to “Nobody”
    Auto-updates and Uploading tools from WordPress or other CMS’s will fail due to permissions
    Used mainly with Apache and NginxCP as the main webserver
    If an account starts to abuse resources, we are unable to determine which user is causing this (Unless running Mod_ruid2 apache module)

CGI :

CGI runs PHP as a CGI module instead of an Apache module. This PHP is not commonly used as it is considered the slowest PHP handler.
Pros:

    The processes still run as the user “Nobody”
    If using with SuEXEC, you can see what user has made a PHP request

Cons:

    Insecure
    High CPU usage
    Usually not recommended

suPHP : 

SuPHP is used on all of our Shared and Re-Seller server environments, as it is cPanel’s preferred PHP handler, and is noted as the most secure PHP handler. SuPHP works by running PHP as a CGI module on the server which separates each PHP processes under the user in which is running them.
Pros:

    Default cPanel PHP Handler
    PHP processes run under the user in which it is owned to
    Uses SuExec to run the “forked” secure PHP processes
    Upload tool’s on your site will provide the proper ownership and permissions to files and updates
    PHP scripts are unable to be executed unless owned to the proper user

Cons:

    Higher CPU usage
    Creates a new PHP process whenever PHP is needed to run
    World writeable files will be unable to be executed. (Files with permissions 777)
    No PHP Caching utility can be used (OPCache, APC, XCache, etc.)

FastCGI : 

Commonly known as Fast CGI, and is a higher performance version of the CGI PHP handler and is comparable to DSO.
Pros:

    Low CPU consumption
    Run’s PHP processes as the cPanel user
    Ability to use Caching extensions
    Very similar to the DSO handler
    Able to work with Nginx and non-Apache webservers

Cons:

    High memory consumption
    PHP is running as a constant open process, rather than opening when a PHP request comes to the server







No comments:

Post a Comment