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 :

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

Post navigation

Arunlal A

Senior System Developer at Zeta. Linux lover. Traveller. Let's connect! Whether you're a seasoned DevOps pro or just starting your journey, I'm always eager to engage with like-minded individuals. Follow my blog for regular updates, connect on social media, and let's embark on this DevOps adventure together! Happy coding and deploying!

8 thoughts on “How to change PHP handler from SuPHP to FastCGI in a cPanel server

        1. @Arunlal I am confused, but EA4 doesn’t offer fcgi as of now. What you have enabled above is cgi which I am sure is different from fcgi. Corrent me if I’m wrong.

  1. 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!


    1. 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.

  2. Hi,

    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 *