I am using PHP 5.6 on my centos-release-6-8.el6.centos.12.3.x86_64 server.
I got following error from one of my PHP function.
Fatal error: Call to undefined function mb_detect_encoding()
So, I tried to install mbstring extension. when I execute
sudo yum install php-mbstring
CLI returns
Package php-mbstring-5.6.25-1.el6.remi.x86_64 already installed and latest version
Nothing to do
And I aslo tried "sudo yum install php56-mbstring"
This returns
No package php56-mbstring available. Nothing to do
But still, PHP function giving me that error and there is no 'mbsting' in phpinfo()
I also add the following line to httpd.conf
LoadModule php5_module modules/libphp5.so
Server Restarted
Update:
[~]# php -v
PHP 5.6.22 (cli) (built: Jun 13 2016 11:43:51)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
[~]# php -m | grep mbstring
[~]# php -i | grep mbstring
Nothing returns to php -m | grep mbstring & php -i | grep mbstring
[~]# rpm -qil php-mbstring
Name : php-mbstring Relocations: (not relocatable)
Version : 5.6.25 Vendor: Remi Collet
Release : 1.el6.remi Build Date: Wed 31 Aug 2016 18:33:05 BST
Install Date: Mon 05 Sep 2016 16:26:05 BST Build Host: builder.remirepo.net
Group : Development/Languages Source RPM: php-5.6.25-1.el6.remi.src.rpm
Size : 2856446 License: PHP and LGPLv2 and BSD and OpenLDAP
Packager : http://blog.remirepo.net/
URL : http://www.php.net/
/etc/php-zts.d/20-mbstring.ini
/etc/php.d/20-mbstring.ini
/usr/lib64/php-zts/modules/mbstring.so
/usr/lib64/php/modules/mbstring.so
/usr/share/doc/php-mbstring-5.6.25
/usr/share/doc/php-mbstring-5.6.25/libmbfl_LICENSE
/usr/share/doc/php-mbstring-5.6.25/oniguruma_COPYING
/usr/share/doc/php-mbstring-5.6.25/ucgendat_LICENSE
[~]# rpm -qa 'php*'
php-pecl-zip-1.13.4-1.el6.remi.5.6.x86_64
php-pecl-jsonc-1.3.10-1.el6.remi.5.6.x86_64
php-mbstring-5.6.25-1.el6.remi.x86_64
php-common-5.6.25-1.el6.remi.x86_64
Best Answer
Installing PHP extensions/modules via RPM will install the library files into
/usr/lib64/php/modules/
. Runningphp -i |grep ^extension_dir
shows the extension directory that is currently configured.An extension directory of
/usr/local/lib/php/extensions/no-debug-non-zts-20131226
indicates that at some stage in the past, PHP was installed from source and that aphp.ini
file relating to this source installation is currently being used instead of the/etc/php.ini
provided by thephp-common
package.To solve this problem, you should remove the remnants of this source installation. Unfortunately, the Makefile provided with PHP source code doesn’t include an
uninstall
target so you can’t simply runmake uninstall
. I’d suggest using thefind
command to track down these files by their modification date.