Opcache module not loaded into PHP v7.1

klor asked:

Using OpenSUSE v42.2 Linux OS.

Because it does not provide PHP v7.1 I need, I built PHP v7.1 from source.
Using PHP-FPM.

I installed it into

/opt/php-7.1/

php.ini is in:

/opt/php-7.1/lib/php.ini

I find, that opcache is installed to

/opt/php-7.1/lib64/extensions/no-debug-non-zts-20160303/opcache.so

I edited php.ini and added the following line:

zend_extension=/opt/php-7.1/lib64/extensions/no-debug-non-zts-20160303/opcache.so

Restarted:

systemctl restart php-7.1-fpm.service
systemctl restart apache2.service

But still I get the following result:

php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
imap
intl
json
libxml
mbstring
mcrypt
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
pgsql
Phar
posix
Reflection
session
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
xsl
zip
zlib

[Zend Modules]

The opcache is missing.

But in configure there is ‘–enable-opcache’:
php -i | grep -i opcache
Configure Command => ‘./configure’ ‘–prefix=/opt/php-7.1’ ‘–with-pdo-pgsql’ ‘–with-zlib-dir’ ‘–with-freetype-dir’ ‘–enable-mbstring’ ‘–with-libxml-dir=/usr’ ‘–enable-soap’ ‘–enable-intl’ ‘–enable-calendar’ ‘–with-curl’ ‘–with-mcrypt’ ‘–with-gd’ ‘–with-pgsql’ ‘–disable-rpath’ ‘–enable-inline-optimization’ ‘–with-bz2’ ‘–with-zlib’ ‘–enable-sockets’ ‘–enable-sysvsem’ ‘–enable-sysvshm’ ‘–enable-pcntl’ ‘–enable-mbregex’ ‘–enable-exif’ ‘–enable-bcmath’ ‘–with-mhash’ ‘–enable-zip’ ‘–with-pcre-regex’ ‘–with-pdo-mysql’ ‘–with-mysqli’ ‘–with-mysql-sock=/var/run/mysql/mysql.sock’ ‘–with-xpm-dir=/usr’ ‘–with-webp-dir=/usr’ ‘–with-jpeg-dir=/usr’ ‘–with-png-dir=/usr’ ‘–enable-gd-native-ttf’ ‘–with-openssl’ ‘–with-fpm-user=wwwrun’ ‘–with-fpm-group=www’ ‘–with-libdir=lib64’ ‘–enable-ftp’ ‘–with-imap’ ‘–with-imap-ssl’ ‘–with-kerberos’ ‘–with-gettext’ ‘–with-xmlrpc’ ‘–with-xsl’ ‘–enable-opcache’ ‘–enable-fpm’

How to fix to have opcache enabled?

Thanks!

My answer:


You should be specifying the module name, e.g.:

zend_extension=opcache

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.