Using NetBeans + Xdebug to debug PHP programs

Source: Internet
Author: User
Tags netbeans

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 platform = 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 /"
<Directory D:/Wamp/php/>
Order allow, deny
Allow from all
</Directory>

# 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)

Original article:Http://www.zvv.cn/blog/show-101-1.html

[This post was last edited by zwws]


1. Open the project and set the cutoff point. jpg


2. Execute. jpg


32.16.jpg


42.16.jpg


52.16.jpg

Little Z is always so detailed in writing. Top!
PS: the owner's profile picture is thunder1. "xdebug will conflict 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.
I still can't do it. I finally chose to give up reading the specific configuration method published by the landlord. I am very grateful, but there is still the above.
I hope I can get the fastest and most detailed reply from the landlord to the two questions. Thank you very much for writing so much detail to sejie10011 (11:07:11. Top! Zwws (12:22:52) 1. Haha, the solution to the problem is very important. If you know how zend_optimizer is installed, will the problem be solved?
I found this article on google using "zend_optimizer php. ini ".
Http://ideacm.com.cn/read.php? 12
So you just need to comment out the related statements mentioned in the article in the local php. ini file. It is actually the "zend_Optimizer." hitting statement. Of course, the premise is that you have installed zend_optimizer.

2. xdebug 2.0.4 supports PHP 5.2.9. Zwws (12:24:14) doubantao. Niohe (22:43:54) Thank you for your advice !! Iminto (19:58:07) supports the construction of the main bowl of Tea (17:02:32) zend optimizer and xdebug can coexist qgymje (11:56:53). I would like to ask about this situation.
Http://bbs.phpchina.com/thread-149075-1-1.html
After debugging, you can't use zhenjiangdeni (14:42:03) as the main poster. I have followed the configuration you mentioned. Why? ide always shows waiting for connection (netbeans-xdebug ). there is no way to debug luzhou (19:29:22! Luzhou (19:31:05) http://zh-cn.netbeans.org/kb/docs/php/debugging.htmlgguoyu (20:58:24) Reply 12 #Zhenjiangdeni

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.