5

I have just updated my system php in terminal via command line.

I deleted the export path in .bash_profile as it was pointing to mamp but for some reason my php still says 5.3 not 5.4 when I run php -v in terminal.

Does anyone know why this would happen. I have also closed terminal and reopened to see the change.

  • How did you update php? – napcae Oct 28 '13 at 8:26
  • using this command curl -s php-osx.liip.ch/install.sh | bash -s 5.4 – M dunbavan Oct 28 '13 at 8:27
  • 1
    Can you source your .bash_profile manually? In order to do so do the following: source ~/.bash_profile. Run php -v after that(without closing your terminal). If it still doesn't work please provide your .bash_profile, .profile and a echo $PATH please. – napcae Oct 28 '13 at 8:33
  • yes I can source that and this is what I have: – M dunbavan Oct 28 '13 at 8:36
  • [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function$ – M dunbavan Oct 28 '13 at 8:38
4

It seems as you did not add the new path to your $PATH.

Citing the FAQ of the website that you have posted:

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

So open you .profile or .bash_profile in a editor like nano or vim and add the last line export PATH=/usr/local/php5/bin:$PATH to the appropiate file.

Source your file with source ~/.bash_profile or source ~/.profile or close and reopen your terminal.

  • The only issue now when I run homebrew brew doctor is I get this error: – M dunbavan Oct 28 '13 at 8:49
  • Having additional scripts in your path can confuse software installed via Homebrew if the config script overrides a system or Homebrew provided script of the same name. We found the following "config" scripts: /usr/local/php5/bin/curl-config /usr/local/php5/bin/freetype-config /usr/local/php5/bin/icu-config /usr/local/php5/bin/libmcrypt-config /usr/local/php5/bin/libpng-config /usr/local/php5/bin/libpng12-config /usr/local/php5/bin/php-config /usr/local/php5/bin/xml2-config /usr/local/php5/bin/xslt-config – M dunbavan Oct 28 '13 at 8:50
  • Since I can't find any other php package at braumeister.org I think you can safely ignore this as long you don't add any other taps related to php itself. I may be wrong on this and getting corrected(hopefully) if so. – napcae Oct 28 '13 at 8:55
  • The key for me was exiting and restarting terminal (had already updated .bash_profile and .profile). – Justin Feb 3 '14 at 21:46
  • I had no .bash_profile and .profile files in my home dir. So I created them by entering touch .profile as stated here. I put the PATH=/usr/local/php5/bin:$PATH in both the files and now php -v shows that the newer PHP version (which is 7.0.10). – Sufian Sep 13 '16 at 13:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .