Reputation: 193
I compiled php 5.5.27 on Ubuntu 14.04 as part of an Nginx 1.8.0 with PHP-FPM deployment and can not figure out why it doesn't work.
I have the following php.ini files on the system. I am not using Apache so the 3rd is out... so that leaves the 1st two:
/srv/etc/web_x/php/php.ini
/etc/php5/cli/php.ini
/etc/php5/apache2/php.ini
When I start nginx I see from my phpinfo.php (secured) page that I am pointing to my compiled php.ini i.e.:
Loaded Configuration File /srv/etc/web_x/php/php.ini
However there is no Zend OPcache information so it isn't running.
The only mention of opcache is in the configure options for --enable-opcache. The full configure options as per phpinfo are (I use a script with variables so much easier to present it this way than with variables):
'./configure' '--prefix=/srv/apps/web_x/php' '--with-config-file-path=/srv/etc/web_x/php' '--with-config-file-scan-dir=/srv/etc/web_x/php/conf.d' '--with-curl' '--with-pear' '--with-gd' '--with-jpeg-dir' '--with-png-dir' '--with-zlib' '--with-freetype-dir' '--with-t1lib' '--with-mcrypt' '--with-mhash' '--with-mysql' '--with-mysqli' '--with-pgsql' '--with-pdo-mysql' '--with-pdo-pgsql' '--with-openssl' '--with-xmlrpc' '--with-xpm-dir' '--with-xsl' '--with-bz2' '--with-gettext' '--with-readline' '--with-fpm-user=wwx' '--with-fpm-group=wwx' '--with-imap' '--with-imap-ssl' '--with-kerberos' '--with-snmp' '--disable-debug' '--enable-opcache' '--enable-fpm' '--enable-cli' '--enable-gd-native-ttf' '--enable-inline-optimization' '--enable-json' '--enable-exif' '--enable-wddx' '--enable-zip' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-mbstring' '--enable-soap' '--enable-sockets' '--enable-shmop' '--enable-dba' '--enable-shared' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg'
The strange thing is if I look at the settings I see which shows that I have enabled Zend OPcache for my compile install but it isn't enabled for the Ubuntu provided PHP CLI install:
/srv/etc/web_x/php/php.ini:[opcache]
/srv/etc/web_x/php/php.ini:opcache.enable=1
/srv/etc/web_x/php/php.ini:opcache.enable_cli=1
...
/etc/php5/cli/php.ini:[opcache]
/etc/php5/cli/php.ini:;opcache.enable=0
/etc/php5/cli/php.ini:;opcache.enable_cli=0
...
Yet if I check the Ubuntu PHP CLI I see:
php --version
PHP 5.5.9-1ubuntu4.11 (cli) (built: Jul 2 2015 15:23:08)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
Upvotes: 1
Views: 640
Reputation: 193
Solution just found... add the following to the end of the php.ini file:
zend_extension=opcache.so
It is discussed in PHP install guide on php.net but I recall having read that this wasn't required anymore though clearly it is (perhaps I recalled incorrectly b/c once upon a time the path to the shared library was required and it clearly isn't).
I would have expected that the PHP 5.5 compile with --enable-opcache could have handled this but that is not the case. Perhaps for a future PHP version ;-)
Upvotes: 2