[英]Update PHP to 7.4 macOS Catalina with brew
I try to update my PHP version to 7.4
on macOS Catalina with brew.我尝试使用 brew 在 macOS Catalina 上将我的 PHP 版本更新到
7.4
。
I did brew install php@7.4
我做了
brew install php@7.4
If I check my version php -v
, I still see the old version PHP 7.3.11
?如果我检查我的版本
php -v
,我仍然看到旧版本PHP 7.3.11
吗?
What do I have to do?我需要做什么?
Update:更新:
After brew doctor
I get:在
brew doctor
我得到:
Warning: Homebrew's sbin was not found in your PATH but you have installed formulae that put executables in /usr/local/sbin.
警告:在您的 PATH 中未找到 Homebrew 的 sbin,但您已经安装了将可执行文件放入 /usr/local/sbin 的公式。 Consider setting the PATH for example like so: echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.profile
考虑像这样设置 PATH:echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.profile
您可以在php@7.2 中找到我的类似答案。
brew install php@7.4
brew link --force --overwrite php@7.4
brew services start php@7.4
export PATH="/usr/local/opt/php@7.4/bin:$PATH"
export PATH="/usr/local/opt/php@7.4/sbin:$PATH"
try:尝试:
brew update
brew upgrade php
php -v
brew services start php
or或者
brew services restart php
if you use apache server:如果您使用 apache 服务器:
sudo apachectl restart
if you use ngnix如果你使用 ngnix
sudo nginx -s reload
Edit:编辑:
brew unlink php@7.3
brew link php@7.4
If anyone want to downgrade php from latest 8.1.2 to 7.4 on systems demand, try the below commands with homebrew: Installing PHP 7.4:如果有人想根据系统需求将 php 从最新的 8.1.2 降级到 7.4,请使用自制软件尝试以下命令:安装 PHP 7.4:
brew install php@7.4
brew services restart php
brew unlink php@8.1
brew link php@7.4
echo 'export PATH="/usr/local/opt/php@7.4/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/php@7.4/sbin:$PATH"' >> ~/.zshrc
Or要么
export PATH="/usr/local/opt/php@7.4/bin:$PATH"
export PATH="/usr/local/opt/php@7.4/sbin:$PATH"
I recently faced this issue, all the suggestion here didn't work until I ran:我最近遇到了这个问题,直到我跑了,这里的所有建议才奏效:
xcode-select --install
Then ran the command I was trying before and the error stopped, for my case it was php然后运行我之前尝试过的命令,错误停止了,就我而言,它是 php
dyld: Library not loaded: /usr/local/opt/openldap/lib/libldap-2.4.2.dylib Referenced from: /usr/local/opt/php@7.4/bin/php Reason: image not found zsh: abort php -v dyld:库未加载:/usr/local/opt/openldap/lib/libldap-2.4.2.dylib 引用自:/usr/local/opt/php@7.4/bin/php 原因:找不到图像 zsh:中止 php -v
Using terminal of MacOS.使用 MacOS 终端。 Don't use terminal in vscode.
不要在 vscode 中使用终端。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.