Using NetBeans + Xdebug to debug the PHP program a few days ago, we found that using the DBGP plug-in of Notepad ++ and the xdebug extension of PHP can Debug PHP files. at the same time, the introduction includes single-step debugging, monitoring variables, and cross-file debugging. After configuring the debugging environment according to the network information, I tried it and found that the function was relatively simple and single file debugging was acceptable. it would be uncomfortable for cross-file debugging projects, during the trial, the DBGP plug-in uses NetBeans + Xdebug to debug the PHP program.
A few days ago, we found that using the DBGP plug-in of Notepad ++ combined with the xdebug extension of PHP, PHP can be used to debug PHP files. at the same time, we introduced single-step debugging, monitoring variables, and cross-file debugging. After configuring the debugging environment according to the network information, I tried it and found that the function was relatively simple and single file debugging was acceptable. it would be uncomfortable for cross-file debugging projects, during the trial, the DBGP plug-in has many defects, causing constant troubles and frequent stack overflow. Later, let's think about Np ++, which is just an Editor. don't force too much on it. the version of the plug-in is also relatively low, and many bugs are understandable. let's wait for it to be improved, the power of the open-source community is very powerful, ^.
I saw the familiar word "NetBeans" again in the blog of a comrade in the altar last night (the former development environment was chosen because NB was very powerful, feature settings were very user-friendly, and the interface was very friendly, there is also a very strong automatic completion function, it is almost necessary to decide it, but because at that time did not understand the xdebug, so did not understand how to debug, continue to use EP Ctrl + B to "debug" the program), add "xdebug" to google, and find that the NB debugging function is implemented through it and has complete functions, good comments. haha, big surprise. because it was too late to affect the rest of the roommates, I decided to discuss it the next day.
......
After coming back today, I made some effort in the development environment. the configuration process is as follows:
[My environment]
OS: Vista Business SP1 en_US
PHP: 5.2.8
Apache: 2.2.11
NetBeans: 6.5.1 PHP
? ?? ??? Http://www.netbeans.org/downloads/start.html? Platform = windows? = Zh_CN & option = php & version = 6.5.1
Xdebug: 2.0.4-5.2.8
? ?? ??? Http://www.xdebug.org/files/php_xdebug-2.0.4-5.2.8.dll
[Install Xdebug]
1. unzip the php_xdebug-2.0.4-5.2.8.dll to the ext folder under the php installation directory.
Local: D: \ Wamp \ php \ ext
2. modify php. ini and add the following content to the last position:
[Php]
Zend_extension_ts = "D: \ Wamp \ php \ ext \ php_xdebug-2.0.2-5.2.5.dll"
Xdebug. remote_enable = 1
Xdebug. remote_host = 127.0.0.1
Xdebug. remote_port = 9000
Xdebug. remote_handler = dbgp
[/Php]
Note: the value of zend_extension_ts is subject to your actual installation location. xdebug conflicts with zend_optimizer. please comment out/delete php. zend_optimizer-related statements in ini; xdebug. the value of remote_port must be the same as that of the NB tool> Options> debugger Port. the default value is9000;
3. in the Vista environment, when loading php through the apache module, executing the php script apache after loading xdebug will crash. if you want to debug the PHP program using xdebug normally, to change the PHP running mode to CGI, go to httpd. add the following content to conf:
[Php]
# LoadModule php5_module D:/Wamp/php/php5apache2_2.dll
# PHPIniDir "D:/Wamp/php /"
ScriptAlias/php/"D:/Wamp/php /"
Order allow, deny
Allow from all
# AddType application/x-httpd-php. php
AddType application/x-httpd-php. php
Action application/x-httpd-php "/php/php-cgi.exe"
Note: The comment is to load the PHP configuration statement in the module mode.
[/Php]
[Start debugging]
1. create and open a project
2. open the file to be debugged and set the breakpoint.
3. execute debugging in the top menu bar-> Debug "xxx. php", and select "server-side PHP" in the pop-up dialog box ". After you click "OK", NB will automatically use your default browser to open the file you want to debug, such as http: // localhost/Comsenz/UCenter_Home/index. php? XDEBUG_SESSION_START = netbeans-xdebug. At this time, you will find that the browser's request has not been returned, and the bottom right corner of NB shows "netbeans-xdebug is running", you can press F7 to debug the program normally.
If no breakpoint is set, the program will automatically pause execution in the first line of the current file when debugging is executed. If you do not want to automatically pause the execution, deselect the tool-> option-> PHP-> stop on the first line.
4. for form processing debugging, you can execute debugging-> debug the project. the subsequent operations are similar. However, if you execute the script where you set the breakpoint, the NB will be automatically interrupted at the breakpoint, wait for debugging!
5. for details, refer to the NB official debugging guide http://www.netbeans.org/kb/docs/php/debugging_zh_CN.html.
[Reference site]
Http://www.netbeans.org/downloads/index.html (NetBeans download)
Http://www.xdebug.org/download.php (Xdebug download)
Http://www.my400800.cn
?
1. open the project and set the cutoff point. JPG
?
2. Execute. JPG
?
32.16.jpg
?
42.16.jpg
?
1. "xdebug conflicts with zend_optimizer. please comment out/delete the zend_optimizer-related statements in php. ini"
? ? I don't know which statements are related to zend_optimizer. can you give them in detail?
2. my Windows operating system
? ?? ?? ?? ??? PHP 5.2.9
? ?? ?? ?? ??? In Apache 2.11
? ?? ?? ?? ??? For MYSQL 5.1
I don't know if the configuration method is the same as that of the landlord.
3. I also like the development mode of NetBeans, but xdebug is always hard to debug and has been done many times according to the instructions on the Internet.
Still not good ?? In the early stage, I finally chose to give up ?? I am very grateful for reading the specific configuration method posted by the landlord.
Two questions ?? Hope you can get the fastest and most detailed reply from the landlord ?? Thank you very much.
?