PHPMyadmin does not show mysql error messages

陌路散爱 提交于 2019-12-03 21:43:26

问题


I installed phpMyAdmin on my site and it works. But when I mistype a query it does not show the mysql error message only the error code.

1064 -

I expect the following:

1064 - You have and error in your blah blah...

Without an error message it's difficult to know what's wrong.

In my php scripts I'm able to get the error message via mysql_error(). But myAdmin shows nothing.

I googled a lot but I didn't find anything useful.

How can I make it show the error messages?

Any ideas?


回答1:


Judging by the fact that you get "#1064 -" as output, I can find only two places in the phpMyAdmin 3.3.9.2 source where the error could be occurring. The first is in the call to mysql_error or mysqli_error, depending on which backend your installation is using. I see you said that mysql_error works fine; if the phpMyAdmin information page you get when first logging in indicates that mysqli is being used, you might want to check that too.

But if mysql_error works, it seems more likely that the problem is in phpMyAdmin's character set conversion function PMA_DBI_convert_message in libraries/database_interface.lib.php. You can confirm this easily enough by inserting return $message; at the very top of that function, bypassing everything else in there. If that makes it (more or less) work, you'd probably want to determine what $server_language and $GLOBALS['charset'] are getting set to; see if the conversion is using iconv, recode_string, libiconv, or mb_convert_encoding; and then try to work out why whichever of those is failing to convert the error message properly.




回答2:


Probably, Server cannot correctly access LOCALE settings. It happens on chroot-ed / chjail-ed environments or poor configuration.

Based on @Anomie answer, I made a workaround.

For phpmyadmin 4.4.3 change the Fallback setting in file libraries/DatabaseInterface.class.php

 /* Fallback to CP1252 if we can not detect */
        $encoding = 'UTF-8';

For some older versions, edit file libraries/database_interface.lib.php and set array $encodings => 'english' value to UTF-8 (~line 273),

'english'       => 'UTF-8', //'latin1',



回答3:


Did you see :

$cfg['Error_Handler']['display'] boolean

Whether to display errors from PHP or not.

$cfg['Error_Handler']['gather'] boolean

Whether to gather errors from PHP or not.

In the docs ?



来源:https://stackoverflow.com/questions/4735924/phpmyadmin-does-not-show-mysql-error-messages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!