24
php configuration using rebuild_phpconf in cpanel
Filed Under (cPanel/WHM, Linux) by WebScHoLaR on 24-02-2011
Tagged Under : cpanel, php, rebuild_phpconf
cPanel allows php to be configured as DSO, suPHP and FastCGI. PHP can be reconfigured using /usr/local/cpanel/bin/rebuild_phpconf script. This also allows to set the default PHP version (4 or 5) and enable/disable SuExec. Script has multiple command line parameters that can be passed to it. Script itself shows the available parameters:
[root@Server ~]# /usr/local/cpanel/bin/rebuild_phpconf
Usage: /usr/local/cpanel/bin/rebuild_phpconf [--dryrun] [--no-restart] [--no-htaccess] [--current|--available]
–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
: Version of PHP to set as default handler for .php files : Type of Apache module to use in serving PHP requests
: enabled, disabled, 1 or 0
Help is quite self descriptive. The existing PHP configuration can be checked as:
[root@Server ~]# /usr/local/cpanel/bin/rebuild_phpconf –current
Available handlers: suphp dso cgi none
DEFAULT PHP: 4
PHP4 SAPI: suphp
PHP5 SAPI: suphp
SUEXEC: disabled
PHP configuration can be modified as per needs. In order to set default php to 5 , enable suexec and set PHP5 as suphp and PHP4 as dso, the command will be:
/usr/local/cpanel/bin/rebuild_phpconf 5 dso suphp 1
First Parameter 5 will set the default PHP to PHP 5
Second Parameter dso will set PHP 4 as DSO
Third Parameter suphp will set PHP5 as suPHP
Fourth Parameter 1 will enable Suexec
PHP configuration after the above command will change to:
[root@Server ~]# /usr/local/cpanel/bin/rebuild_phpconf –current
Available handlers: suphp dso cgi none
DEFAULT PHP: 5
PHP4 SAPI: dso
PHP5 SAPI: suphp
SUEXEC: enabled
