Run multiple php versions on centos 7

Operating System & Version
CentOS 7.9
cPanel & WHM Version
v92.0.4

dxb04

Member
Dec 27, 2020
17
1
3
UAE
cPanel Access Level
Root Administrator
Hello ,

Recently i had upgraded my server , installed it with Centos 7 and currently running with php 7.3 +

I have few scripts which are not working on the current php version .. it use to work on php 5.4 while the serve were on centos 6

so , i would like to know if there is a way to run more than a version of php on the server ..

by the way , one of the scripts is showing the following :

Code:
Zend Guard Run-time support missing!
One more more files on this web site were encoded by ZendGuard and the required run-time support is not installed orproperly configured.

For the Web site user
This means that this Web server is not configured correctly to runthe files that it contains. Please contact the Web site'sadministrator/webmaster and inform them of this problem and give themthe URL you are trying to display to help them in diagnosing theproblem.

For The Site Administrator/Web Master
One or more files on your site were encoded with Zend Guard. Thismay be third party libraries that were provided to you by an ISV. Toallow these files to properly run you need to download and installone of the Zend guard run-time libraries. This is either ZendOptimizer or Zend Loader. The proper files can be downloaded fromhttp://www.zend.com/guard/downloads.This software is provided free of charge.

General Disclaimer: Zend Technologies is not responsible tothe configuration and setup of web sites using Zend Guard technology.Please contact your software vendor if these components were providedby an ISV or consult your Zend Guard Users Guide if these files wereencoded by your organization.
So i need help to be able solve this problem
 
Last edited by a moderator:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
4,151
523
273
cPanel Access Level
Root Administrator
Hey there! By default, cPanel supports multiple PHP versions. You would just need to install the versions you want with EasyApache, and then you can go to WHM >> MultiPHP Manager to choose which version of PHP you want to use on each domain.

If you have trouble setting that up please let me know!
 

dxb04

Member
Dec 27, 2020
17
1
3
UAE
cPanel Access Level
Root Administrator
Hey there! By default, cPanel supports multiple PHP versions. You would just need to install the versions you want with EasyApache, and then you can go to WHM >> MultiPHP Manager to choose which version of PHP you want to use on each domain.

If you have trouble setting that up please let me know!
Hi ,

Thank you for your kind reply ..

After i read your reply , i did a search to understand the way i can install other php version by using " yum " command and " EasyApache " PHP Versions ..
i found that the way is by using the command :
Code:
yum install ea-php54
To install PHP 5.4 etc ..

So , by doing that .. will i have PHP 5.4 with the current version of PHP 7 ?
And how i can change the php version of a specific website ?
is it only from the WHM ?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
4,151
523
273
cPanel Access Level
Root Administrator
If you aren't familiar with using Yum on the command line you'll likely find it is much easier to use the WHM >> EasyApache interface to install different PHP versions. But yes, you can do that work on the command line as well and that will work just fine. When you install the main package, such as ea-php54 in your example, it will install dependencies and common modules automatically.

Once that is done you'll have both versions installed and you'll be able to choose which one you want to use for each site. You can do that from the MultiPHP Manager tool either in WHM or in cPanel.

You may want to read our documentation on that tool here:

WHM version: MultiPHP Manager for WHM (new) | cPanel & WHM Documentation
cPanel version: MultiPHP Manager for cPanel | cPanel & WHM Documentation
 

dxb04

Member
Dec 27, 2020
17
1
3
UAE
cPanel Access Level
Root Administrator
Hi ,

I tried what is mentioned in the WHM article ..
but it didn't work !

by the way ..
While i was searching , i found a post about modifying .htaccess file by adding like this :
Code:
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php55” package as the default “PHP” programming language.
<IfModule mime_module>
  AddType application/x-httpd-ea-php55 .php .php5 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
will this work ?!
 

dxb04

Member
Dec 27, 2020
17
1
3
UAE
cPanel Access Level
Root Administrator
That article wouldn't be related to changing the PHP version for the domains on the system. You'd want to stick with articles on MultiPHP Manager in order to do that work.
Sorry , i got confused ..
i opened both pages i thought it is a part of the work that i need to do ..
so , should i remove what i did in the article ?

and regarding the php version , i should get the new installed php version in WHM ?

or there is a way to change the user php version through command line ?!
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
4,151
523
273
cPanel Access Level
Root Administrator
The changes to PHP-FPM you made are likely still valid, but just wouldn't be related to you running multiple PHP versions on the system.

I think it's much easier to use the WHM interface to make these changes as it's just a few clicks to choose a new version in EasyApache, and then another couple clicks to set that version for a site in MultiPHP Manager. You can do that work over command line, but the WHM workflow, in my opinion, is much easier.
 

dxb04

Member
Dec 27, 2020
17
1
3
UAE
cPanel Access Level
Root Administrator
Hi ,

Thank you again for your help and reply ..
i understand that the easiest way to change the php version is through WHM and i will do so ..
the other point of asking about the way of doing the same job through ssh , it is just a knowledge and information that i want to understand and learn for any reason i may face ..

Any way ..
if i face any difficulties , i will let you know ..

Thank you very much :)
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
4,151
523
273
cPanel Access Level
Root Administrator
Thanks for the additional details. I believe the best way to do this from command line would be our WHMAPI system, which is outlined here:


The API calls mentioned on that page will let you manipulate PHP both globally and for a particular user, so let me know if that is more along the lines of what you're looking for :D
 

dxb04

Member
Dec 27, 2020
17
1
3
UAE
cPanel Access Level
Root Administrator
Thanks for the additional details. I believe the best way to do this from command line would be our WHMAPI system, which is outlined here:


The API calls mentioned on that page will let you manipulate PHP both globally and for a particular user, so let me know if that is more along the lines of what you're looking for :D
Sorry for the late reply ..

I tried the both ways .. manual through ssh and WHM ..
It showed that the php version had been changed for the specific User ..
But still the script on the user account is not working !

Is there any extra steps that i have to do ?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
4,151
523
273
cPanel Access Level
Root Administrator
Are you seeing any specific errors from the script or in the Apache logs at /etc/apache2/logs/error_log? It sounds like this isn't a problem with changing versions, but a problem with the script itself or a missing PHP module.
 

dxb04

Member
Dec 27, 2020
17
1
3
UAE
cPanel Access Level
Root Administrator
Are you seeing any specific errors from the script or in the Apache logs at /etc/apache2/logs/error_log? It sounds like this isn't a problem with changing versions, but a problem with the script itself or a missing PHP module.
What i am seeing is about Zend ..

Same like before ..

Code:
Zend Guard Run-time support missing!
One more more files on this web site were encoded by ZendGuard and the required run-time support is not installed orproperly configured.

For the Web site user
This means that this Web server is not configured correctly to runthe files that it contains. Please contact the Web site'sadministrator/webmaster and inform them of this problem and give themthe URL you are trying to display to help them in diagnosing theproblem.

For The Site Administrator/Web Master
One or more files on your site were encoded with Zend Guard. Thismay be third party libraries that were provided to you by an ISV. Toallow these files to properly run you need to download and installone of the Zend guard run-time libraries. This is either ZendOptimizer or Zend Loader. The proper files can be downloaded fromhttp://www.zend.com/guard/downloads.This software is provided free of charge.

General Disclaimer: Zend Technologies is not responsible tothe configuration and setup of web sites using Zend Guard technology.Please contact your software vendor if these components were providedby an ISV or consult your Zend Guard Users Guide if these files wereencoded by your organization.
In the version 5.4 , is there any thing else i should install ?!
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
4,151
523
273
cPanel Access Level
Root Administrator
Alright - that would indicate the Zend Guard Loader packages aren't installed for any version of PHP on the system. Can you use the EasyApache tool in WHM to get that installed for at least PHP 5.4? Additional details on how to do that can be found here:

 

dxb04

Member
Dec 27, 2020
17
1
3
UAE
cPanel Access Level
Root Administrator
Alright - that would indicate the Zend Guard Loader packages aren't installed for any version of PHP on the system. Can you use the EasyApache tool in WHM to get that installed for at least PHP 5.4? Additional details on how to do that can be found here:

I checked the link , but didn't understand what i have to choose to install Zend .. there is lot of options !
 

dxb04

Member
Dec 27, 2020
17
1
3
UAE
cPanel Access Level
Root Administrator
Hello again ..

Now i understand where i should change .. and i choosed zend , reviewd , then installed ..
i had a test file for this script and it shows the functions which is working + what is not working ..
right now .. eveything is ok except this function ( zend_optimizer_version ) , how to enable it ?!

the rest i did enable it through Easyapache and php.ini .. and this the only one left for now ..