使用Homebrew Macos Monterey,与CLI版本不同的PHP版本
我已经安装了带有Homebrew的php,切换到PHP 8.0,但浏览器phpinfo()显示7.4。我是最新版本的蒙特雷。
啤酒服务停止httpd
正在停止Apache服务。
% php -v
PHP 8.0.19 (cli) (built: May 12 2022 02:25:19) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.19, Copyright (c) Zend Technologies
with Zend OPcache v8.0.19, Copyright (c), by Zend Technologies
% which php
/opt/homebrew/bin/php
我将如何在浏览器中获得PHP 8.0的工作?
I have installed PHP with homebrew, switch to PHP 8.0 but the browser phpinfo() is showing 7.4. I am on the latest version of Monterey.
brew services stop httpd
is stopping the apache service.
% php -v
PHP 8.0.19 (cli) (built: May 12 2022 02:25:19) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.19, Copyright (c) Zend Technologies
with Zend OPcache v8.0.19, Copyright (c), by Zend Technologies
% which php
/opt/homebrew/bin/php
How would I get PHP 8.0 to work in the browser?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您的HTTPD配置中,您必须使用Apache的发货PHP版本(7.4),看起来像这样:
只需更改HTTPD配置即可加载适当的LIB,然后重新启动您的HTTPD服务器。此外,PHP具有多个配置(CLI,FPM):确保您在configs中量身定制适当的配置,通常在/usr/local/etc/php/8.n.n.n.n.n.n(Monterey,Brewed-in PHP)中找到
in your httpd config, you must hardwire the shipped php version (7.4), with apache, would look like this :
Just change the httpd config to load the appropriate lib, and restart your httpd server. Also, php has multiple configs (cli, fpm) : make certain that you tailor the appropriate one in your configs , typically found in /usr/local/etc/php/8.N (monterey, brewed-in php)