I'm trying to switch my Terminal PHP version to 5.4 because I ran into some issues with Drush while updating my Drupal core. http://drupal.stackexchange.com/questions/112090/drush-command-errors
The reason for these issues is my Terminal PHP version is different then my localhost.
php -v in Terminal returns
PHP 5.5.13 (cli) but my localhost is running
PHP Version 5.4.29.
I started searching on how to switch my CLI version to 5.4 and found this:
sudo rm /usr/bin/php // remove /usr/bin/php first sudo ln -s /opt/local/bin/php54 /usr/bin/php // pointing to php54 php -v // get version PHP 5.4.9 (cli) (built: Nov 26 2012 12:40:37) Copyright (c) 1997-2012 The PHP Group
However, after doing this, and restarting Apache and Terminal, I'm still getting
PHP 5.5.13 (cli) after
To be sure I was working in the correct folder, I checked to see if the
php file was deleted after running
sudo rm /usr/bin/php, and it was.
So as a test I did this:
/opt/local/bin/php54 -v and got
PHP 5.4.29 (cli). Which makes me think my symlink doesn't work, or I did something wrong.
sudo rm /usr/bin/php I expected
php -v would give an error in Terminal, however its still giving me
PHP 5.5.13 (cli).
I'm also always getting the same results when running
whereis php and
which php, even after the symlink.
whereis php returns
which php returns
#LoadModule php5_module modules/mod_php55.so LoadModule php5_module modules/mod_php54.so #LoadModule php5_module modules/mod_php53.so #LoadModule php5_module modules/libphp5.so #Include conf/extra/mod_php55.conf Include conf/extra/mod_php54.conf #Include conf/extra/mod_php53.conf #Include conf/extra/mod_php.conf
# MacPorts Installer addition on 2012-10-23_at_13:41:14: adding an appropriate PATH $ export PATH=/opt/local/bin:/opt/local/sbin:$PATH # Finished adapting your PATH environment variable for use with MacPorts. # also include mysql binaries export PATH=$PATH:/opt/local/lib/mysql5/bin
Any help is greatly appreciated.