[英]php-fpm not loading same extensions php-cli is
Using php-5.4.使用 php-5.4。 I'm trying to load 'oci8.so' to access the function oci_connect
.我正在尝试加载 'oci8.so' 以访问函数oci_connect
。 When in command line, I can access said function fine.在命令行中时,我可以正常访问所述功能。 But (after reloading, restarting, and reloading) php-fpm REFUSES to load the extension.但是(在重新加载、重新启动和重新加载之后)php-fpm 拒绝加载扩展。
php -r 'print_r(get_loaded_extensions());
lists oci8
.列出oci8
。
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
)
However curl localhost/extensions.php
reads但是curl localhost/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'??
)
Both the fpm and cli are reading the exact same php.ini
. fpm 和 cli 都读取完全相同的php.ini
。 I have check and tested.我已经检查并测试过。
Nothing at all in any error logs.任何错误日志中都没有。
Well not sure it is related but this happened to me on "Amazon Linux 2 AMI" so I guess could apply to "CentOS" too.好吧不确定它是否相关,但这发生在我身上的“Amazon Linux 2 AMI”上,所以我想也适用于“CentOS”。
Long story short I installed composer and other php stuff.长话短说,我安装了 composer 和其他 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 =>
So far so good.到现在为止还挺好。
And now to the web.现在到网络。
From phpinfo.php:来自 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
But the lists are different.但名单不同。
Why?为什么? Simply because after the yum installation I restarted httpd but I forgot to restart php-fpm, so php-cli got the new modules and php-fpm didn't.仅仅因为在安装 yum 之后我重新启动了 httpd 但我忘记重新启动 php-fpm,所以 php-cli 获得了新模块而 php-fpm 没有。
So, don't forget to:所以,不要忘记:
sudo systemctl restart php-fpm
Depending how you have installed PHP FPM but, On Debian CLI and FPM use different ini files try:根据您安装 PHP FPM 的方式,在 Debian CLI 和 FPM 上使用不同的 ini 文件尝试:
php -i | grep php.ini
Mines is /etc/php/7.0/cli/php.ini矿山是/etc/php/7.0/cli/php.ini
and和
<?php phpinfo(); ?>
Mine is /etc/php/7.0/fpm/php.ini我的是/etc/php/7.0/fpm/php.ini
Hope this helps.希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.