How to force installation of PHP 8.1 using Homebrew?
P粉744831602
P粉744831602 2023-11-09 00:02:27
0
1
600

I installed MAMP on my mac, using the php version 7.4.

command which php

Return - /Applications/MAMP/bin/php/php7.4.21/bin/php

I have installed php 8.1 using brew. I commented ~/.bash_profile

# export PATH=/Applications/MAMP/bin/php/php7.4.21/bin:$PATH
# alias mysql=/Applications/MAMP/Library/bin/mysql
# export PATH="/usr/local/opt/node@13/bin:$PATH"

But it still shows the same php path. How to switch to newly installed php version?

P粉744831602
P粉744831602

reply all(1)
P粉020556231

You must link the PHP version you want to use.

brew unlink php will unlink the current version of PHP.
brew link php@8.1 Will link to PHP 8.1 (you need to install it first)

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!