Alias doesn't work in script with #!/usr/bin/env php
/usr/bin/env php
looks for an executable named php
in the current $PATH
; it pays no attention to aliases, shell functions, etc. If you want it to execute php v5.3, you have to put that version in a directory under the name php
, and put that directory in your PATH
somewhere before the directory that contains version 4.4. Maybe something like this:
mkdir /usr/local/bin/php-overrides
ln -s /usr/local/bin/php5-53LATEST-CLI /usr/local/bin/php-overrides/php
...then add
PATH="/usr/local/bin/php-overrides:$PATH"
to your ~/.bash_profile
(or other appropriate startup script).