I have used below commands to upgrade php in my mac machine.
brew tap homebrew/homebrew-php
brew unlink php71
brew install php72 --with-argon2
brew install php72-xdebug
PHP 7.2 has been successfully installed. I have checked with the command php -v
and getting the version PHP 7.1 in my terminal. Please help.
3
Answers
brew unlink php71 and brew link php72 will tweak your php command line to the right path and version, but Apache will not be affected until you change its config file.
First, locate your httpd.conf file path:
You may also check:
Then:
Open your
httpd.conf
file and locate the line starting with LoadModulephp Comment this line with #, and add your 7.2 line instead.
You can get your line from querying the following command in the Terminal:
so Finally, restart Apache:
be runing with php7.2 version There’s also detailed instructions about
using a php switcher here. Once installed, you can switch from one
version to another like this (it will link both Apache and the command
line automatically):
sphp 7.1
sphp 7.2
sphp 5.6
etc..
As per your comments, php7.2 successfully installed and only issue with your /usr/bin/php symlink. Please do the following steps.
append the below line
save and exit
.bash_profile
then runNow you can run php7.2 in your terminal.
You can use curl to update php version.
Last Step: