This document only applies to systems that run EasyApache 4.  

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). 

The /bin/rebuild_phpconf script

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

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


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:

ArgumentDescriptionExample
--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
--currentDisplay the current PHP handler settings. /usr/local/cpanel/bin/rebuild_phpconf --current
--availableDisplay the available handlers and PHP versions. /usr/local/cpanel/bin/rebuild_phpconf --available
--helpDisplay a help message. /usr/local/cpanel/bin/rebuild_phpconf --help
--dryrunDisplay the changes that a set of arguments would make to Apache. /usr/local/cpanel/bin/rebuild_phpconf --dryrun
--no-restartDo not restart Apache after you make changes. /usr/local/cpanel/bin/rebuild_phpconf --no-restart
--errorsPrint errors to STDERR as well as the log file. /usr/local/cpanel/bin/rebuild_phpconf --errors
--no-usersDo 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