使用php-5.4。我试图加载oci8.so来访问函数oci_connect
。当在命令行,我可以访问上述功能罚款。但是(在重新加载、重新启动和重新加载之后)php-fpm拒绝加载扩展。
php-r'print_r(get_loaded_extensions());
列出ococ8
。
Array
(
[0] => Core
[1] => date
[2] => ereg
[3] => libxml
[4] => openssl
[5] => pcre
[6] => zlib
[7] => bz2
[8] => calendar
[9] => ctype
[10] => hash
[11] => filter
[12] => ftp
[13] => gettext
[14] => gmp
[15] => SPL
[16] => iconv
[17] => pcntl
[18] => readline
[19] => Reflection
[20] => session
[21] => standard
[22] => shmop
[23] => SimpleXML
[24] => sockets
[25] => exif
[26] => tokenizer
[27] => xml
[28] => curl
[29] => fileinfo
[30] => json
[31] => oci8
[32] => Phar
[33] => zip
[34] => mhash
)
但是curllocalhost/extensions.php
读取
Array
(
[0] => Core
[1] => date
[2] => ereg
[3] => libxml
[4] => openssl
[5] => pcre
[6] => zlib
[7] => bz2
[8] => calendar
[9] => ctype
[10] => hash
[11] => filter
[12] => ftp
[13] => gettext
[14] => gmp
[15] => SPL
[16] => iconv
[17] => Reflection
[18] => session
[19] => standard
[20] => shmop
[21] => SimpleXML
[22] => sockets
[23] => exif
[24] => tokenizer
[25] => xml
[26] => cgi-fcgi
[27] => curl
[28] => fileinfo
[29] => json
[30] => Phar
[31] => zip
[32] => mhash
// missing oci8
// and also missing 'pcntl'??
)
fpm和cli读取的是完全相同的php。ini
。我已经检查过了。
任何错误日志中都没有任何内容。
根据您如何安装PHP FPM,但是,在Debian CLI和FPM使用不同的ini文件尝试:
php -i | grep php.ini
Mines是/etc/php/7.0/cli/php。伊尼
和
<?php phpinfo(); ?>
我的是/etc/php/7.0/fpm/php。伊尼
希望这有帮助。
我不确定它是否相关,但这发生在我的“AmazonLinux2AMI”上,所以我想也可以应用到“CentOS”上。
长话短说,我安装了作曲家和其他PHP的东西。
[zzzz@stageOpenID /etc/httpd/sites-enabled]$ php -i
phpinfo()
PHP Version => 7.2.30
System => Linux stageOpenID 4.14.177-139.254.amzn2.x86_64 #1 SMP Thu May 7 18:48:23 UTC 2020 x86_64
Build Date => May 5 2020 18:04:39
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini
Scan this dir for additional .ini files => /etc/php.d
Additional .ini files parsed =>
到现在为止,一直都还不错。
现在来看看网络。
来自phpinfo。php:
PHP Version: 7.2.30
System: Linux stageOpenID 4.14.177-139.254.amzn2.x86_64 #1 SMP Thu May 7 18:48:23 UTC 2020 x86_64
Build Date: May 5 2020 18:06:20
Server API: FPM/FastCGI
Virtual Directory Support: disabled
Configuration File (php.ini) Path: /etc
Loaded Configuration File: /etc/php.ini
Scan this dir for additional .ini files /etc/php.d
Additional .ini files parsed
但名单是不同的。
为什么?这仅仅是因为在安装了yum之后,我重新启动了httpd,但忘记了重新启动php-fpm,因此php-cli获得了新模块,而php-fpm没有。
因此,别忘了:
sudo systemctl restart php-fpm