尝试访问phpmyadmin mb_detect_encoding时出现PHP致命错误

时间:2022-08-26 20:16:25

Not sure what happened, but below is what the log is giving me when trying to access phpmyadmin, please help. Trying to debug a different problem and ran into this. Not really possible to revert back to when it was working.

不确定发生了什么,但下面是日志在尝试访问phpmyadmin时给我的,请帮忙。试图调试一个不同的问题并遇到这个问题。真的不可能恢复到它工作的时候。

PHP Fatal error: Call to undefined function mb_detect_encoding() in /usr/share/php/gettext/gettext.inc on line 177

PHP致命错误:在第177行的/usr/share/php/gettext/gettext.inc中调用未定义的函数mb_detect_encoding()

When trying to go the the site, I get this error, I think it's likely the two errors are related:

当我试图访问该网站时,我收到此错误,我认为这两个错误很可能是相关的:

Database connection error (1): The MySQL adapter 'mysqli' is not available.

数据库连接错误(1):MySQL适配器'mysqli'不可用。

15 个解决方案

#1


25  

First error is caused by php because the extension mbstring is either not installed or not active.

第一个错误是由php引起的,因为扩展名mbstring未安装或未激活。

The second error is output of phpMyAdmin/your site asking you to install / enable the mysqli extension.

第二个错误是phpMyAdmin /您的站点输出,要求您安装/启用mysqli扩展。

To enable mbstring and mysqli edit your php.ini and add/uncomment the two lines with mbstring.so and mysqli.so on unix or mbstring.dll and mysqli.dll on windows

要启用mbstring和mysqli编辑你的php.ini并添加/取消注释unbs上的mbstring.so和mysqli.so以及windows上的mbstring.dll和mysqli.dll两行

Unix /etc/(phpX/)php.ini

Unix /etc/(phpX/)php.ini

extension=mysqli.so
extension=mbstring.so

Windows PHP installation folder\etc\php.ini

Windows PHP安装文件夹\ etc \ php.ini

extension=mysqli.dll
extension=mbstring.dll

Don't forget to restart your webserver after this.

在此之后不要忘记重新启动您的网络服务器。

EDIT: User added he was using redhat in the comments so here's how you install extensions on all CentOS/Fedora/RedHat/Yum based linux distros

编辑:用户添加他在评论中使用redhat所以这里是你如何在所有CentOS / Fedora / RedHat / Yum基于Linux的发行版上安装扩展

sudo yum install php-mysqli
sudo yum install php-mbstring

restart your werbserver
sudo /etc/init.d/httpd restart

you can verify your installation with a little php script in your document root. This lists all settings, versions and active extensions you've installed for php

您可以在文档根目录中使用一些PHP脚本验证您的安装。这列出了您为php安装的所有设置,版本和活动扩展

test.php

test.php的

<?php
phpinfo();

#2


10  

After reading about the extension_dir = "ext" i added the line to php.ini but didnt work, then started to look apache error log and saw the PHP was in fact unable to find the dll's in the specified directory "ext". I commented the extension_dir line, restarted Apache and looked the error log again, saw that PHP was now looking the dll's in C:/PHP/ext (by default i guess), but since im using other folders, that's not the correct path, so i uncommented the extension_dir line and wrote this:

在阅读了关于extension_dir =“ext”之后,我将该行添加到php.ini但没有工作,然后开始查看apache错误日志,看到PHP实际上无法在指定目录“ext”中找到dll。我评论了extension_dir行,重新启动了Apache并再次查看了错误日志,看到PHP现在正在C:/ PHP / ext中查看dll(默认情况下我猜),但是由于我使用其他文件夹,这不是正确的路径,所以我取消注释了extension_dir行并写了这个:

extension_dir = "C:/Apache24/PHP/ext" 

In my configuration that is the correct path to dll's.

在我的配置中,这是dll的正确路径。

and of course, uncommented:

当然,没有评论:

extension=php_mbstring.dll
extension=php_mysql.dll
extension=php_mysqli.dll

Restarted the Apache server and internet browser and now phpMyAdmin works with my mySQL login.

重新启动Apache服务器和Internet浏览器,现在phpMyAdmin可以使用我的mySQL登录。

So, dll's incorrect path and dll's needed commented in php.ini were the problem.

所以,dll的错误路径和需要在php.ini中注释的dll是问题所在。

Remember to restart Apache and internet browser after editing config files.

记住在编辑配置文件后重启Apache和Internet浏览器。

System spec: Windows 7 HB 64bit httpd-2.4.4-win32-ssl_0.9.8.zip php-5.4.16-Win32-VC9-x86.zip phpMyAdmin-4.0.4.1-all-languages.zip mysql-installer-community-5.6.11.0.msi

系统规范:Windows 7 HB 64bit httpd-2.4.4-win32-ssl_0.9.8.zip php-5.4.16-Win32-VC9-x86.zip phpMyAdmin-4.0.4.1-all-languages.zip mysql-installer-community- 5.6.11.0.msi

Hope this help. Thx for your comments too.

希望这有帮助。感谢您的评论。

#3


9  

in ubuntu 16.04 when i tried to connect to phpmyadmin a white blank paged appeared so i ran the above command and phpmyadmin works

在ubuntu 16.04当我试图连接到phpmyadmin时出现了一个白色的空白分页,所以我运行了上面的命令和phpmyadmin的工作原理

sudo apt-get install php-mbstring php7.0-mbstring php-gettext

for mysql support install

用于mysql支持安装

sudo apt-get install php7.0-mysql

tested in ubuntu 16.04 with php 7 version

在ubuntu 16.04中测试了php 7版本

#4


3  

It looks like your PHP installation does not have the mbstring extension and the mysqli adapter extension installed.

看起来您的PHP安装没有安装mbstring扩展和mysqli适配器扩展。

Please check your phpinfo(); or run php -i | grep 'mbstring\|mysqli' in a terminal.

请检查你的phpinfo();或者运行php -i | grep'mbstring \ | mysqli'在终端中。

#5


3  

I had the same problem on my windows7- 32 bit:

我在windows7-32位上遇到了同样的问题:

1."PHP Fatal error: Call to undefined function mb_detect_encoding() in /usr/share/php/gettext/gettext.inc on line 177"

1.“PHP致命错误:在第177行的/usr/share/php/gettext/gettext.inc中调用未定义的函数mb_detect_encoding()”

when i opened my php.ini file , "extension_dir" line looked like following :

当我打开我的php.ini文件时,“extension_dir”行看起来如下:

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


2  

In php.ini, I had to change

在php.ini中,我不得不改变

extension_dir = "ext"

to

extension_dir = "C:/PHP/ext"

as my PHP was installed in C:\PHP. I had to use / instead of \, and then it worked.

因为我的PHP安装在C:\ PHP中。我不得不使用/而不是\,然后它工作。

Also uncomment mbstrings, mysqli and mysql extensions.

还取消注释mbstrings,mysqli和mysql扩展。

#7


1  

What helped me (using XAMPP on Windows) was to:

帮助我(在Windows上使用XAMPP)的原因是:

  • make sure that my path included the correct path for PHP (I had two PHP installations, one under c:\php and the XAMPP installation in c:\xampp\php which was the one I wanted to use)
  • 确保我的路径包含PHP的正确路径(我有两个PHP安装,一个在c:\ php下,而XAMPP安装在c:\ xampp \ php中,这是我想要使用的)
  • check that the lines
    extension_dir="C:\xampp\php\ext"
    extension=php_mbstring.dll
    extension=php_exif.dll ; Must be after mbstring as it depends on it
    were uncommented in the php.ini file (i.e. no ; at the beginning)
  • 检查行extension_dir =“C:\ xampp \ php \ ext”extension = php_mbstring.dll extension = php_exif.dll;必须在mbstring之后,因为它依赖于它在php.ini文件中取消注释(即没有;在开头)
  • restart the Apache server
  • 重启Apache服务器
  • last but not least, clear the cache when reloading the page http://localhost/phpmyadmin/ (for instance with Ctrl-F5 in Chrome)
  • 最后但并非最不重要的是,在重新加载页面http:// localhost / phpmyadmin /时清除缓存(例如在Chrome中使用Ctrl-F5)

#8


1  

Recompile PHP with mbstring.

用mbstring重新编译PHP。

./configure --enable-http --with-apxs2 --with-mysql --with-gd --with-curl --with-mbstring

./configure --enable-http --with-apxs2 --with-mysql --with-gd --with-curl --with-mbstring

make 

make install

#9


0  

My guess would be to check that the mysqli extension is enabled in your PHP configuration. More info would be great (eg. OS, AMP stack, etc.).

我的猜测是检查你的PHP配置中是否启用了mysqli扩展。更多信息会很棒(例如OS,AMP堆栈等)。

Check in your php.ini configuration for mysqli and make sure there is no ';' in front of the extension. The one enabled on my setup is php_mysqli_libmysql.dll.

检查你的php.ini配置中的mysqli并确保没有';'在扩展名前面。在我的设置上启用的是php_mysqli_libmysql.dll。

#10


0  

Try to install mysqli and pdo. Put it in terminal:

尝试安装mysqli和pdo。把它放在终端:

./configure --with-mysql=/usr/bin/mysql_config  \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd

#11


0  

I tried on Windows and I was getting same issue after enabling this in PHP installation folder\etc\php.ini:

我在Windows上试过,在PHP安装文件夹\ etc \ php.ini中启用后,我遇到了同样的问题:

extension=mysqli.dll 
extension=mbstring.dl

You should also enable the following in the ini file:

您还应该在ini文件中启用以下内容:

extension_dir = "ext"

phpMyadmin is working now!

phpMyadmin正在运行!

#12


0  

In windows 2008 Server.

在Windows 2008 Server中。

i removed ";" in front of extension=php_mbstring.dll in php.ini file and it worked... i followed below link...

我删除了 ”;”在php.ini文件中的扩展名= php_mbstring.dll之前它工作了......我按照下面的链接...

https://bugs.php.net/bug.php?id=64965

https://bugs.php.net/bug.php?id=64965

#13


0  

  1. Some versions of windows do not come with libmysql.dll which is necessary to load the mysql and mysqli extensions. Check if it is available in C:/Windows/System32 (windows 7, 32 bits). If not, you can download it DLL-files.com and install it under C:/Windows/System32.
  2. 某些版本的Windows没有附带libmysql.dll,这是加载mysql和mysqli扩展所必需的。检查它是否在C:/ Windows / System32(Windows 7,32位)中可用。如果没有,您可以下载DLL-files.com并将其安装在C:/ Windows / System32下。
  3. If this persists, check your apache log files and resort to a solution above which responds to the error logged by your server.
  4. 如果仍然存在,请检查您的apache日志文件并使用上面的解决方案来响应服务器记录的错误。

#14


0  

One options is: disabled this extension_dir = "ext"

一个选项是:禁用此extension_dir =“ext”

and the other is:

另一个是:

go to wamp icon and see php and the click on php error logs then from error log u can find exact error.

转到wamp图标,看到php和点击php错误日志然后从错误日志你可以找到确切的错误。

this error occurs only if paths are not properly set.

仅当路径未正确设置时才会出现此错误。

#15


0  

I had the same trouble, this is what worked for me.

我遇到了同样的麻烦,这对我有用。

You can click at the wampserver icon, then at the PHP error log. Check if it says this: Unable to load dynamic library 'c:/wamp/bin/php/php5.5.12/ext/php_ldap.dll'

您可以单击wampserver图标,然后单击PHP错误日志。检查是否这样说:无法加载动态库'c:/wamp/bin/php/php5.5.12/ext/php_ldap.dll'

If yes, then you can reload your version of PHP, by clicking at the wampserver icon, then PHP, then version, and then you click at your version. Wait for everything to be online again, then try to access phpmyadmin.

如果是,那么您可以重新加载您的PHP版本,方法是单击wampserver图标,然后单击PHP,然后单击版本,然后单击您的版本。等待所有内容再次联机,然后尝试访问phpmyadmin。

#1


25  

First error is caused by php because the extension mbstring is either not installed or not active.

第一个错误是由php引起的,因为扩展名mbstring未安装或未激活。

The second error is output of phpMyAdmin/your site asking you to install / enable the mysqli extension.

第二个错误是phpMyAdmin /您的站点输出,要求您安装/启用mysqli扩展。

To enable mbstring and mysqli edit your php.ini and add/uncomment the two lines with mbstring.so and mysqli.so on unix or mbstring.dll and mysqli.dll on windows

要启用mbstring和mysqli编辑你的php.ini并添加/取消注释unbs上的mbstring.so和mysqli.so以及windows上的mbstring.dll和mysqli.dll两行

Unix /etc/(phpX/)php.ini

Unix /etc/(phpX/)php.ini

extension=mysqli.so
extension=mbstring.so

Windows PHP installation folder\etc\php.ini

Windows PHP安装文件夹\ etc \ php.ini

extension=mysqli.dll
extension=mbstring.dll

Don't forget to restart your webserver after this.

在此之后不要忘记重新启动您的网络服务器。

EDIT: User added he was using redhat in the comments so here's how you install extensions on all CentOS/Fedora/RedHat/Yum based linux distros

编辑:用户添加他在评论中使用redhat所以这里是你如何在所有CentOS / Fedora / RedHat / Yum基于Linux的发行版上安装扩展

sudo yum install php-mysqli
sudo yum install php-mbstring

restart your werbserver
sudo /etc/init.d/httpd restart

you can verify your installation with a little php script in your document root. This lists all settings, versions and active extensions you've installed for php

您可以在文档根目录中使用一些PHP脚本验证您的安装。这列出了您为php安装的所有设置,版本和活动扩展

test.php

test.php的

<?php
phpinfo();

#2


10  

After reading about the extension_dir = "ext" i added the line to php.ini but didnt work, then started to look apache error log and saw the PHP was in fact unable to find the dll's in the specified directory "ext". I commented the extension_dir line, restarted Apache and looked the error log again, saw that PHP was now looking the dll's in C:/PHP/ext (by default i guess), but since im using other folders, that's not the correct path, so i uncommented the extension_dir line and wrote this:

在阅读了关于extension_dir =“ext”之后,我将该行添加到php.ini但没有工作,然后开始查看apache错误日志,看到PHP实际上无法在指定目录“ext”中找到dll。我评论了extension_dir行,重新启动了Apache并再次查看了错误日志,看到PHP现在正在C:/ PHP / ext中查看dll(默认情况下我猜),但是由于我使用其他文件夹,这不是正确的路径,所以我取消注释了extension_dir行并写了这个:

extension_dir = "C:/Apache24/PHP/ext" 

In my configuration that is the correct path to dll's.

在我的配置中,这是dll的正确路径。

and of course, uncommented:

当然,没有评论:

extension=php_mbstring.dll
extension=php_mysql.dll
extension=php_mysqli.dll

Restarted the Apache server and internet browser and now phpMyAdmin works with my mySQL login.

重新启动Apache服务器和Internet浏览器,现在phpMyAdmin可以使用我的mySQL登录。

So, dll's incorrect path and dll's needed commented in php.ini were the problem.

所以,dll的错误路径和需要在php.ini中注释的dll是问题所在。

Remember to restart Apache and internet browser after editing config files.

记住在编辑配置文件后重启Apache和Internet浏览器。

System spec: Windows 7 HB 64bit httpd-2.4.4-win32-ssl_0.9.8.zip php-5.4.16-Win32-VC9-x86.zip phpMyAdmin-4.0.4.1-all-languages.zip mysql-installer-community-5.6.11.0.msi

系统规范:Windows 7 HB 64bit httpd-2.4.4-win32-ssl_0.9.8.zip php-5.4.16-Win32-VC9-x86.zip phpMyAdmin-4.0.4.1-all-languages.zip mysql-installer-community- 5.6.11.0.msi

Hope this help. Thx for your comments too.

希望这有帮助。感谢您的评论。

#3


9  

in ubuntu 16.04 when i tried to connect to phpmyadmin a white blank paged appeared so i ran the above command and phpmyadmin works

在ubuntu 16.04当我试图连接到phpmyadmin时出现了一个白色的空白分页,所以我运行了上面的命令和phpmyadmin的工作原理

sudo apt-get install php-mbstring php7.0-mbstring php-gettext

for mysql support install

用于mysql支持安装

sudo apt-get install php7.0-mysql

tested in ubuntu 16.04 with php 7 version

在ubuntu 16.04中测试了php 7版本

#4


3  

It looks like your PHP installation does not have the mbstring extension and the mysqli adapter extension installed.

看起来您的PHP安装没有安装mbstring扩展和mysqli适配器扩展。

Please check your phpinfo(); or run php -i | grep 'mbstring\|mysqli' in a terminal.

请检查你的phpinfo();或者运行php -i | grep'mbstring \ | mysqli'在终端中。

#5


3  

I had the same problem on my windows7- 32 bit:

我在windows7-32位上遇到了同样的问题:

1."PHP Fatal error: Call to undefined function mb_detect_encoding() in /usr/share/php/gettext/gettext.inc on line 177"

1.“PHP致命错误:在第177行的/usr/share/php/gettext/gettext.inc中调用未定义的函数mb_detect_encoding()”

when i opened my php.ini file , "extension_dir" line looked like following :

当我打开我的php.ini文件时,“extension_dir”行看起来如下:

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


2  

In php.ini, I had to change

在php.ini中,我不得不改变

extension_dir = "ext"

to

extension_dir = "C:/PHP/ext"

as my PHP was installed in C:\PHP. I had to use / instead of \, and then it worked.

因为我的PHP安装在C:\ PHP中。我不得不使用/而不是\,然后它工作。

Also uncomment mbstrings, mysqli and mysql extensions.

还取消注释mbstrings,mysqli和mysql扩展。

#7


1  

What helped me (using XAMPP on Windows) was to:

帮助我(在Windows上使用XAMPP)的原因是:

  • make sure that my path included the correct path for PHP (I had two PHP installations, one under c:\php and the XAMPP installation in c:\xampp\php which was the one I wanted to use)
  • 确保我的路径包含PHP的正确路径(我有两个PHP安装,一个在c:\ php下,而XAMPP安装在c:\ xampp \ php中,这是我想要使用的)
  • check that the lines
    extension_dir="C:\xampp\php\ext"
    extension=php_mbstring.dll
    extension=php_exif.dll ; Must be after mbstring as it depends on it
    were uncommented in the php.ini file (i.e. no ; at the beginning)
  • 检查行extension_dir =“C:\ xampp \ php \ ext”extension = php_mbstring.dll extension = php_exif.dll;必须在mbstring之后,因为它依赖于它在php.ini文件中取消注释(即没有;在开头)
  • restart the Apache server
  • 重启Apache服务器
  • last but not least, clear the cache when reloading the page http://localhost/phpmyadmin/ (for instance with Ctrl-F5 in Chrome)
  • 最后但并非最不重要的是,在重新加载页面http:// localhost / phpmyadmin /时清除缓存(例如在Chrome中使用Ctrl-F5)

#8


1  

Recompile PHP with mbstring.

用mbstring重新编译PHP。

./configure --enable-http --with-apxs2 --with-mysql --with-gd --with-curl --with-mbstring

./configure --enable-http --with-apxs2 --with-mysql --with-gd --with-curl --with-mbstring

make 

make install

#9


0  

My guess would be to check that the mysqli extension is enabled in your PHP configuration. More info would be great (eg. OS, AMP stack, etc.).

我的猜测是检查你的PHP配置中是否启用了mysqli扩展。更多信息会很棒(例如OS,AMP堆栈等)。

Check in your php.ini configuration for mysqli and make sure there is no ';' in front of the extension. The one enabled on my setup is php_mysqli_libmysql.dll.

检查你的php.ini配置中的mysqli并确保没有';'在扩展名前面。在我的设置上启用的是php_mysqli_libmysql.dll。

#10


0  

Try to install mysqli and pdo. Put it in terminal:

尝试安装mysqli和pdo。把它放在终端:

./configure --with-mysql=/usr/bin/mysql_config  \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd

#11


0  

I tried on Windows and I was getting same issue after enabling this in PHP installation folder\etc\php.ini:

我在Windows上试过,在PHP安装文件夹\ etc \ php.ini中启用后,我遇到了同样的问题:

extension=mysqli.dll 
extension=mbstring.dl

You should also enable the following in the ini file:

您还应该在ini文件中启用以下内容:

extension_dir = "ext"

phpMyadmin is working now!

phpMyadmin正在运行!

#12


0  

In windows 2008 Server.

在Windows 2008 Server中。

i removed ";" in front of extension=php_mbstring.dll in php.ini file and it worked... i followed below link...

我删除了 ”;”在php.ini文件中的扩展名= php_mbstring.dll之前它工作了......我按照下面的链接...

https://bugs.php.net/bug.php?id=64965

https://bugs.php.net/bug.php?id=64965

#13


0  

  1. Some versions of windows do not come with libmysql.dll which is necessary to load the mysql and mysqli extensions. Check if it is available in C:/Windows/System32 (windows 7, 32 bits). If not, you can download it DLL-files.com and install it under C:/Windows/System32.
  2. 某些版本的Windows没有附带libmysql.dll,这是加载mysql和mysqli扩展所必需的。检查它是否在C:/ Windows / System32(Windows 7,32位)中可用。如果没有,您可以下载DLL-files.com并将其安装在C:/ Windows / System32下。
  3. If this persists, check your apache log files and resort to a solution above which responds to the error logged by your server.
  4. 如果仍然存在,请检查您的apache日志文件并使用上面的解决方案来响应服务器记录的错误。

#14


0  

One options is: disabled this extension_dir = "ext"

一个选项是:禁用此extension_dir =“ext”

and the other is:

另一个是:

go to wamp icon and see php and the click on php error logs then from error log u can find exact error.

转到wamp图标,看到php和点击php错误日志然后从错误日志你可以找到确切的错误。

this error occurs only if paths are not properly set.

仅当路径未正确设置时才会出现此错误。

#15


0  

I had the same trouble, this is what worked for me.

我遇到了同样的麻烦,这对我有用。

You can click at the wampserver icon, then at the PHP error log. Check if it says this: Unable to load dynamic library 'c:/wamp/bin/php/php5.5.12/ext/php_ldap.dll'

您可以单击wampserver图标,然后单击PHP错误日志。检查是否这样说:无法加载动态库'c:/wamp/bin/php/php5.5.12/ext/php_ldap.dll'

If yes, then you can reload your version of PHP, by clicking at the wampserver icon, then PHP, then version, and then you click at your version. Wait for everything to be online again, then try to access phpmyadmin.

如果是,那么您可以重新加载您的PHP版本,方法是单击wampserver图标,然后单击PHP,然后单击版本,然后单击您的版本。等待所有内容再次联机,然后尝试访问phpmyadmin。