openDebug
a php debugger
SourceForge.net Logo
News
Download
Documentation
Contact
Documentation

1) Installation

Download the latest release and unzip it in your PHP directory. This can be your include directory (recommended).

2) Quick start

Include/require opendebug.php within your main PHP file.
Make a new instance of openDebug.
Set access for IP addresses other than the local host, or disable the access filter (not recommended).
Output the HTML with the getOutput() function, right after your last HTML code but before the </body> tag.
<html>
<body>
<?php
// include opendebug
require("path/to/opendebug/opendebug.php");
							
// make new object
$debug = new openDebug();
// add IP address
$debug->addIP("213.73.136.219");
$debug->addIP("rogerwilco.homelinux.com");
							
// NOT RECOMMENDED
// $debug->setFilter(false);

/* your own PHP/HTML code comes here */
// output
echo $debug->getOutput();
?>
</body>
</html>
Browse your webpage you want to debug, and press tilde (~) on your keyboard. A screen will appear with information you can use to debug your flow.

3) Advanced functions

The default database is MySQL. To setup openDebug for Postgres, simply add the following code:
<?php
$debug->setDatabase("postgres");
?>
To write custom messages in the message log, use the function writeLog(String type,String message) where type is notice or warning.
<?php
$debug->writeLog("notice","this is a notice");
?>
You can enable source viewing with the function setShowSource(Bool). Default is false. It is recommended to enable source viewing only when the access filter has been set.
<?php
$debug->setShowSource(true);
?>
4) Querying and caching results

openDebug can query a database for you and automatically cache the results so you can browse it. It is useful to know exactly which rows were returned by your query.
<?php
$resource = $debug->query("SELECT foo FROM bar",__LINE__);
?>
First parameter is the actual query, second parameter is always __LINE__. This is required for openDebug to know which line the query was called.
The query function returns a resource identifier just like a normal query would do, with the exception that it caches any SELECT results.
You can browse the results in the Query result window.
Valid XHTML 1.0!