如何在centos 6.8中添加php5.6 mbstring扩展

时间:2017-04-04 08:58:17

标签: php apache

我的终端显示php版本为

[root@localhost modules]# php -v
PHP 5.6.25 (cli) (built: Oct 21 2016 17:57:17) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

当我用php -m命令检查php的mbstring扩展名时,我得到了

但是当我检查yum list安装php *我得到这个

php-mbstring.x86_64 5.6.30-1.el6.remi @remi-php56

当我用phpinfo()检查时,我得到结果为

1)我将附加的ini文件解析部分中的相关结果作为

我尝试使用新安装的php56w-mbstring也是同样的问题。

2 个答案:

答案 0 :(得分:2)

<强>诊断

1 /找到使用了哪个 php命令

which php

2 /找到哪个提供此命令

rpm --query --file $(which php)

如果失败,这可能意味着您使用的是手动安装的PHP版本,它是从源代码构建的,通常位于/ usr / local。

<强>安装

因为,在你的情况下,php是由 rh-php56-php-cli 提供的,你需要从同一个存储库(centos-sclo)和中安装所需的扩展。命名空间(rh-php56):

yum install rh-php56-php-mbstring

答案 1 :(得分:0)

Its small mistake here... 
In my setup there are two version for php 
1)php with apahce and
2)php cli 
[root@localhost modules]# which php
/opt/rh/rh-php56/root/usr/bin/php

[root@localhost modules]# find / -name php.ini
/opt/rh/rh-php56/register.content/etc/opt/rh/rh-php56/php.ini

/etc/opt/rh/rh-php56/php.ini
/etc/php.ini

here i select /etc/opt/rh/rh-php56/php.ini and after this check for mbstring in terminal by i fine mbstring.so file
as 

[root@localhost modules]# find / -name mbstring.so
/usr/lib64/php/modules/mbstring.so
/usr/lib64/php-zts/modules/mbstring.so

with gedit /etc/opt/rh/rh-php56/php.ini i added that extension and related path with it as
extension=/usr/lib64/php/modules/mbstring.so

after that check with 
php -m 
now i get mbstring with this command.