Louis93
Louis93

Reputation: 3913

Fatal error: Call to undefined function mb_detect_encoding()

I receive this error after trying to set up LAMP by following this tutorial, and I find myself receiving the above error after trying to set up phpmyadmin.

Fatal error: Call to undefined function mb_detect_encoding() in C:\WebServer\Apache\htdocs\phpmyadmin\libraries\php-gettext\gettext.inc on line 177

I followed the advice over here: PHP Fatal error when trying to access phpmyadmin mb_detect_encoding, and made those changes.

When I run phpinfo(), I see that support for MySQL and mb_string are enabled as shown below:

mb_string

MySQL

mysqli

Upvotes: 56

Views: 187104

Answers (13)

Syed Nayab Bukhari
Syed Nayab Bukhari

Reputation: 1

PHP.INI XAMP5.6 > In my case, while updating max_ values, I removed ; max_input_time Default Value: -1 (Unlimited)

After undoing everything works normally. ; max_input_time ; Default Value: -1 (Unlimited)

Upvotes: 0

BSB
BSB

Reputation: 2468

Mbstring is a non-default extension. This means it is not enabled by default. You must explicitly enable the module with the configure option.

In case your php version is 7.2:

sudo apt-get install php7.2-mbstring

sudo service apache2 restart

In case your php version is 7.0:

sudo apt-get install php7.0-mbstring

sudo service apache2 restart

In case your php version is 5.6:

sudo apt-get install php5.6-mbstring

sudo service apache2 restart

Upvotes: 12

ELYAS AYALEW
ELYAS AYALEW

Reputation: 31

In case your php version is 7.2:

sudo apt-get install php7.2-mbstring

sudo service apache2 restart

Upvotes: 0

user3413723
user3413723

Reputation: 12213

For fedora/centos/redhat:

yum install php-mbstring

Then restart apache

Upvotes: 2

daniele cocilova
daniele cocilova

Reputation: 11

I had the same problem with Ubuntu 17, Ispconfig was not processing the operations queued of any kind and also the server.sh command was not working. I checked and the running PHP version after the OS upgrade was 7.1 so the solution was to type:

apt-get install php7.1-mbstring

and now is everything ok

Upvotes: 1

ironarm
ironarm

Reputation: 472

The problem could also be that Apache can't find php.ini If you set PHPIniDir incorrectly. Mine was set to: PHPIniDir "c:/php7" But, the folder is actually just "php" The clue was viewing phpinfo() Which showed: Configuration File (php.ini) Path C:\windows

Upvotes: 1

Abhishek Shringi
Abhishek Shringi

Reputation: 111

When I opened my php.ini file, "extension_dir" line looked like following :

extension_dir = "C:/wamp/bin/php/php5.4.16/ext/"

which i changed to:

extension_dir = "C:\wamp\bin\php\php5.4.16\ext\"

and it worked.

Upvotes: 3

Vasko
Vasko

Reputation: 257

Hope this helps some ppl, I got this error when i added the path and extension to "docref_root" "docref_ext" in my php.ini file, I then commented it out and it was ok, but cant get my help to work now.

Upvotes: 0

rightstuff
rightstuff

Reputation: 6522

Under Windows / WAMP there doesn't seem to be any php_mbstring.dll dependencies on the GD2 extension, the MySQL extensions, nor on external dlls/libs:

deplister.exe ext\php_mbstring.dll

php5ts.dll,OK
MSVCR110.dll,OK
KERNEL32.dll,OK

deplister.exe ext\php_gd2.dll

php5ts.dll,OK
USER32.dll,OK
GDI32.dll,OK
KERNEL32.dll,OK
MSVCR110.dll,OK

Whatever php_mbstring already needs, it's built-in (statically compiled right into the DLL).

Call to undefined function mb_detect_encoding()

This error is also very specific and deterministic...

The function mb_detect_encoding() didn't fail because php_gd, php_mysql, php_mysqli, or another extension was not loaded; it simply was NOT found.

I'm guessing that all the answers that are reported as valid (for Windows / WAMP), that say to load other extensions, to change php.ini extension_dir paths (if this one was wrong to begin with, NO extensions would load), etc, work more due to a) un-commenting the extension = php_mbstring.dll line, or b) restarting Apache or the computer (for changes to take effect).

On Windows, most of the time the problem is that php_mbstring.dll is either:

  • Blocked by Windows. Unblock it by right-clicking it, check Properties.

  • Or PHP can't load php_mbstring.dll due to another version getting loaded (e.g., from some improper PHP DLLs install into C:\Windows\system32), some version mismatch, missing run-time DLLs, etc. Check Apache's and PHP's error log files first for clues.

More in-depth answer here: Call to undefined function mb_detect_encoding

Upvotes: 2

André Ribeiro
André Ribeiro

Reputation: 61

On Windows open the file php.ini and make this changes:

Remove the comment and point to the ext directory

; extension_dir = "./" -> extension_dir = "C:/Php/ext"

Remove the comment of this extensions

  • extension=php_mbstring.dll
  • extension=php_mysqli.dll

Restart apache service

httpd -k restart

Upvotes: 6

Phil LaNasa
Phil LaNasa

Reputation: 3035

There's a much easier way than recompiling PHP. Just yum install the required mbstring library:

Example: How to install PHP mbstring on CentOS 6.2

yum --enablerepo=remi install php-mbstring

Oh, and don't forget to restart apache afterward.

Upvotes: 33

Jibu K
Jibu K

Reputation: 534

Install the gd library also.

check this link http://www.php.net/manual/en/mbstring.installation.php

Upvotes: 50

user2615161
user2615161

Reputation: 21

you should use only english version of phpmyadmin if you are using all languages you should enable all languages mbstring in php.in file.....just search for mbstring in php.in

Upvotes: 1

Related Questions