【发布时间】:2020-11-18 21:28:21
【问题描述】:
展示我的案例如何调试问题,即 PHP 模块未加载到 PHP 中。
我使用 OpenSUSE v42.2 Linux 操作系统,带有 Apache 网络服务器、PHP v7.1、Mysql。
因为它没有提供我需要的 PHP v7.1,所以我从源代码构建了 PHP v7.1。 使用 PHP-FPM。
我把它安装到了
/opt/php-7.1/
php.ini 位于:
/opt/php-7.1/lib/php.ini
我发现,那个 opcache 被安装到
/opt/php-7.1/lib64/extensions/no-debug-non-zts-20160303/opcache.so
我编辑了 php.ini 并添加了以下行:
zend_extension=/opt/php-7.1/lib64/extensions/no-debug-non-zts-20160303/opcache.so
重启:
systemctl restart php-7.1-fpm.service
systemctl restart apache2.service
但我仍然得到以下结果:
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]
[Zend Modules] 中缺少 opcache。
但在配置中有'--enable-opcache':
php -i | grep -i opcache
配置命令 => './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'
我也尝试指定为:
zend_extension=opcache
但我得到了相同的结果,opcache 仍然丢失。
如何修复启用 opcache?
【问题讨论】:
标签: php linux opensuse fpm opcache