gpt4 book ai didi

php-fpm 不加载相同的扩展 php-cli 是

转载 作者:行者123 更新时间:2023-12-04 19:30:44 24 4
gpt4 key购买 nike

使用 php-5.4。我正在尝试加载 'oci8.so' 以访问函数 oci_connect .在命令行中,我可以正常访问所述功能。但是(在重新加载、重新启动和重新加载之后)php-fpm 拒绝加载扩展。
php -r 'print_r(get_loaded_extensions());列表 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
)

然而 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'??
)

fpm 和 cli 读取完全相同的 php.ini .我已经检查并测试过。

任何错误日志中都没有任何内容。

最佳答案

好吧,不确定它是否相关,但这发生在“Amazon Linux 2 AMI”上,所以我想也适用于“CentOS”。

长话短说,我安装了 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 =>

到目前为止,一切都很好。

现在到网络。

来自 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

关于php-fpm 不加载相同的扩展 php-cli 是,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56031380/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com