How to Update PHP Version on MAC

Method 1: Mac Brew PHP Update

Step 1: Update Brew

$ brew update

Step 2: Check the latest version from here and type below command with your latest version

$ brew install php@8.0

Step 3: Add PHP to your path

$ echo 'export PATH="/usr/local/opt/php@8.0/bin:$PATH"' >> ~/.bash_profile
$ echo 'export PATH="/usr/local/opt/php@8.0/sbin:$PATH"' >> ~/.bash_profile
$ source ~/.bash_profile

Step 4: Check PHP by typing either of below command

$ php -v
$ php --version
Tue, 02/16/2021 - 21:53
Tarun Goswami is a highly experienced professional, currently serving as Technical Lead at a well-established IT services company. With over 12 years of experience across multiple domains, he demonstrates his expertise and passion for the industry through his engaging and informative blog writing in his spare time.
Tags

Comments