“配置MW:显示错误信息”的版本间差异
		
		
		
		
		
		跳到导航
		跳到搜索
		
				
		
		
	
 (建立内容为“category:MediaWiki  == 关于 == 上次在安装调试MediaWiki的SyntaxHighLight插件的时候,网上搜索信息,找到了让MediaWiki显示错误信…”的新页面)  | 
				 (→解析)  | 
				||
| 第23行: | 第23行: | ||
== 解析 ==  | == 解析 ==  | ||
{| class="wikitable"  | |||
! 配置 !! 说明  | |||
|-  | |||
| error_reporting( -1 );  | |||
| <code>“error_reporting(level)”;</code>:返回旧的 error_reporting 级别,或者在 level 参数未给出时返回当前的级别。  | |||
<syntaxhighlight lang="php">  | |||
// 关闭错误报告  | |||
error_reporting(0);  | |||
// 报告 runtime 错误  | |||
error_reporting(E_ERROR | E_WARNING | E_PARSE);  | |||
// 报告所有错误  | |||
error_reporting(E_ALL);  | |||
// 等同 error_reporting(E_ALL);  | |||
ini_set("error_reporting", E_ALL);  | |||
// 报告 E_NOTICE 之外的所有错误  | |||
error_reporting(E_ALL & ~E_NOTICE);  | |||
</syntaxhighlight>  | |||
|-  | |||
| ini_set( 'display_errors', 1 );  | |||
| <nowiki>“ini_set(string $varname, string $newvalue)”</nowiki>:用来设置php.ini的值,  | |||
|-  | |||
| <s>$wgShowSQLErrors = true;</s>  | |||
| <s>Shows the actual query, which caused the error.(This feature was deprecated in version 1.32.0.)</s>  | |||
|-  | |||
| $wgDebugDumpSql  = true;  | |||
| Log all SQL statements to the DBQuery channel and the Debugging toolbar (if also enabled).  | |||
|-  | |||
| $wgDebugToolbar =TRUE;  | |||
| Shows a toolbar on the page with profiling, log messages and more.  | |||
|-  | |||
| $wgShowExceptionDetails=true;  | |||
| Enable more details (like a stack trace) to be shown on the "Fatal error" page.  | |||
|-  | |||
| $wgDevelopmentWarnings=TRUE;  | |||
| MediaWiki will throw notices for some possible error conditions and for deprecated functions.  | |||
|-  | |||
| $wgShowDebug =true;  | |||
| Adds the "log messages" part of wgDebugToolbar as a raw list to the page.  | |||
|}  | |||
2020年10月14日 (三) 21:31的版本
关于
上次在安装调试MediaWiki的SyntaxHighLight插件的时候,网上搜索信息,找到了让MediaWiki显示错误信息的几个配置:
error_reporting( -1 );
ini_set( 'display_errors', 1 );
$wgShowSQLErrors = true;
$wgDebugDumpSql  = true;
$wgDebugToolbar =TRUE;
$wgShowExceptionDetails=true;
$wgDevelopmentWarnings=TRUE;
$wgShowDebug =true;
直接拿来使用了,对于调试过程十分友好,特此记录。
解析
| 配置 | 说明 | 
|---|---|
| error_reporting( -1 ); | “error_reporting(level)”;:返回旧的 error_reporting 级别,或者在 level 参数未给出时返回当前的级别。
// 关闭错误报告
error_reporting(0);
// 报告 runtime 错误
error_reporting(E_ERROR | E_WARNING | E_PARSE);
// 报告所有错误
error_reporting(E_ALL);
// 等同 error_reporting(E_ALL);
ini_set("error_reporting", E_ALL);
// 报告 E_NOTICE 之外的所有错误
error_reporting(E_ALL & ~E_NOTICE);
 | 
| ini_set( 'display_errors', 1 ); | “ini_set(string $varname, string $newvalue)”:用来设置php.ini的值, | 
| $wgDebugDumpSql = true; | Log all SQL statements to the DBQuery channel and the Debugging toolbar (if also enabled). | 
| $wgDebugToolbar =TRUE; | Shows a toolbar on the page with profiling, log messages and more. | 
| $wgShowExceptionDetails=true; | Enable more details (like a stack trace) to be shown on the "Fatal error" page. | 
| $wgDevelopmentWarnings=TRUE; | MediaWiki will throw notices for some possible error conditions and for deprecated functions. | 
| $wgShowDebug =true; | Adds the "log messages" part of wgDebugToolbar as a raw list to the page. |