Sven/PHP

From Organic Design wiki
Revision as of 21:37, 8 December 2007 by Sven (talk | contribs)

Debugging PHP

In MediaWiki there is a profiler that can be set, see MW:How to debug.

Debuggers generally use a W:Stack trace. This can be approximated by using print and die statements in sections of code.

The combination of print_r and func_get_args allows you to return an array of args that a function was called with;

print_r(func_get_args());


PHP errors

To see PHP errors, add this to the very top of LocalSettings.php:

error_reporting(E_ALL);
ini_set("display_errors", 1);