I use standard Apache and PHP 7.1 (not Homebrew) that comes with Mac High Sierra. Nevertheless, this version does not seem to support Opcache, although it should be standard with PHP 7. It is even listed in phpinfo()
the section "Module Authors", but none of them shows its actual installation. The call opcache_get_status
gives a fatal error.
I installed the extension through Homebrew and linked the file opcache.so
. It seems to be working on the CLI, but not on Apache. For some reason, the CLI and web use different ini files:
/usr/local/etc/php/7.1/php.ini
for CLI/etc/php.ini
for the internet
The CLI parses addition files, including /usr/local/etc/php/7.1/conf.d/ext-opcache.ini
, and php -i
displays Opcache. But phpinfo()
there is no browser - no additional ini files are processed.
I currently have this in /etc/php.ini
:
[opcache]
zend_extension="/usr/local/opt/php71-opcache/opcache.so"
opcache.enable=1
But still nothing. I followed the same process for xdebug and it worked fine. What am I missing?
I wonder if it will be easier to use the PHP version for homebrew. But I do not have the required file .so
. Various tutorials say you need to put this in Apache httpd.conf
:
LoadModule php7_module /usr/local/opt/php71/libexec/apache2/libphp7.so
But the directory libexec
does not exist. Exists lib
, but neither directory has a file .so
.
source
share