1

I have macOS 10.14.6 Mojave. It had installed php 7.1.33 initially. I would like to upgrade php 7.3 using brew install. I executed brew instal php@7.3 and it was succeed.

However the original php7.1.33 is sticked in /usr/bin/php. I tried remove or rename the php with sudo mv php php_org. But it does not work. Operation not permitted.

What is wrong?

Please tell me some advice.

tajihiro
  • 2,293
  • 7
  • 39
  • 60
  • use brew unlink and link. Read here and follow the links. https://stackoverflow.com/questions/34909101/how-can-i-easily-switch-between-php-versions-on-mac-osx/41820870 – YvesLeBorg Mar 31 '20 at 09:51
  • I thought `brew unlink` works for other version with brew. mine is installed php. What do you think? – tajihiro Mar 31 '20 at 09:55

2 Answers2

1

Finally I put next script in .bash_profile.

export PATH="/usr/local/Cellar/php@7.3/7.3.16/bin:$PATH"

It worked.

tajihiro
  • 2,293
  • 7
  • 39
  • 60
0

in your .bash_profile add:

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

open a new terminal window and verify the path setting

php -v

Also, if you use apache, update /usr/local/etc/http/httpd.conf , update to

LoadModule php7_module /usr/local/opt/php@7.3/lib/httpd/modules/libphp7.so

then

sudo apachectl -k restart
YvesLeBorg
  • 9,070
  • 8
  • 35
  • 48