Page tree
Skip to end of metadata
Go to start of metadata

This document is for a previous release of cPanel & WHM. To view our latest documentation, visit our Home page.

For cPanel & WHM 11.46

(Home >> Service Configuration >> Configure PHP and SuExec)


This interface allows you to change Apache’s PHP handlers configuration, PHP version, and enable or disable the suEXEC program.

Change the default PHP version

You can define which version of PHP that the system will use when a visitor to a site on your server encounters a .php file.

To change the default PHP version, select the version of PHP that you wish to use from the Default PHP Version (.php files) menu and click Save New Configuration. 

Enable or Disable Apache suExec

When you enable suEXEC, Apache runs CGI software as the user ID of the account owner rather than as the user nobody.

To enable or disable suEXEC, select on or off from the Apache suEXEC menu and click Save New Configuration.

When you configure these options, to compile and view the PHP configuration file before you use it on your server, select the Do a dryrun checkbox at the bottom of the interface before you click Save New Configuration. Use this to check for errors and security flaws before Apache uses this PHP configuration. After you click Save New Configuration, click Apply Settings in the following interface to apply the new settings to your PHP configuration.


This is not PHPsuEXEC. This version of suEXEC only pertains to PHP that CGI handles.

Define a PHP handler

A PHP handler calls the PHP libraries that are necessary for the system to interpret the PHP code. The handler that you choose determines the libraries that the system accesses. You may assign different PHP handlers to different versions of PHP.


If you build Apache without PHP, you will not see any handlers to select.

To define new PHP handlers, perform the following steps:

  1. Select the handlers that you wish to handle one or both versions of PHP.
  2. In the PHP 5 Handler menu, select the handler that you wish to use.
  3. Click Save New Configuration.

Migrate from DSO to suPHP

To migrate from DSO to suPHP, perform the following steps:

Step 1: Configure WHM for suPHP

In the PHP 5 Handler menu, select suphp and click Save Configuration.

Step 2: Update permissions and ownership

Perform the following changes inside each user's public_html directory:

  • Change the permissions of files to 644 and directories to 755.
  • Change the ownership of the files and directories to user:user. Do not change the public_html directory owner. The default owner is user:nobody.


  • Do not make any changes to the directory itself.
  • If you change ownership or permissions of files outside of public_html, you may cause problems with other aspects of the account, such as mail.

Step 3: Edit the .htaccess files

If you previously allowed PHP customizations through .htaccess files, you must remove or comment out all php_value or php_flag settings in the user .htaccess files.


We strongly recommend that you perform a backup before you make changes to your .htaccess files.

The following commands will remove the php_value and php_flag settings from the .htaccess files:

find /home -type f -name '.htaccess' -exec grep -Hrn 'php_value' '{}' \;
find /home -type f -name '.htaccess' -exec grep -Hrn 'php_flag' '{}' \;

Step 4: PHP Customizations

To allow PHP customization, create a custom php.ini file in the user's directory.

To create a custom php.ini file, perform the following steps:

  1. Copy the server's php.ini file (/usr/local/lib/) to the user's home directory (For example, /home/username).
  2. Add the new values to the user's php.ini file.


If php.ini file in the user's directory is not valid and complete, the suPHP will default to the php.ini file located at /usr/local/lib/


For each directory that contains PHP scripts that require the custom settings, add suPHP_ConfigPath /home/username/ to the .htaccess file in the folder where the PHP script is located.

Additional Documentation