Our hosting providers have installed 3 versions of PHP onto our linux box and when I SSH into it the command php points to use/bin/php which is version 5.2, the command php-5.4 points to usr/bin/php-5.4 which is version 5.4 of course. This isn't a problem when I just need to run a single script that needs a newer version of php, I can just specify php-5.4, however when I try to run the Laravel installer or try to install Laravel using Composer it is throwing errors that are caused by php 5.2 being used.Is there a way to change where the php keyword points? Or do I need to remove bin/php and rename bin/php-5.4?
PHP CLI and Bash - change behaviour of PHP keyword
bash;command line;php
You can attack this in a variety of ways.Method #1 - aliasYou can make an alias, php=php-5.4, and then attempt to run your script. Assuming that it relies on the current shells ability to locate how to run things, then it should pickup the alias for php instead of the php that's located under /usr/bin.Method #2 - $PATHYou can override the precendence of where shells locate executables by manipulating the $PATH environment variable. Simply add the location of some other directory to the front of the $PATH.export PATH=/path/to/newdir:$PATHNow put a shell script or link in this directory named php. Here's the script:#!/bin/bashphp-5.4 $*Here's the link:$ cd /path/to/newdir$ ln -s /usr/bin/php-5.4 php