【MediaWiki】Database error (SQL query hidden)的调试方法
说起来也奇怪,有一个页面在登录情况下显示正常,但在匿名访问时就出错了,提示如下
Database error
Jump to: navigation, search
A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:
(SQL query hidden)
from within function "SqlBagOStuff::set". Database returned error "1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '�N����/\�:��i��ֆ�l+F���ni ~\�9��:-\rl�����W�q�{\�\r�����^t��;\�5O�W�s����' at line 1 (localhost)".
因为SQL语句隐藏起来了,不知道具体什么问题,希望能显示显示出来
参考了一下Manual:How to debug,原来如此简单,在/LocalSettings.php末尾增加一下几行就可以了
$wgShowSQLErrors = true; $wgDebugDumpSql = true; $wgShowExceptionDetails = true;
刷新一下页面,出错的SQL语句出来了,出错原因也一目了然,因为数据中多处了一个未转义的'。
[完毕]
标签: MediaWiki
代码太给力 看不懂啊
[回复]