Zend studio uses breakpoint debugging, zendstudio
1. Download Xdebug
2 |
# http://xdebug.org/download.php |
4 |
# Search for Xdebug downloads corresponding to your installed php version |
5 |
# For php in Windows, you can view the print information of the phpinfo () function and find "PHP Extension Build". Check that your PHP version is VC, |
2. Install
1 |
# Installation instructions |
2 |
# http://xdebug.org/docs/install |
4 |
# For Windows, after the download is complete, rename the downloaded dll file to php_xdebug.dll |
5 |
# Copy it to the PHP extension directory (for example: D: \ Program Files \ EasyPHP-5.3.2i \ php \ ext \) |
3. Modify php. ini.
01 |
# Add a section at the end of php. ini and restart Web-Server after modification. |
03 |
zend_extension= "D:/Program Files/EasyPHP-5.3.2i/php/ext/php_xdebug.dll" |
05 |
xdebug.profiler_enable=on |
06 |
xdebug.trace_output_dir= "E:/xdebug" Xdebug data file directory |
07 |
xdebug.profiler_output_dir= "E:/xdebug" Xdebug data file directory |
08 |
Xdebug. max_nesting_level = 10000; if it is too small, an error occurs when the number of recursive calls in the function exceeds the maximum number of embedded sets. |
10 |
xdebug.remote_enable= true ; Xdebug allows remote IDE connection |
11 |
Xdebug. remote_host = 127.0.0.1; IP address of zend studio that can be connected |
12 |
Xdebug. remote_port = 9000; reverse connect to the port used by zend studio |
13 |
Xdebug. remote_handler = dbgp; application layer communication protocol used for remote debugging of zend studio |
4. Modify Zend Studio settings
1 |
Window -> Preferences -> PHP -> Debug |
2 |
# Set "PHP Debugger" in "Default Settings" on the left to "XDebug" |
5. Create a new test. php file in the project.
View source print?
2 |
for ( $i = 0; $i < 10; $i ++) { |
6. Create a Debug command.
1 |
# Click the arrow next to "little spider" on the toolbar-> Debug As-> PHP Web Page |
2 |
# Will jump out of the Debug View |
3 |
# Add a breakpoint before the line "if ($ I = 5) {" to perform one-step debugging. |