I want to update php version, currently I have 5.5.38 and I want 7.1
What I tried so far is using this command:
curl -s https://php-osx.liip.ch/insta
I would probably recommend installing homebrew to manage such installations for you. With that installed you can just run the following command to install php7.1
brew update
brew install php@71
Try to use below command
brew update
brew upgrade php
or
brew reinstall php
try to use the command, its working fine with me
curl -s https://php-osx.liip.ch/install.sh | bash -s 7.3
In case you guys run all install commands above but when checking the PHP version, it is still linking to the old version. So you guys may want to update the PATH
.
In my case, I open the .bash_profile
which located in HOME
directory by command:
nano ~/.bash_profile
Then, I add the path to the new version of PHP:
PATH=/usr/local/Cellar/php/7.4.4/bin:<other_paths>
Finally, run source ~/.bash_profile
command to refresh the terminal window and checking the PHP version again.
Hope this helps.
You can brew upgrade php7
or brew uninstall
old php version.
Last, I recommend you brew install php-version
, php-version can help you change your php version
Install php
brew install php@7.2
Install the required PHP to your PATH
echo 'export PATH="/usr/local/opt/php@7.2/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/php@7.2/sbin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
Then make sure it's all working
php -v
php --version
This command will show you where your ini file is loaded
php --ini