在MacOS Monterey上使用PHP-更新OS后,在重新安装上许多自制错误

发布于 2025-01-28 08:18:42 字数 2111 浏览 3 评论 0原文

我做出了一个糟糕的决定,将MacOS更新到Macos Monterey 12.3.1,并且有一段时间试图让PHP再次工作。据我所知,苹果已经决定将PHP弃用 - 至少从他们的机器上删除了,他们删除了我为我所有的Laravel和WordPress项目设置的所有PHP版本以及设置!

我尝试使用Homebrew重新安装PHP,但是对于由于授权拒绝而无法下载某些软件包,我遇到了很多错误?

因此,我试图卸载并重新安装Homebrew,然后进行以下操作:

安装Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

将以下内容添加到ZSHRC

eval "$(/opt/homebrew/bin/brew shellenv)"

测试酿造版本以查看它是否有效

brew --version

运行Brew Doctor,以确保一切都正确配置

brew doctor

我还看到可能会缺少库,我应该重新安装Open SSL,所以我也这样做:

brew install openssl

然后,对于PHP I RAN:

brew tap shivammathur/php

然后

brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]

,我甚至重新启动了PHP服务,以防万一

brew services restart shivammathur/php/[email protected] 
brew services restart shivammathur/php/[email protected] 

,然后我跑

php -v

了以下错误:

zsh: command not found: php

哪个php say php找不到

whe heck!

然后,我尝试取消链接php并强制指向7.4的链接:

brew unlink php && brew link --overwrite --force [email protected]

我得到了以下啤酒错误:

Error: No such keg: /usr/local/Cellar/php

我尝试挖掘解决这个小桶问题,但我无法弄清楚,您对下一步有任何建议

I made the seemingly bad decision to update to macOS Monterey 12.3.1, and am having a hell of a time trying to get PHP working on it again. From what I've seen, Apple has decided that PHP is deprecated - at least from their machines, and they removed every php version and setting that I had set up for all my Laravel and Wordpress projects!

I tried reinstalling PHP using homebrew but I got a lot of errors about certain packages not being able to be downloaded due to authorization denial?

So then I attempted to uninstall and reinstall Homebrew, and I did the following:

Install Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Add the following to zshrc

eval "$(/opt/homebrew/bin/brew shellenv)"

Test brew version to see if it's working

brew --version

Run brew doctor to make sure everything is configured correctly

brew doctor

I also saw that it was likely that there would be libraries missing and that i should reinstall open ssl so i did that as well:

brew install openssl

Then for PHP I ran:

brew tap shivammathur/php

and then

brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]

and I even restarted the php services just in case

brew services restart shivammathur/php/[email protected] 
brew services restart shivammathur/php/[email protected] 

Then I ran

php -v

and I got the following error:

zsh: command not found: php

and which php says php not found

what the heck!

I then tried to unlink php and force a link to 7.4:

brew unlink php && brew link --overwrite --force [email protected]

and I got the following brew error:

Error: No such keg: /usr/local/Cellar/php

I tried digging into fixing this keg issue but i haven't been able to figure it out, do you have any suggestions on next steps

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

顾铮苏瑾 2025-02-04 08:18:42

检查Homebrew的bin目录IE $(brew -prefix)/bin在您的路径中。

如果要链接php 7.4,请运行,

brew link --overwrite --force [email protected]

如果您遇到了已经链接的错误,则可以通过首先链接并再次链接以确保将其重新链接。确保取消链接正确的版本。

brew unlink [email protected]
brew link --overwrite --force [email protected]

Check that Homebrew's bin directory i.e. $(brew --prefix)/bin is in your PATH.

If you want to link PHP 7.4, run

brew link --overwrite --force [email protected]

If you get an error mentioning that it is already linked, you can relink it by unlinking it first and linking it again to be sure. Make sure you unlink the correct version.

brew unlink [email protected]
brew link --overwrite --force [email protected]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文