Unable to call the built in mb_internal_encoding method?

I'm trying to install indefero on a CentOS 5.3 VMware 'box' and I ran into a problem. Quite early in the installation I get an error that I've been able to narrow down to this:

[root@code /var/www/html]# cat x.php <?php mb_internal_encoding("UTF-8"); ?> [root@code /var/www/html]# php x.php PHP Fatal error: Call to undefined function mb_internal_encoding() in /var/www/html/x.php on line 2 

I get the same error when calling this script via http through Apache. Now according to the PHP manual the mb_internal_encoding function should be a builtin in PHP 5.

I have CentOS 5.3 i386 (Linux code 2.6.18-53.1.21.el5 #1 SMP Tue May 20 09:34:18 EDT 2008 i686 i686 i386 GNU/Linux) and I've installed PHP 5.2.9.

[root@code /var/www/html]# php -v PHP 5.2.9 (cli) (built: Jul 8 2009 06:03:36) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies 

I double checked: selinux has been disabled (for now).

How do i fix this?

1

7 Answers

mbstring is a "non-default" extension, that is not enabled by default ; see this page of the manual :

Installation

mbstring is a non-default extension. This means it is not enabled by default. You must explicitly enable the module with the configure option. See the Install section for details

So, you might have to enable that extension, modifying the php.ini file (and restarting Apache, so your modification is taken into account)


I don't use CentOS, but you may have to install the extension first, using something like this (see this page, for instance, which seems to give a solution) :

yum install php-mbstring 

(The package name might be a bit different ; so, use yum search to get it :-) )

4

For Debian/Ubuntu:

sudo apt-get install php7.0-mbstring

1

If you don't know how to enable php_mbstring extension in windows, open your php.ini and remove the semicolon before the extension:

change this

;extension=php_mbstring.dll 

to this

extension=php_mbstring.dll 

after modification, you need to reset your php server.

If someone is having trouble with installing php-mbstring package in ubuntu do following sudo apt-get install libapache2-mod-php5

1

apt-get install php7.3-mbstring solved the issue on ubuntu, php version is php-fpm 7.3

For php 5.6 in ubuntu

sudo apt install php5.6-mbstring 

Restart Apache2

sudo systemctl restart apache2 

For OpenSUse (zypper package manager):

zypper install php5-mbstring 

and:

zyper install php7-mbstring 

In the other hand, you can search them through YaST Software manager.

Note that, you must restart apache http server:

systemctl restart apache2.service 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like