简体   繁体   中英

how to add bcmath extension in php 5.6 with php-fpm on Centos 7

I am trying to add bcmath extension on my Centos 7 which has PHP 5.6 installed along with nginx and php-fpm

I ran

yum install php56-bcmath

Above installed the bcmath extension which I can see under the 'module' column in phpinfo() output.

However when I call php function get_loaded_extensions , I don't see the bcmath in the loaded extension list.

I restarted php-fpm and nginx after installing bcmath package.

Am I missing anything?

output of 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
)

[重复的在一些解决方案计算器

I found what was the probem.

I had multiple installations of PHP

There was a php56 version installed too which was being used by the php-fpm. So I installed bcmath library using the command below and it then got applied to the correct PHP installation.

yum install php56-php-bcmath

restarted php-fpm and there was the problem solved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM