Fatal error:
Call to undefined function mb_detect_encoding()
in Wamp\phpMyAdmin\libraries\php-gettext\gettext.inc on line 177
This error is usually related to PHP being unable to load the php_mbstring extension, because of some issue with the “php_mbstring.dll” file or the other DLLs that it depends on.
Update PATH and Reboot OS
After installing WAMP, or using a new version of PHP, make sure to reboot/restart the system. This will:
- Propagate the proper PATH changes that includes the location of these files.
- Clear out any previous DLL versions that might be still loaded by the OS.
Unblock php_mbstring.dll
Go into PHP’s \ext
folder, right-click on file “php_mbstring.dll”, select Properties, and at the bottom make sure the file not listed as “Blocked”. If it is, click “unblock”.
C:\WampDeveloper\Components\Php\ext\
Restart Apache.
Test Dependencies
Test for the presence of all the DLLs the php_mbstring.dll extension depends on…
Open the command-line, change to PHP’s directory, and run PHP’s deplister:
cd Components\Php
deplister ext\php_mbstring.dll
php5ts.dll,OK
MSVCR110.dll,OK
KERNEL32.dll,OK
* This will only work on some newer versions of PHP that have “deplister”.
If you see a message about MSVCR110.dll (or some similar named DLL) missing / not-found, your system is missing this run-time:
Visual C++ Redistributable for Visual Studio 2012 Update 4
You’ll need the 32 bit version: vcredist_x86.exe
This run-time is included on most current and updated OSs, but some non-updated OSs only have the 2008 version.
Reboot.
Check php.ini
Check php.ini to make sure extension “php_mbstring.dll” is being included/loaded…
C:\WampDeveloper\Config\Php\php.ini
Locate, and make sure this extension line is uncommented (no ‘;’ in front) -
extension=php_mbstring.dll
It’s loaded by default under WAMP, unless the PHP version’s php.ini was modified.
Restart Apache.
Check for older DLLs
It is possible that some PHP DLLs, from other PHP or WAMP installations, exist on your system, which should be removed.
Search your PC for files: php5ts.dll, php5.dll, php_mbstring.dll
The found location will most like be:
C:\Windows\system32
In the location you find any of the above files, you might also have a bunch of other php*.dll files that need to be deleted.
* Don’t delete anything within WAMP’s folder:
C:\WampDeveloper\
Reboot.
Check Log Files
If nothing else helps, check the Log files again -
A. Apache’s general error log – Logs\Apache\httpd.host.errorlog.txt
B. PHP’s general error log – Logs\Php\errorlog.txt (if exists)
C. And if this is specific to a website, the website’s error logs -
Logs\Websites\domain.name\http.phplog.txt
Logs\Websites\domain.name\http.errorlog.txt
In the case of http://localhost/phpmyadmin or http://127.0.0.1/phpmyadmin , that “domain.name” would be “serverhost”.