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

Overview

The rebuild_phpconf script on your server allows you to udpate your server's php.conf file (located at /usr/local/cpanel/bin/rebuild_phpconf). When you do this, you can change Apache’s PHP handler configuration, change the default version of PHP that your server uses, and enable or disable the suEXEC feature.

Notes:

  • This document only applies to systems that run EasyApache3.
  • This script offers nearly the same functionality as WHM's Configure PHP and suEXEC feature (WHM >> Home >> Service Configuration >> Configure PHP and SuExec). Users who are more comfortable with a graphical interface may prefer that method.

View a list of options

To see a list of all of the options and arguments for this script, run the following command:

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

 

The system displays the following usage information:

Usage: /usr/local/cpanel/bin/rebuild_phpconf [--dryrun] [--no-restart] [--no-htaccess]
[--current|--available] [--errors] <Default PHP> <PHP4 Handler> <PHP5 Handler> <Suexec>
 --dryrun       : Only display the changes that would be made
 --no-restart   : Don't restart Apache after updating the php.conf link
 --no-htaccess  : Don't update user configurable PHP mime mapping.
 --current      : Show current settings
 --available    : Show available handlers and PHP SAPIs
 --errors       : Print additional errors on stderr instead of only writing to log
 <Default PHP>  : Version of PHP to set as default handler for .php files
 <PHP# Handler> : Type of Apache module to use in serving PHP requests
 <Suexec>       : enabled, disabled, 1 or 0

Important:

You must specify a value for the arguments within the <> brackets.

For example, if you wish to use PHP 5 with CGI as the PHP handler and suEXEC enabled, run the following command:

/usr/local/cpanel/bin/rebuild_phpconf 5 none cgi 1

 

The following table lists the possible arguments to use:

ParameterDescription
--dryrunUse this argument if you wish to compile and view the PHP configuration file before you use it on your server. This is useful when you check for errors and security flaws before Apache uses this PHP configuration. You will need to run the script again without the  --dryrun  argument in order to effect your PHP configuration changes.

--no-restart

Use this argument if you do not wish to restart Apache after you update the PHP configuration file.

--no-htaccessUse this argument if you do not wish to update users'  .htaccess  files.
--current

This argument displays the current php.conf settings and does not change the configuration. The system displays the following information:

  • The version of PHP that the system currently uses by default.
  • The SAPI (server API, or interface) that the system currently uses to run PHP 4.
  • The SAPI that the system currently uses to run PHP 5.
  • Whether suEXEC is enabled.
  • Displays whether RUID2 is installed or available.
--available

This argument displays available php.conf settings but does not change the configuration. The system displays the following information:

  • The PHP request handlers that are available to Apache.
  • The SAPI (server API) that the system compiles into the PHP 4 binary.
  • The SAPI that the system compiles into the PHP 5 binary.
  • Whether suEXEC is available.
  • Displays whether RUID2 is installed or available.
--errorsUse this argument if you wish for the system to display additional  php.conf  error messages, as well as write the errors to the system's  /log  files.
<Default PHP>

The default version of PHP that the server will use. You may select any functional version that is correctly installed on your server.

Warning:

cPanel & WHM no longer support PHP 4.

 

<PHP4 Handler>

Apache uses this handler type to serve PHP 4 requests.

Note:

The following are valid input options for this parameter:

  • cgi
  • dso
  • none
  • fcgi
  • suphp

<PHP5 Handler>

Apache uses this handler type to serve PHP 4 requests.

Note:

The following are valid input options for this parameter:

  • cgi
  • dso
  • none
  • fcgi
  • suphp

<suexec>Whether you wish to enable the Apache suEXEC feature on your server.

Important:

 Some of the handlers may not be available due to Apache's configuration.

To learn more about PHP handlers, read our  Apache PHP Request Handling  documentation.

Additional documentation