Mac update native php with homebrew, not getting it to work

I tried updating my mba's own php from 5.3.X to 5.4.X I did this: brew click homebrew / dupes brew tap josegonzalez / homebrew-php brew update brew install php54

This installs php 5.4 to / usr / local / cellar / php 54 now when I do php it gives me / usr / bin / php

I tried adding this to ~ / .bashrc: export PATH = / usr / local / cellar / php54: $ PATH

Now when I open the terminal again and type php, it still tells me that php is in / usr / bin / php

Is there a good way to fix this problem?

+6
source share
2 answers

From https://github.com/josegonzalez/homebrew-php

If you want to exchange the PHP that you use on the command line, you must update the $ PATH variable in your .bashrc or .bash_profile:

# Swapping from PHP53 to PHP54 # export PATH="$(brew --prefix josegonzalez/php/php53)/bin:$PATH" export PATH="$(brew --prefix josegonzalez/php/php54)/bin:$PATH" 

Keep in mind that you must make this type of change. EVERY time when you swap between minor PHP versions. Usually you need to upgrade Apache / FPM when updating the php patch version.

+7
source

Usually the path is not exported properly, so not only php, but many other brew installations may not work, try the following:

 echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile 
+2
source

Source: https://habr.com/ru/post/953836/


All Articles