How to set PHP Handler and Install PHP Extensions on Easyapache 4 server
I. How to Install PHP 5.4, 5.5, 5.6, 7.0 and 7.1 on Easyapache 4 Server
After cPanel installation login to your server via SSH and check whether all the PHP version package is installed or not. On my server WHM and server backend was showing error ” The “ea-php54” package does not provide an executable binary”
Example :
PHP 5.4 package (and dependencies) was not installed on the server and I have installed it using the below command.
yum install ea-php54
The above command will install the required dependencies ea-php54-php-cli, ea-php54-php-devel and ea-php54-pear and it will fix the above error. Command to install other PHP version is given below.
Command to install PHP 5.5 : yum install ea-php55
Command to install PHP 5.6 : yum install ea-php56
Command to install PHP 7.0 : yum install ea-php70
Command to install PHP 7.1 : yum install ea-php71
Now you have installed all the PHP version on the server. Login to WHM and click on “MultiPHP Manager” under “Software”. Under “PHP Handlers” tab you can see all the PHP versions you have installed on the server.
II. How to Install PHP handler on Easyapache 4 server
There are four PHP handlers available on cPanel servers : DSO, suPHP, FastCGI, CGI
The below command will list all the available handlers on the server :
COMMAND : /usr/local/cpanel/bin/rebuild_phpconf --available
[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
Run the below command to check the current PHP handler on the server
COMMAND : /usr/local/cpanel/bin/rebuild_phpconf --current
[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
On the above server you can see that CGI is the PHP handler for all PHP version and default PHP version is PHP 5.6.
suPHP handler :
Do the below steps to install suPHP handler.
1. Log into cPanel server via SSH as root
2. Run the command “yum install ea-apache24-mod_suphp” to install suPHP on easyapache 4 server
3. Login to WHM after installing “ea-apache24-mod_suphp” package and click on “MultiPHP Manager” under “Software”.
4. Click on “PHP handlers” tab
5. Click on “Edit” under “Actions”
6. Select the suPHP handler from the dropdown
7. Click on “Apply”
Use the below command to change the PHP handler from server backend
COMMAND : /usr/local/cpanel/bin/rebuild_phpconf --default=ea-phpXX --ea-phpXX=handlername
Example : I have changed the PHP handler of 5.4 version from suPHP to CGI.
[root@server ~]# /usr/local/cpanel/bin/rebuild_phpconf --current
DEFAULT PHP: ea-php56
ea-php54 SAPI: suphp
ea-php55 SAPI: suphp
ea-php56 SAPI: suphp
ea-php70 SAPI: suphp
ea-php71 SAPI: suphp
[root@server ~]# /usr/local/cpanel/bin/rebuild_phpconf --default=ea-php56 --ea-php54=cgi
[root@server ~]# /usr/local/cpanel/bin/rebuild_phpconf --current
DEFAULT PHP: ea-php56
ea-php54 SAPI: cgi
ea-php55 SAPI: suphp
ea-php56 SAPI: suphp
ea-php70 SAPI: suphp
ea-php71 SAPI: suphp
How to Install DSO handler on Easyapache 4 server
1. Log into server via SSH as ‘root’
2. Install DSO by running the command “yum install ea-php56-php”
Do the below steps to change the handler to DSO on easyapache 4 servers :
[root@server ~]# /usr/local/cpanel/bin/rebuild_phpconf --default=ea-php56 --ea-php56=dso
[root@server ~]# /usr/local/cpanel/bin/rebuild_phpconf --current
DEFAULT PHP: ea-php56
ea-php54 SAPI: cgi
ea-php55 SAPI: cgi
ea-php56 SAPI: dso
ea-php70 SAPI: cgi
ea-php71 SAPI: cgi
How to install PHP module/Extension on Easyapache 4
How to install PHP curl extension on easyapache 4 server
1. Log into your linux server via SSH as root
2. Run the command yum install “ea-phpXX-php-curl” to install curl
Command to Install curl for PHP version 5.4 : yum install ea-php54-php-curl
Command to Install curl for PHP version 5.5 : yum install ea-php55-php-curl
Command to Install curl for PHP version 5.6 : yum install ea-php56-php-curl
Command to Install curl for PHP version 7.0 : yum install ea-php70-php-curl
Install zlib, core, ctype, date, ereg
Run the command “yum install ea-phpXX-php-common” to install zlib PHP module
Command :
yum install ea-php70-php-common
yum install ea-php56-php-common
yum install ea-php55-php-common
yum install ea-php54-php-common
Install Bcmath
Run the command “yum install ea-phpxx-php-bcmath” to install bcmath on easyapache 4 server.
Command :
yum install ea-php70-php-bcmath
yum install ea-php56-php-bcmath
yum install ea-php55-php-bcmath
yum install ea-php54-php-bcmath
Install Calender
Run the command “ea-phpXX-php-calendar” to install the module on easyapache 4 server.
Command :
yum install ea-php70-php-calendar
yum install ea-php56-php-calendar
yum install ea-php55-php-calendar
yum install ea-php54-php-calendar
Install mbstring, mcrypt
Run the below command on your easyapache 4 server to install mcrypt and mbstring
yum install ea-php54-php-mcrypt
yum install ea-php55-php-mcrypt
yum install ea-php56-php-mcrypt
yum install ea-php70-php-mcrypt
yum install ea-php54-php-mbstring
yum install ea-php56-php-mbstring
yum install ea-php55-php-mbstring
yum install ea-php70-php-mbstring