php-致命错误:调用未定义函数mb_detect_encoding()
在按照本教程尝试设置LAMP后,我收到此错误,并且在尝试设置phpmyadmin后发现上述错误。
致命错误:调用未定义函数mb_detect_encoding() C:\ WebServer \ Apache \ htdocs \ phpmyadmin \ libraries \ php-gettext \ gettext.inc 177行
我遵循了这里的建议:尝试访问phpmyadmin mb_detect_encoding时发生PHP致命错误,并进行了更改。
运行phpinfo()时,看到启用了对MySQL和mb_string的支持,如下所示:
Louis93 asked 2020-07-01T18:39:43Z
11个解决方案
41 votes
还安装gd库。
检查此链接[http://www.php.net/manual/zh/mbstring.installation.php]
Jibu K answered 2020-07-01T18:40:02Z
29 votes
有一种比重新编译PHP更简单的方法。 只需安装所需的mbstring库:
示例:如何在CentOS 6.2上安装PHP mbstring
yum --enablerepo=remi install php-mbstring
哦,别忘了之后重新启动apache。
Phil LaNasa answered 2020-07-01T18:40:30Z
8 votes
Mbstring是非默认扩展名。 这意味着默认情况下未启用它。 您必须使用configure选项显式启用模块。
如果您的php版本是7.0:
sudo apt-get install php7.0-mbstring
sudo service apache2 restart
如果您的php版本是5.6:
sudo apt-get install php5.6-mbstring
sudo service apache2 restart
BSB answered 2020-07-01T18:40:59Z
6 votes
在Windows上,打开文件php.ini并进行以下更改:
删除注释并指向ext目录
; extension_dir =“ ./”-> extension_dir =“ C:/ Php / ext”
删除此扩展程序的注释
扩展名= php_mbstring.dll
扩展名= php_mysqli.dll
重新启动apache服务
httpd -k重新启动
André Ribeiro answered 2020-07-01T18:41:49Z
3 votes
当我打开php.ini文件时,“ extension_dir”行如下所示:
extension_dir = "C:/wamp/bin/php/php5.4.16/ext/"
我改为:
extension_dir = "C:\wamp\bin\php\php5.4.16\ext\"
而且有效。
abhishek shringi answered 2020-07-01T18:42:17Z
2 votes
在Windows / WAMP下,GD2扩展,MySQL扩展或外部dll / lib似乎没有任何php_mbstring.dll依赖项:
extension_dir
php5ts.dll,OK
MSVCR110.dll,OK
KERNEL32.dll,OK
extension_dir
php5ts.dll,OK
USER32.dll,OK
GDI32.dll,OK
KERNEL32.dll,OK
MSVCR110.dll,OK
无论php_mbstring已经需要什么,它都是内置的(静态地直接编译到DLL中)。
调用未定义的函数mb_detect_encoding()
此错误也是非常具体且确定的...
函数extension_dir并未失败,因为未加载php_gd,php_mysql,php_mysqli或其他扩展名。 根本找不到。
我猜测所有报告为有效的答案(对于Windows / WAMP),即加载其他扩展名,更改php.ini extension_dir路径(如果开头错误,则不会加载任何扩展名), 等等,由于a)取消注释extension = php_mbstring.dll行,或b)重新启动Apache或计算机(以使更改生效),因此可以使工作更多。
在Windows上,大多数时候问题是php_mbstring.dll是:
被Windows阻止。 右键单击以解除阻止,然后选择“属性”。
否则由于无法加载另一个版本,PHP无法加载php_mbstring.dll(例如,从安装在C:\ Windows \ system32中的一些不正确的PHP DLL),某些版本不匹配,缺少运行时DLL等。请检查Apache和PHP的错误 首先获取日志文件以获取线索。
此处提供更深入的答案:调用未定义的函数mb_detect_encoding
rightstuff answered 2020-07-01T18:43:18Z
1 votes
如果您使用的是所有语言,则应仅使用英语版本的phpmyadmin,应在php.in文件中启用所有语言的mbstring .....只需在php.in中搜索mbstring
user2615161 answered 2020-07-01T18:43:38Z
1 votes
问题也可能是Apache找不到php.ini如果您错误地设置了PHPIniDir。我的设置为:PHPIniDir“ c:/ php7”但是,该文件夹实际上只是“ php”线索是查看phpinfo()其中显示:配置文件(php.ini)路径C:\ windows
ironarm answered 2020-07-01T18:43:58Z
1 votes
我在Ubuntu 17上遇到了相同的问题,Ispconfig无法处理任何排队的操作,并且server.sh命令也无法正常工作。我检查了一下,在操作系统升级后运行的PHP版本是7.1,因此解决方案是键入:
apt-get install php7.1-mbstring
现在一切正常
daniele cocilova answered 2020-07-01T18:44:22Z
0 votes
希望这可以帮助一些人,当我在php.ini文件中将路径和扩展名添加到“ docref_root”,“ docref_ext”时,出现此错误,然后我将其注释掉了,这没问题,但现在无法获得帮助。
Vasko answered 2020-07-01T18:44:42Z
0 votes
对于软呢帽:
yum install php-mbstring
然后重新启动Apache
user3413723 answered 2020-07-01T18:45:06Z