简体   繁体   English

无法使用 PHP 7 在 MacOS Sierra 上启用 OPcache

[英]Cannot enable OPcache on MacOS Sierra with PHP 7

I am finding it tricky to enable OPcache on my MacOS Sierra (10.12.6) system.我发现在我的 MacOS Sierra (10.12.6) 系统上启用 OPcache 很棘手。

php --ini shows the ini file used: php --ini显示使用的ini文件:

Configuration File (php.ini) Path: /usr/local/etc/php/7.0
Loaded Configuration File:         /usr/local/etc/php/7.0/php.ini
Scan for additional .ini files in: /usr/local/etc/php/7.0/conf.d
Additional .ini files parsed:      /usr/local/etc/php/7.0/conf.d/ext-pdo_pgsql.ini

My php.ini looks like this:我的php.ini看起来像这样:

[opcache]
; Determines if Zend OPCache is enabled
opcache.enable=1

However, when I look at phpinfo() it shows the following:但是,当我查看phpinfo()它显示以下内容: 在此处输入图片说明 在此处输入图片说明

I've restarted Apache after making the change to my php.ini to include opcache, but it doesn't appear to be recognised.在更改我的php.ini以包含 opcache 后,我重新启动了 Apache,但它似乎没有被识别。

I installed PHP with Homebrew, not MAMP although I do have MAMP install but unused.我用 Homebrew 安装了 PHP,而不是 MAMP,虽然我安装了 MAMP 但未使用。

I got to the bottom of this eventually...我终于明白了这一点......

In the output from phpinfo() , have a look at the .ini files listed under:phpinfo()的输出中,查看以下列出的 .ini 文件:

Additional .ini files parsed

There may be something like可能有类似的东西

/usr/local/php5/php.d/20-extension-opcache.ini /usr/local/php5/php.d/20-extension-opcache.ini

Make sure opcache.enable=1 is set in this file.确保在此文件中设置了opcache.enable=1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM