Monday 17 February 2014

How to change between PHP and handlers via command line in a cPanel server.

To get the details of the PHP in a cPanel server, use the following command:

===========
root@cpanel1 [~]# /usr/local/cpanel/bin/rebuild_phpconf --current
Available handlers: suphp dso cgi none
DEFAULT PHP: 4
PHP4 SAPI: suphp
PHP5 SAPI: none
SUEXEC: enabled
RUID2: enabled
=======

The above result means that  "DEFAULT PHP" is PHP 4 and "PHP 5 " is not enabled.
While SUEXEC is enabled. Also, PHP 4 is using the PHP handler SUPHP.

Also, see the php.conf file entries:
====
root@cpanel1 [~]# cat /usr/local/apache/conf/php.conf

# SuPHP configuration for PHP4
LoadModule suphp_module modules/mod_suphp.so
suPHP_Engine on
AddType application/x-httpd-php4 .php5 .php4 .php .php3 .php2 .phtml
<Directory />
    suPHP_AddHandler application/x-httpd-php4
</Directory>

# End of autogenerated PHP configuration.
=====

Now, let us change from PHP 4 to PHP 5 use the following command;
=====
root@cpanel1 [~]# /usr/local/cpanel/bin/rebuild_phpconf 5 none suphp 1
======


SYNXTAX: /usr/local/cpanel/bin/rebuild_phpconf <Default PHP> <PHP4 Handler> <PHP5 Handler> <Suexec>


Now lets see the output:
=====
root@cpanel1 [~]# /usr/local/cpanel/bin/rebuild_phpconf --current
Available handlers: suphp dso cgi none
DEFAULT PHP: 5
PHP4 SAPI: none
PHP5 SAPI: suphp
SUEXEC: enabled
RUID2: enabled
=====

Now, see the output above:

Default PHP is now 5 and the handler for the same is SUPHP.

 Also, see the change in php.conf file:
====
root@cpanel1 [~]# cat /usr/local/apache/conf/php.conf

# SuPHP configuration for PHP5
LoadModule suphp_module modules/mod_suphp.so
suPHP_Engine on
AddType application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml
<Directory />
    suPHP_AddHandler application/x-httpd-php5
</Directory>

# End of autogenerated PHP configuration.

====

No comments:

Post a Comment

Note: only a member of this blog may post a comment.