Home Website General Information How do I use a different version of PHP at the command-line on GIP?
How do I use a different version of PHP at the command-line on GIP? PDF Print E-mail

For executing PHP from the command-line (whether that's in an SSH shell or via cron), unfortunately, we are not able to force the php version the way we can for your domain in the web serving environment.

 

If you invoke a script with just the "php" command, then the default PHP version will be executed.  The current default version is PHP 5.2.

 

If you would like to invoke a different version of PHP, you will need to specify the version that you want executed.  Here is a list of the versions available and the executable name used to invoke it:

  • Default:  php
  • PHP 5.2:  php52
  • PHP 5.4:  php54
  • PHP 5.6:  php56
  • PHP 7.0:  php70

For example, if you want to ensure that your PHP script is executed with the PHP 5.4 interpreter, you would type the following at the command line:  "php54 myscript.php"


( 0 Votes )