Why does command line not reflect the PHP version change I made?

GreenBackEnd Hosting's servers run all available versions of PHP side-by-side meaning that even if you have used the Change PHP Version option in the hosting control panel to switch to PHP 7 when running a check through command line to show the version you will see results similar to below:



The Change PHP Version option will configure the version being used by the website through a .htaccess file meaning this will affect any scripts run through a browser when visiting the site. However, a command line check will always pickup the default version on the server.

This won't have an adverse effect on the site itself but sometimes you may need to run a script through the command line which will need a specific version of PHP. If you do then running a standard command will produce an error, for example the below error when running an update for MediaWiki:



When running this command you will need a small tweak to specify the version of PHP needed, known as the interpreter. The below command runs this script using PHP 7:



For any command with a format similar to "php script.php" you can replace "php" with the specific interpreter as listed below for each version:

PHP 5.3 /usr/bin/php53
PHP 5.4 /usr/bin/php54
PHP 5.5 /usr/bin/php55
PHP 5.6 /usr/bin/php56
PHP 7.0 /usr/bin/php70
PHP 7.1 /usr/bin/php71
PHP 7.2 /usr/bin/php72
PHP 7.3 /usr/bin/php73

  • 0 Корисниците го најдоа ова како корисно
Дали Ви помогна овој одговор?

Понудени резултати

Is PHP a CGI or Apache module?

PHP runs as a CGI at GreenBackEnd Hosting. This is because it is more secure than running it as...

Can I place a PHP script in any directory I choose?

Yes. PHP scripts do not have to reside in any particular directory and will run anywhere in your...

What are the correct file permissions for a PHP file?

As a general rule, the permissions of a PHP file should take one of two sets of values, either...

Can I override php.ini/.user.ini settings?

Note: On our new platform, custom PHP settings need to be declared in a file called .user.ini,...

Does GreenBackEnd Hosting support Image::Magick?

Yes we do, and in case you need to know the exact version number, at the time of writing, the...