简体   繁体   English

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

[英]PHP Fatal error when trying to access phpmyadmin mb_detect_encoding

Not sure what happened, but below is what the log is giving me when trying to access phpmyadmin, please help. 不确定发生了什么,但下面是日志在尝试访问phpmyadmin时给我的,请帮忙。 Trying to debug a different problem and ran into this. 试图调试一个不同的问题,并遇到这个问题。 Not really possible to revert back to when it was working. 真的不可能恢复到工作的时候。

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'不可用。

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. 您可以在文档根目录中使用一些PHP脚本验证您的安装。 This lists all settings, versions and active extensions you've installed for php 这列出了您为php安装的所有设置,版本和活动扩展

test.php test.php的

<?php
phpinfo();

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". 在阅读了关于extension_dir =“ext”之后,我将这行添加到php.ini但没有工作,然后开始查看apache错误日志,看到PHP实际上无法在指定目录“ext”中找到dll。 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行,重新启动了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. 感谢你的评论。

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版本进行了测试

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(); 请检查你的phpinfo(); or run php -i | grep 'mbstring\\|mysqli' 或者运行php -i | grep 'mbstring\\|mysqli' php -i | grep 'mbstring\\|mysqli' in a terminal. php -i | grep 'mbstring\\|mysqli'在终端中。

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. 它起作用了。

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 . 因为我的PHP安装在C:\\PHP I had to use / instead of \\ , and then it worked. 我必须使用/而不是\\ ,然后它工作。

Also uncomment mbstrings , mysqli and mysql extensions. 还取消注释mbstringsmysqlimysql扩展。

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 (ie no ; at the beginning) 在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)

Recompile PHP with mbstring. 用mbstring重新编译PHP。

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

make 

make install

Try to install mysqli and pdo. 尝试安装 mysqli和pdo。 Put it in terminal: 把它放在终端:

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

My guess would be to check that the mysqli extension is enabled in your PHP configuration. 我的猜测是检查你的PHP配置中是否启用了mysqli扩展。 More info would be great (eg. OS, AMP stack, etc.). 更多信息会很棒(例如OS,AMP堆栈等)。

Check in your php.ini configuration for mysqli and make sure there is no ';' 检查你的php.ini配置mysqli并确保没有';' in front of the extension. 在扩展名前面。 The one enabled on my setup is php_mysqli_libmysql.dll. 在我的设置上启用的是php_mysqli_libmysql.dll。

I tried on Windows and I was getting same issue after enabling this in PHP installation folder\\etc\\php.ini : 我在Windows上尝试过,在PHP installation folder\\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正在运行!

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

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

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. 仅当路径未正确设置时才会出现此错误。

I had the same trouble, this is what worked for me. 我遇到了同样的麻烦,这对我有用。

You can click at the wampserver icon, then at the PHP error log. 您可以单击wampserver图标,然后单击PHP错误日志。 Check if it says this: Unable to load dynamic library 'c:/wamp/bin/php/php5.5.12/ext/php_ldap.dll' 检查是否这样说: Unable to load dynamic library '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. 如果是,那么您可以重新加载您的PHP版本,方法是单击wampserver图标,然后单击PHP,然后单击版本,然后单击您的版本。 Wait for everything to be online again, then try to access phpmyadmin. 等待所有内容再次联机,然后尝试访问phpmyadmin。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 尝试在带有PHP 5.4.30的IIS 8上运行phpMyAdmin 4.2.7时出现“致命错误:调用未定义的函数mb_detect_encoding()” - “Fatal Error: Call to undefined function mb_detect_encoding()” when trying to run phpMyAdmin 4.2.7 on IIS 8 with PHP 5.4.30 在Windows 10上运行wamp,启动phpmyadmin会引发错误:致命错误:调用未定义函数mb_detect_encoding() - wamp on windows 10, Starting phpmyadmin throws an error: Fatal error: Call to undefined function mb_detect_encoding() 致命错误:调用未定义函数mb_detect_encoding() - Fatal error: Call to undefined function mb_detect_encoding() in 致命错误:在Windows中调用未定义的函数mb_detect_encoding() - Fatal error: Call to undefined function mb_detect_encoding() in windows 致命错误:调用未定义的 function mb_detect_encoding() - Fatal error: Call to undefined function mb_detect_encoding() 致命错误:未捕获错误:使用 PHP 7.2 在 Uniform Server 中调用未定义的函数 mb_detect_encoding() - Fatal error: Uncaught Error: Call to undefined function mb_detect_encoding() in Uniform Server with PHP 7.2 致命错误:在第177行的C:\\ apache \\ htdocs \\ phpmyadmin \\ libraries \\ php-gettext \\ gettext.inc中调用未定义的函数mb_detect_encoding() - Fatal error: Call to undefined function mb_detect_encoding() in C:\apache\htdocs\phpmyadmin\libraries\php-gettext\gettext.inc on line 177 致命错误:在第177行上的C:\\ Users \\ Jarek \\ mywebsite \\ phpMyAdmin \\ libraries \\ php-gettext \\ gettext.inc中调用未定义函数mb_detect_encoding() - Fatal error: Call to undefined function mb_detect_encoding() in C:\Users\Jarek\mywebsite\phpMyAdmin\libraries\php-gettext\gettext.inc on line 177 mb_detect_encoding $ this在PHP 5.3中的上下文错误 - mb_detect_encoding $this context error in PHP 5.3 是否等效于nodejs中的mb_detect_encoding(php)? - Equivalent for mb_detect_encoding(php) in nodejs?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM