Configuring PHP and suEXEC from the Command Line

For WHM version 11.24

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). By doing this, you can change Apache’s PHP handler configuration, change the default version of PHP used by your server, and enable or disable the suEXEC feature.

note Note: This script offers nearly the same functionality as the WHM Configure PHP and suEXEC feature. Users more comfortable with a graphical interface may prefer that method.

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

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

The system will display usage information as follows:

Usage: /usr/local/cpanel/bin/rebuild_phpconf [--dryrun] [--no-restart] [--no-htaccess]
[--current|--available] <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
 <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

Please note that you must specify a value for the arguments in < and > brackets. For example, if you wish to use PHP 5, use CGI as the handler, and enable suEXEC, you might type:

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

Details about these options:

--dryrun

Use this option if you wish to simply compile and view the PHP configuration file before you use it on your server. This can be useful when checking for errors and security flaws before Apache uses this PHP configuration. Of course, you will need to run the script again without the --dryrun flag in order to effect your PHP configuration changes.

--no-restart

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

--no-htaccess

Use this option if you do not wish to update users' .htaccess files.

--current

Rather than changing the configuration, this argument displays the current php.conf settings. The system displays:

  • The version of PHP currently being used by default.
  • The SAPI (server API, or interface) currently being used to run PHP 4.
  • The SAPI currently being used to run PHP 5.
  • Whether suEXEC is enabled.

--available

Rather than changing the configuration, this argument displays available php.conf settings. The system displays:

  • The PHP request handlers that are available to Apache.
  • The SAPI (server API) compiled into the PHP 4 binary.
  • The SAPI compiled into the PHP 5 binary.
  • Whether suEXEC is available.

<Default PHP>

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

<PHP4 Handler>

The handler type Apache will use to serve PHP 4 requests.

To learn more about PHP handlers, please visit our documentation here.The valid input options for this parameter are:

  • cgi
  • dso
  • none
  • fcgi
  • suphp

note Note: Depending on how Apache is configured, some handlers may not be available. For more information, you can visit our documentation here? .

<PHP5 Handler>

The handler type Apache will use to serve PHP 5 requests.

To learn more about PHP handlers, please visit our documentation here.The valid input options for this parameter are:

  • cgi
  • dso
  • none
  • fcgi
  • suphp

note Note: Depending on how Apache is configured, some handlers may not be available. For more information, you can visit our documentation here? .

<Suexec>

Whether or not the Apache suEXEC feature should be enabled on your server.

Topic revision: r5 - 07 Aug 2009 - 23:39:31 - Main.JustinSchaefer
AllDocumentation/WHMDocs.RebuildPhpconf moved from Sandbox.RebuildPhpconf on 07 Aug 2009 - 21:42 by Main.JustinSchaefer