Tell me more ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I used a nice one-line command to install PHP 5.4 Mac OS X Lion, from php-osx.liip.ch. This is working perfectly in Apache – my local sites are now using PHP 5.4.

But when I run php -v from the terminal, it still uses version 5.3. This is causing problems.

which php gives me /usr/bin/php, so that's where the old version is still installed. And after some digging I've found that the 5.4 binary is located at /usr/local/php5/bin/php.

So I'm nearly there... But how do I make the php command resolve to /usr/local/php5/bin/php?

share|improve this question

closed as off topic by Michael Hampton, Ward, mdpc, RolandoMySQLDBA, kce Jan 28 at 2:41

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

1 Answer

up vote 3 down vote accepted

If you don't need the old copy of the file, you can just remove it and create a symbolic link to /usr/local/php5/bin/php. You can use ln -s command. This will be easier than playing with your PATH variable.

share|improve this answer
Thank you, that works. I didn't delete /usr/bin/php, I just renamed it to php_OLD just in case... – callum Jun 3 '12 at 13:34
@callum: That's better :) – Khaled Jun 3 '12 at 13:54
@Khaled I am also having the same issue. I followed your answer and now It does show new version with php -v command but using phpinfo() function shows older version. Could you please look at my post – x4ph4r Jan 27 at 9:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.