简体   繁体   中英

how to add php5.6 mbstring extension in centos 6.8

My terminal shows php version as

[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

and when I check for mbstring extension for php with php -m command I get

but when i check with yum list installed php* i get this

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

when I check with phpinfo() I get result as

1) i get related result in Additional ini file parsed section as

I try with new installation of php56w-mbstring also then also same problem.

Diagnostic

1/ find which php command is used:

which php

2/ find which package provides this command

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

If this fails, this probably means you are using a manually installed PHP version, built from sources, usually in /usr/local.

Installation

As, in your case php is provided by rh-php56-php-cli , you need to install needed extensions, from the same repository (centos-sclo) and in the same namespace (rh-php56):

yum install rh-php56-php-mbstring
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.

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