Phpdebug debugging tool. Its Project address: php Tutorial-debug-toolsfreshmeat.netprojectsphp-debug-tools File: freshmeat. neturls7c58ae3fecce5763e7546b958d36e082 is currently version 1.03 its Project address: php Tutorial-debug-tools/"> http://freshmeat.net/projects/php-debug-tools/
File: http://freshmeat.net/urls/7c58ae3fecce5763e7546b958d36e082
Version 1.03
The environment here is Windows xp, apache2.2, php5.2 + zend optimizer,
Here, we will use the help document of php debug tools to explain some of the figures are taken from the document.
I. Installation
Preparations before installation: x-debug must be installed first,
See http://www.xdebug.org/docs/install for how to install x-debug
1. download your x-debugversion from http://www.xdebug.org/download.php
2. decompress the dll file to the ext directory under the php installation directory, such as c:/php/ext/php_xdebug-2.0.4-5.2.8-nts.dll
3. modify the php. ini file and add the following content:
------------- Even abnormal split line, you cannot see me ------------------------
Zend_extension = "c:/php/ext/php_xdebug-2.0.4-5.2.8-nts.dll"
Xdebug. collect_effecdes = off
Xdebug. default_enable = off
Xdebug. dump_globals = off
Xdebug. dump_once = off
Xdebug. extended_info = off
------------- Even abnormal split line, you cannot see me ------------------------
Note: this example is for non-thread safe version. for the thread safe version change "zend_extension" to "zend_extension_ts"
After installation, decompress all the files in the php debug tools package to the website release directory.
(Assume that the release directory is c: www, then create a new debug directory and throw all the files into it)
Enter: http: // localhost/debug/test1-debug.php in the browser
If yes, the installation is successful.
II. debugging
1. debug errors
Run the following code:
The code is as follows:
Require './lib/debug. php ';
Function test ($ a, $ B)
{
Echo $ asd;
}
Test (10, 'ABC ');
?>
2. debug with debug ()
Run the following code:
The code is as follows:
Require './lib/debug. php ';
Function test ($ args)
{
Test_nested ($ args );
}
Function test_nested ($ args)
{
Debug ($ args );
// Or: debug (get_defined_vars ());
// Or: debug ();
}
Test (array ('id' => 123, 'str' => 'test '));
?>
3. debug with dump () or dump_tofile ()
Run the following code:
The code is as follows:
Include_once './lib/dump. php ';
Function test5 ()
{
Include './testdata/test0.php ';
$ Test = array ('int' => 1, 'float' => 2.0, 'float2' => 2.1 );
Dump ($ test, $ _ server );
}
Function test1 () {test2 ();}
Function test2 () {test3 ();}
Function test3 () {test4 ();}
Function test4 () {test5 ();}
Test1 ();
?>
Dump_tofile () is generally used in the following scenarios:
A. When you don't want to stop running the program
B. You don't want to display the adjustment data, but you don't. for example, when you are in the ajax request status.
C. You want to adjust it in multiple places
See the test7-dump_tofile.php in the debug Directory
Note: When I run dump () or dump_tofile (), I find that the php debug tool documentation does not appear.
Here we can modify the debug/lib/debug. php code to correct it. (because dump_tofile () has been called to dump (), we only need to modify one.
At 149 rows
Echo $ pre;
Modify:
// Edit by benben --- start
Echo'