解决Error: php@7.4 has been disabled because it is a versioned formula

  • 发表于
  • macOS , PHP

问题

brew安装php7.4报错

Error: php@7.4 has been disabled because it is a versioned formula!

解决方法

brew install shivammathur/php/php@7.4

更新 PATH in .zshrc:

echo 'export PATH="/opt/homebrew/opt/php@7.4/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/opt/homebrew/opt/php@7.4/sbin:$PATH"' >> ~/.zshrc
source ~/.zshrc

检查版本

$ php -v
PHP 7.4.33 (cli) (built: Jan 21 2023 06:43:54) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies