We have a new documentation site for cPanel & WHM! You can find our new documentation site at docs.cpanel.net.

We will continue to maintain our API documentation on this server.

Child pages
  • Configure PHP and suEXEC
For cPanel & WHM version 76

Skip to end of metadata
Go to start of metadata

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


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


This interface only appears if your server runs EasyApache 3. We strongly recommend that you upgrade your server to run EasyApache 4.

In EasyApache 4, you can perform the actions that this document describes in the following interfaces:

Change the default PHP version

You can define which version of PHP the system uses when Apache serves 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 account owner rather than as the nobody user.

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

To test your new configuration, select the Do a dryrun checkbox. This feature allows you to verify the new configuration before deployment. After you click Save New Configuration, click Apply Settings in the following interface to apply the new settings to your PHP configuration.


Apache suEXEC differs from PHP suEXEC. Apache suEXEC only pertains to PHP that CGI handles.

Define a PHP handler

A PHP handler calls the PHP libraries that the system requires 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, the interface will not display any handlers in the menu.

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


For more information about PHP handlers, read our PHP Handlers documentation.

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


Configure WHM for suPHP

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



Update permissions and ownership

To update file 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 within the public_html directory to user:user.


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



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.

Run the following commands to 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' '{}' \;



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 /usr/local/lib/php.ini to the user's home directory.
  2. Add the new values to the user's php.ini file.


    If an invalid php.ini file resides in the user's directory, suPHP defaults to the php.ini file in the /usr/local/lib/ directory.

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

Additional documentation

There is no content with the specified labels

There is no content with the specified labels

There is no content with the specified labels