How to run a PHP program file using a specific PHP version from Terminal?

In multiPHP environment, you can run different PHP programs using various PHP versions from Terminal. 

First you need to locate the PHP binary for the specific PHP version. You can locate it at - “/opt/cpanel/ea-phpXY/root/usr/bin/php”. Replace XY with the PHP version.

So, for a program named abc.php located in public_html that requires PHP 8.1 you would need to run the following from Terminal:

/opt/cpanel/ea-php81/root/usr/bin/php /home/{yourcpanelhomedirectory}/public_html/abc.php

In the above example, replace {yourcpanelhomedirectory} with your cpanel account's home directory name.

 

 

Was this answer helpful?

 Print this Article

Also Read

Do you support International domain names and clients?

We support all domain name extensions from around the world.

How to force SSL with .htaccess

You can force an HTTPS connection on your website by adding these rules in your website's...

Unblock IP address from server firewall

All our shared Linux hosting servers are protected by firewall. While the purpose of a firewall...

Google Email MX Setup in cPanel

Login to your cPanel and open Zone Editor Click on Manage Remove all existing MX records Add...

Domain has exceeded the max defers and failures per hour

What is this error?If you are receiving an error similar to "Domain example.com has exceeded the...