How to use Multi-PHP Manager on the command line – Part 2

Just like default php version, we can also manage php handlers from command line. But we can not set php handlers per domain or per virtual host basis instead we need to setup them globally that means we can setup php handler per php version basis. For example, if we set suphp php handler for php 5.6 so all the domains running on php 5.6 will be using suphp handler.

Let’s discuss how to check current, available php handlers in the server. 

  • Display the current default PHP version and PHP handler settings. Following output shows PHP 5.6 being the default php version for this server while cgi being php handler for all php versions.
[root@server ~]# /usr/local/cpanel/bin/rebuild_phpconf --current
 DEFAULT PHP: ea-php56
 ea-php54 SAPI: cgi
 ea-php55 SAPI: cgi
 ea-php56 SAPI: cgi
 ea-php70 SAPI: cgi
 ea-php71 SAPI: cgi
 [root@server ~]#
  • Display available Apache handlers and PHP SAPIs.
[root@server ~]# /usr/local/cpanel/bin/rebuild_phpconf --available
 ea-php54: cgi none
 ea-php55: cgi none
 ea-php56: cgi none
 ea-php70: cgi none
 ea-php71: cgi none
 [root@server ~]#

Above output shows, we have only cgi php handler being available. If we want to install additional handler such as suphp & DSO we can install them using yum.

First of all let’s search suphp rpm. Please note that the suphp rpm only needs to be installed once no matter how many version php will be using it. It means you can use same rpm for php 5.4, 5.5, 5.6 and so on.  We can search it using yum search command.

[root@server ~]# yum search suphp
 Loaded plugins: fastestmirror, security, universal-hooks
 Loading mirror speeds from cached hostfile
 * EA4: 70.87.220.252
 * base: mirror.compevo.com
 * extras: mirror.tzulo.com
 * updates: centos.den.host-engine.com
=============== N/S Matched: suphp =====================================================
 ea-apache24-mod_suphp.x86_64 : Execute PHP scripts with the permissions of their owner.

We have this RPM  ea-apache24-mod_suphp.x86_64 available. Now, let’s install it using yum.

[root@server ~]# yum install ea-apache24-mod_suphp.x86_64
 Loaded plugins: fastestmirror, security, universal-hooks
 Setting up Install Process
 Loading mirror speeds from cached hostfile
 * EA4: 70.87.220.252
 * base: mirror.compevo.com
 * extras: mirror.tzulo.com
 * updates: centos.den.host-engine.com
 Resolving Dependencies
 --> Running transaction check
 ---> Package ea-apache24-mod_suphp.x86_64 0:0.7.2-17.17.4.cpanel will be installed
 --> Finished Dependency Resolution

Dependencies Resolved
================================================================================
 Package Arch Version Repository Size
================================================================================
 Installing:
 ea-apache24-mod_suphp x86_64 0.7.2-17.17.4.cpanel EA4 506 k

Transaction Summary
================================================================================
 Install 1 Package(s)

Total download size: 506 k
 Installed size: 2.9 M
 Is this ok [y/N]:

Say yes, and it will be installed. Now, we can check whether suphp shows in available php handlers. Following output shows, its available.

[root@server ~]# /usr/local/cpanel/bin/rebuild_phpconf --available
 ea-php54: cgi none suphp
 ea-php55: cgi none suphp
 ea-php56: cgi none suphp
 ea-php70: cgi none suphp
 ea-php71: cgi none suphp
 [root@server ~]#

But for DSO handler, you need to install dso rpm for each php version. For example, if you want to install DSO for PHP 5.6, the rpm for it would be ea-php56-php. Let’s try it.

[root@server ~]# yum install ea-php56-php
Loaded plugins: fastestmirror, security, universal-hooks
Setting up Install Process
Loading mirror speeds from cached hostfile
* EA4: 70.87.220.252
* base: repo1.dal.innoscale.net
* extras: yum.tamu.edu
* updates: yum.tamu.edu
Resolving Dependencies
--> Running transaction check
---> Package ea-php56-php.x86_64 0:5.6.30-1.1.3.cpanel will be installed
--> Finished Dependency Resolution

Dependencies Resolved
================================================================================
Package Arch Version Repository Size
===============================================================================
Installing:
ea-php56-php x86_64 5.6.30-1.1.3.cpanel EA4 1.4 M

Transaction Summary
================================================================================
Install 1 Package(s)

Total download size: 1.4 M
Installed size: 4.4 M
Is this ok [y/N]: y

httpd restarted successfully.
Setting /home permissions to 0711......Done
Setting permissions for........Done
Service Status

apache_php_fpm restarted successfully.
Verifying : ea-php56-php-5.6.30-1.1.3.cpanel.x86_64 1/1

Installed:
ea-php56-php.x86_64 0:5.6.30-1.1.3.cpanel

Now, we can check whether DSO handler is available for php 5.6.

[root@server ~]# /usr/local/cpanel/bin/rebuild_phpconf --available
ea-php55: cgi none
ea-php56: cgi dso none
ea-php70: cgi none
[root@server ~]#

Above output shows dso handler being available for php 5.6. We can use similar steps for other php versions.

Now, how to change php handlers.

Before we change the php handler, let’s see what php handler is being used.

[root@server~]# /usr/local/cpanel/bin/rebuild_phpconf --current
DEFAULT PHP: ea-php56
ea-php55 SAPI: suphp
ea-php56 SAPI: suphp
ea-php70 SAPI: suphp
ea-php71 SAPI: suphp

Above output shows we have suphp handler being setup for all php versions. Let’s set cgi php handler for php 5.5

[root@server~]# /usr/local/cpanel/bin/rebuild_phpconf --ea-php55=cgi --errors
[root@server~]#

We used –errors argument to show errors to the screen. Now, let’s check whether php handler is changed.

[root@server~]# /usr/local/cpanel/bin/rebuild_phpconf --current
DEFAULT PHP: ea-php56
ea-php55 SAPI: cgi
ea-php56 SAPI: suphp
ea-php70 SAPI: suphp
ea-php71 SAPI: suphp

From above given output, you can see cgi php handler being setup for php version 5.5. You can use similar method for other php versions.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge