24 Jul 2019 . Php . 398 views
If you are using MacBook and you want to update your current PHP version, it might be troublesome for you in some cases. There are many ways to update php version in mac, however, today I will show you how to update PHP version globally.
Currently, I am using PHP 7.1 version on my machine. If you are using 5x, don't worry, it gonna be working for you too.
I am using brew to install PHP. Run the following command in your terminal-
brew install [email protected]
Once you have installed PHP successfully, now you need to set the required PHP to your PATH. Run the following commands.
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile echo 'export PATH="/usr/local/opt/[email protected]/sbin:$PATH"' >> ~/.bash_profile source ~/.bash_profile
It there is no issues, now is the time to check PHP version. To check the PHP version, run any of the following commands.
php -v php --version
Hopefully, you will get your desired PHP version.