8

在 Mac 上使用 Homebrew 升级PHP到 PHP 8.1

 2 years ago
source link: https://www.iplayio.cn/post/18964131
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

在 Mac 上使用 Homebrew 升级PHP到 PHP 8.1

发布:3个月前 更新:3个月前 folder_open 计算机编程语言 PHP编程 213 浏览 comment

原文地址:在 Mac 上使用 Homebrew 升级PHP到 PHP 8.1

本文分享如何在 Mac 上使用 Homebrew 升级PHP版本到 PHP 8.1

使用 Homebrew 升级

首先确保 brew 是最新的:

brew update

接下来,升级PHP。您可以使用内置的 php 配方,但我建议使用shivammathur/homebrew-php水龙头。

brew upgrade php

升级 shivammathur/homebrew-php

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

要在版本之间切换,请使用以下命令:

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

您可以在存储库中阅读更多内容。

通过运行检查当前版本php -v

php -v

重启 Nginx 或 Apache,如果你使用的是 Laravel Valet,你可以跳到下一节;您需要一些额外的步骤才能使 Web 服务器正常工作。

sudo nginx -s reload
sudo apachectl restart

并通过访问此脚本确保您的本地 Web 服务器也使用 PHP 8.1:

# index.php, accessible to your web server

phpinfo();

Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK