Easy debugging of the MediaWiki extension

I am trying to write my first MediaWiki extension and need to debug it somehow. What is the easiest way to do this? Message display, file entry, etc. Will be fine. I just want to slowly move around the code and see where it breaks and what the contents of the variable are.

I tried (from http://www.mediawiki.org/wiki/Manual:How_to_debug#Useful_debugging_functions )

// ...somewhere in your code if ( true ) { wfDebugLog( 'myext', 'Something is not right: ' . print_r( 'asdf', true ) ); } 

in the extensions /myext/myext.php and added to LocalSettings.php

 require_once( 'extensions/myext/myext.php' ); # debugging on $wgDebugLogGroups = array( 'myext' => 'extensions/myext/myextension.log' ); 

but then my wiki doesn't work at all (error 500). With the above code, everything is fine from myext.php (with $ wgExtensionCredits in myext.php, I can see myext in Special: Version).

Is it right to do it (then what a mistake), or is there a better / easier way to get started?

+4
source share
1 answer

500 means you have a syntax error or incorrect configuration. You followed the instructions in the Guide: How to debug and enable PHP logging so that you can at least see what causes the error? Also, check your Apache server log.

You'll also want to enable debugging before loading your own extension!

+2
source

Source: https://habr.com/ru/post/1397476/


All Articles