如何在Centos 7上使用php-fpm在php 5.6中添加bcmath扩展

时间:2018-04-24 08:16:55

标签: php nginx centos7 bcmath

我正在尝试在我的Centos 7上添加bcmath扩展,其中安装了PHP 5.6以及nginx和php-fpm

我跑了

yum install php56-bcmath

上面安装了bcmath扩展,我可以在phpinfo()输出的'module'列下看到。

但是当我调用php函数 get_loaded_extensions 时,我在加载的扩展名列表中看不到bcmath。

我在安装bcmath包后重新启动了php-fpm和nginx。

我错过了什么吗?

get_loaded_extensions()的输出

    Array
(
    [0] => Core
    [1] => date
    [2] => ereg
    [3] => libxml
    [4] => openssl
    [5] => pcre
    [6] => zlib
    [7] => filter
    [8] => hash
    [9] => Reflection
    [10] => SPL
    [11] => session
    [12] => standard
    [13] => cgi-fcgi
    [14] => bz2
    [15] => calendar
    [16] => ctype
    [17] => curl
    [18] => dom
    [19] => mbstring
    [20] => fileinfo
    [21] => ftp
    [22] => gd
    [23] => gettext
    [24] => iconv
    [25] => exif
    [26] => mcrypt
    [27] => mysqlnd
    [28] => PDO
    [29] => Phar
    [30] => posix
    [31] => shmop
    [32] => SimpleXML
    [33] => sockets
    [34] => sqlite3
    [35] => sysvmsg
    [36] => sysvsem
    [37] => sysvshm
    [38] => tokenizer
    [39] => xml
    [40] => xmlwriter
    [41] => xsl
    [42] => mysql
    [43] => mysqli
    [44] => pdo_mysql
    [45] => pdo_sqlite
    [46] => wddx
    [47] => xmlreader
    [48] => json
    [49] => zip
    [50] => mhash
)

2 个答案:

答案 0 :(得分:1)

我发现了什么是探测器。

我有多个PHP安装

还安装了php56版本,php-fpm正在使用它。所以我使用下面的命令安装了bcmath库,然后将其应用于正确的PHP安装。

yum install php56-php-bcmath

重新启动php-fpm并解决了问题。

答案 1 :(得分:0)

[重复] stackoverflow

中的一些解决方案