macOS安装php@7.4,解决Error: php@7.4 has been disabled because it is a versioned formula!

发布时间:2023-04-16 18:56:57,浏览4895次

问题

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: Apr 16 2023 11:08:44) ( 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
评论