There was a problem loading the comments.

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

Support Portal  »  Knowledgebase  »  Viewing Article

  Print
  • 25/01/2019 1:34 PM

Eco Web 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:

Image

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:

Image

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:

Image

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

Share via
Did you find this article useful?  

Related Articles

© Eco Web Hosting