Php – Why a PHP module is not loaded into PHP

opcacheopensusePHPphp-fpmphp7

Showing my case how to debug the problem, that a PHP module is not loaded into PHP.

I use OpenSUSE v42.2 Linux OS, with Apache webserver, PHP v7.1, Mysql.

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 from [Zend Modules].

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'

I also tried to specify as:

zend_extension=opcache

but I got the same result, opcache still missing.

How to fix to have opcache enabled?

Best Answer

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

zend_extension=opcache