The rebuild_phpconf Script

Valid for versions 82 through the latest version

Version:

82


Last modified: September 29, 2020

Overview

The /usr/local/cpanel/bin/rebuild_phpconf script manages your server’s default PHP version and PHP handlers in EasyApache 4. You can use this script to set your system default PHP version or change the PHP handler for a PHP version. You can also make these changes in WHM’s MultiPHP Manager interface (WHM » Home » Software » MultiPHP Manager).

Run the script

To use the /bin/rebuild_phpconf script, run the following script:

/usr/local/cpanel/bin/rebuild_phpconf [arguments]
Note:

When you run the /bin/rebuild_phpconf script, the system writes to the /etc/cpanel/ea4/php.conf file. The system backs up any changes made to this file to the /etc/cpanel/ea4/php.conf.bak/TIME.PID file, where TIME represents the time the system made the change and PID represents the process PID. The system only keeps the 20 most recent php.conf file changes.

Arguments

The /usr/local/cpanel/bin/rebuild_phpconf script accepts the following arguments:

Argument Description Example
--default=version Set the default version of PHP that Apache uses. In this argument, version represents the name of the PHP package that you wish to set as the default PHP version. /usr/local/cpanel/bin/rebuild_phpconf --default=ea-php71
--version=handler Set the PHP handler that the specified PHP version uses. In this argument, version represents the name of the PHP package that you wish to set the PHP handler for, and handler represents the name of the PHP handler that you wish to use. /usr/local/cpanel/bin/rebuild_phpconf --ea-php71=suphp
--current Display the current PHP handler settings. /usr/local/cpanel/bin/rebuild_phpconf --current
--available Display the available handlers and PHP versions. /usr/local/cpanel/bin/rebuild_phpconf --available
--help Display a help message. /usr/local/cpanel/bin/rebuild_phpconf --help
--dryrun Dispay the changes that a set of arguments would make to Apache. /usr/local/cpanel/bin/rebuild_phpconf --dryrun
--no-restart Do not restart Apache after you make changes. /usr/local/cpanel/bin/rebuild_phpconf --no-restart
--errors Print errors to STDERR as well as the log file. /usr/local/cpanel/bin/rebuild_phpconf --errors
--no-users Do not update user settings when you update a PHP version’s handler. /usr/local/cpanel/bin/rebuild_phpconf --no-users

Examples

The following example sets the default PHP version to PHP 7.1 and the PHP handler to cgi:

/usr/local/cpanel/bin/rebuild_phpconf --default=ea-php71 --ea-php71=cgi

The following example displays the requested changes, but does not apply them:

/usr/local/cpanel/bin/rebuild_phpconf --dryrun --ea-php71=cgi --ea-php72=suphp

The following example changes the handler for PHP 7.1 to dso, but does not change the PHP handler for the users that use PHP 7.1:

/usr/local/cpanel/bin/rebuild_phpconf --ea-php71=dso --no-users

Additional Documentation