Difference between revisions of "How to debug your code"

From Joomla! Documentation

m (New page: The simplest way for debug your code is create echo items for variables and output it into the screen. For expample, you want to now what value of the index item in for cycle: for ( $i = ...)
 
m
Line 22: Line 22:
  
 
If all options are correct you may run you script in debug mode by clicking on the Debug button (F8)
 
If all options are correct you may run you script in debug mode by clicking on the Debug button (F8)
 +
 +
[[Category:Development]]

Revision as of 23:25, 8 July 2008

The simplest way for debug your code is create echo items for variables and output it into the screen. For expample, you want to now what value of the index item in for cycle:

for ( $i = 0; $i < 10; $i++ ) { if ( $i == 5 ) { echo $i; } }

But this way is to hard for debug real code with more than 1000 lines of code. For this perpose better use debuggers plugged into the editors. For example it is PHP Expert editor with installed extension

add lines to the php.ini file:

extension=php_dbg.dll [Debugger] debugger.enabled=on debugger.profiler_enabled=off

profiler_enable better set to off, it is very deceleration option


Than you need set options in menu Run/Options menu to use HTTP-server and directory where your script located.

If all options are correct you may run you script in debug mode by clicking on the Debug button (F8)