问题
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:
回答1:
Install the gd library also.
check this link http://www.php.net/manual/en/mbstring.installation.php
回答2:
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.
回答3:
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.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
回答4:
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
回答5:
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.
回答6:
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
回答7:
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
回答8:
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
回答9:
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
回答10:
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.
回答11:
For fedora:
yum install php-mbstring
Then restart apache
来源:https://stackoverflow.com/questions/17204437/fatal-error-call-to-undefined-function-mb-detect-encoding