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

What are your server specifications?

Every server at QSS Hosting has different specifications. Whenever a server reaches what we feel...

Can I upgrade my shared hosting account at any time?

Yes, you can upgrade your account at any time within a few minutes, for free!

Google Email MX Setup in cPanel

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

How fast are accounts set up?

QSS Hosting strives for a setup time of no more than 60 minutes per shared hosting order. If an...

How to specify a custom php.ini for a web site

Linux: Creating a new php.ini file If you do not have a php.ini file in your public_html folder...