0

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
11
  • It would be useful to edit the question to include the output of php -v , php -m | grep mbstring and php -i | grep mbstring. Commented Sep 6, 2016 at 10:01
  • @AnthonyGeoghegan : Updated with the results
    – Sadee
    Commented Sep 6, 2016 at 10:04
  • Interesting. Did you configure a third-party repo to install PHP 5.6? I would also add the output of rpm -qa 'php*' to the question. It might also be worth checking the output rpm -qil php-mbstring for anything unusual. Commented Sep 6, 2016 at 10:15
  • @AnthonyGeoghegan : I have updated the result. there are mbsting.so in /usr/lib64/php-zts/modules/mbstring.so /usr/lib64/php/modules/mbstring.so But my extenstions path is: /usr/local/lib/php/extensions/no-debug-non-zts-20131226 And also: I have upgraded PHP 5.3 to 5.6
    – Sadee
    Commented Sep 6, 2016 at 10:21
  • Output of rpm -qa 'php*'? Commented Sep 6, 2016 at 10:23

1 Answer 1

2

Installing PHP extensions/modules via RPM will install the library files into /usr/lib64/php/modules/. Running php -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 a php.ini file relating to this source installation is currently being used instead of the /etc/php.ini provided by the php-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 run make uninstall. I’d suggest using the find command to track down these files by their modification date.

2
  • I am highly appreciate your time & effort to this. However all of these configurations had done through EazyApache. (I got this to know after all of these tries) There are some unusual changes (rather doing directly on the server) because of installing/upgrades through EazyApache. So have to follow EazyApache to install new modules. Ref: forums.cpanel.net/threads/enable-install-mbstring-module.158165
    – Sadee
    Commented Sep 6, 2016 at 15:32
  • @Sadee That hurts! The fact that EazyApache was installed on the server was crucial information. Had you mentioned this vital fact in the question, we wouldn't have had to put so much effort into debugging. Shouldn't I get some reputation in return for spending all that time on you question? Now I know why cPanel questions were banned from Server Fault. :( Commented Sep 6, 2016 at 16:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .