• Uncategorized
  • 8

How to change PHP handler from SuPHP to FastCGI in a cPanel server

Why PHP handlers?

It’s a type of Apache module. It contains libraries that the Apache uses to interpret and run PHP code. This dettails are mentioned in PHP and Apache configuration files. The PHP configuration file (php.conf) contains the directive to configure the Apache’s PHP handler. The include command in apache configuration file “httpd.conf” loads the php configuration file to load the current PHP handler by default on start up.

Available PHP handlers are CGI, DSO, FastCGI and suPHP

Please follow the steps pasted below to change the PHP handler from back end.

1. Make sure FastCGI is not enabled on the server. This can be done by issuing the following command:

# /usr/local/cpanel/bin/rebuild_phpconf --current

2. Then, you need to enable FastCGI on the server via easyapache.

# /scripts/easyapache > Exhaustive list options > enable mod_fcgid (FastCGI support) from the list available.

3. Finally, change the PHP handler using the following command:

# /usr/local/cpanel/bin/rebuild_phpconf X Y Z 0/1


x = 5 if you need to enable php5
y = 4 or none if you need/don't need php4
z = cgi, dso, fcgi, suphp
1/0 = Suexec: enabled/disabled

Here we’re going to change the PHP handler from suPHP to FastCGI. Log into the server as root and execute the following command:

# /usr/local/cpanel/bin/rebuild_phpconf 5 none fcgi 1

For more details, please execute the following command:

# /usr/local/cpanel/bin/rebuild_phpconf --help 

EasyApache 4 

You can not set FastCGI as as PHP handler on your server which has EasyApache 4.

Important: EasyApache 4 only supports FastCGI in conjunction with the FastCGI Process Manager (PHP-FPM). 
You must also configure PHP-FPM to use FastCGI.

More info : https://documentation.cpanel.net/display/EA4/PHP+Handlers

In EasyApache 4, there is a change in this script usage. I updated this topic to reflect those changes. The actual script location is same but the usage is different. Please see the tricks explained below:

To check the current settings

# /usr/local/cpanel/bin/rebuild_phpconf --current

How to change the system default version of PHP?

As the new cPanel (since58) supports multi PHP, we can change this from the command line. Please see the command pasted below:

# /usr/local/cpanel/bin/rebuild_phpconf --default=$package

Here, $package represents the name of the PHP package that you wish to use.


# /usr/local/cpanel/bin/rebuild_phpconf --default=ea-php55

Which will change the default PHP to 5.5.

How to change a PHP version’s handler?

To change the PHP handler that a specific version of PHP uses, run the following script:

# /usr/local/cpanel/bin/rebuild_phpconf --default=$default --$package=$handler


# /usr/local/cpanel/bin/rebuild_phpconf --default=ea-php55 --ea-php54=suphp

The above command will change the PHP handler of 5.5 to suPHP.

To change all version’s handlers

/usr/local/cpanel/bin/rebuild_phpconf --default=ea-php56 --ea-php54=cgi --ea-php55=cgi --ea-php56=cgi
                           P.S. You must include --default

That’s it!!!!


How to change PHP handler from SuPHP to FastCGI in a cPanel server
Command-line option to list the current PHP handler on the server – cPanel

Arunlal Ashok

Sr. Linux Server Administrator. I'm managing Linux servers since 2012. I started this blog to share and discuss my ideas. Check My Profile in uPwork (oDesk) and create a job, if you need any administration help. Thanks!!

You may also like...

8 Responses

  1. Monetize.info says:

    Please update this titorials for Easy Apache 4. For some reason PHP Fast CGI do not appears as a PHP handler.

  2. El Morgan says:

    Hi – I wonder if you could briefly explain why we’d choose FastCGI over SuPHP? I’d be ever so grateful to learn the reason why!


    • Hi EI,

      Like its name indicates, this handler serves pages much faster than suPHP. The CPU performance is good by using FastCGI. It has caching technique. It leverages the server’s RAM to keep PHP scripts in memory instead of starting up new PHP processes for each and every request.

      Note: FastCGI is much memory intensive.

  3. Nishit Shah says:


    Any idea how to setup fcgi/FPM handler in easy apache4, as current cPanel 60 version does not support FCGI anf FPM handler at global level.


Leave a Reply

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