Currently I'm on PHP 5.3.6 and would like to upgrade to 5.4.x or 5.5.x

Trough this website: I've installed PHP 5.5 and when I log in my terminal (php -v) I get this:

PHP 5.5.6 (cli) (built: Nov 14 2013 12:34:38) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies with Xdebug v2.2.2, Copyright (c) 2002-2013, by Derick Rethans

Still, when I make a new index.php file and I check out "phpinfo();" function it's still PHP 5.3.6.

I've never upgraded before to another version of PHP, so I have no idea how to do it exactly.

Anyone that can explain, or provide me with a decent tutorial?

  • I'm guessing you're running OS X... what version?? – Journeyman Geek Nov 17 '13 at 22:54
  • I'm running OSX Mavericks. – Warre Buysse Nov 17 '13 at 22:55

I hate to say but RTFM. Very FIRST entry on the FAQ is...

Why does php -v on the command line still show my old version?

php-osx doesn't overwrite the php binaries installed by Apple, but installs everyting in /usr/local/php5. The new php binary is therefore in /usr/local/php5/bin/php.

You can also adjust your PATH do include that directory, eg. write into your ~/.profile file the following

export PATH=/usr/local/php5/bin:$PATH

Which sounds suspiciously like your issue. If you're running any scripts (other than on apache), you may end up needing to adjust them accordingly. You might want to use phpinfo to confirm that apache is using the new php rather than the old one for those.

Assuming you did all this correctly, and you want to make sure of this - you can run php -v with /usr/local/php/bin/php -v. You can also make the default location for php your new one for your account by opening up your profile file with textedit or nano - with say nano $home/.bash_profile, and adding the line export PATH=/usr/local/php5/bin:$PATH.

If this is for web development, you can create a text file with these contents to make sure apache picking up the 'right' version of php - I tend to save this at the root of my webserver directory as info.php




This is also useful when bashing extensions into working

  • I see that and I have NO idea what it means. I've found the new php binary in that map, but I have no clue what to write where. My apologies, but i'm just trying here. – Warre Buysse Nov 17 '13 at 23:21
  • Walked you through basic troubleshooting. The upshot is, you actually MIGHT HAVE installed it correctly, and its behaving as expected - and its happened to other people often enough its on top of the FAQs! – Journeyman Geek Nov 17 '13 at 23:50

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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