This article describes how to install, debug, and configure xdebug for eclipse and pdt, and use eclipsepdt to Debug PHP code at breakpoints. 1. download eclipse, find it on the official website, and confirm that there is a java environment in the current system, that is, jdk and jre.
2. after pdt is installed, online installation is used. the update address is included by default. But it is difficult to update. (If you directly download the Eclipse version with PDT, you can omit it)
3. download the debugger. There are two types of Debugger: xdebug and zenddebug. xdebug is used in this article.
The downloaded source code package is used. Decompress, then cd to the directory, and then phpize, sometimes this program may not be available, run sudo apt-get install php5-dev, you can. Then a series of black and white screen characters will appear in the familiar config program./configure, and then make and make install. The sudo permission may be required when the last two commands are executed, because it involves copying program files to the system directory.
4. create an xdebug. ini file in/etc/php5/apache2/conf. d/. you can use vi or other text programs to add the following configuration items. The configuration is as follows:
The code is as follows:
[Xdebug]
Zend_extension = "/usr/lib/php5/20090626 + lfs/xdebug. so"
Xdebug. remote_handler = dbgp
Xdebug. remote_port = 9000
Xdebug. auto_trace = on
Xdebug. collect_params = on
Xdebug. collect_return = on
Xdebug. max_nestring_level = 100
Xdebug. profile_enable = on
Xdebug. remote_enable = on
Xdebug. remote_host = localhost
Xdebug. trace_output_dir = "/tmp"
Xdebug. profile_output_dir = "/tmp"
Xdebug. idekey = webide
Xdebug. mode = req
The INI file in this directory will be automatically loaded by php.
So far, the installation and configuration of xdebug have been completed.
5. open eclipse, select window preference, and configure service options first:
Configure debug first, select php and debug, and select php's debugger as xDebug. Then configure the Server,
Select PHP Servers and click new in the pop-up menu. select a Name in the Name field and configure the url as the main url for debugging.
Set it to default.
Finally, configure PHP Executables and add any name. set path to/usr/bin/php and set the ini location in/etc/php5/apache2/php. ini.
The SAPI Type should be set to CGI, but it seems that it cannot be adjusted. I don't know why.
Finally, set PHP debugger to XDebug.
6. everything is ready. create a php project, which can be found in your apache, create a php page, write a piece of code, and add several breakpoints, right-click the php page and select debug as phpscript to view the familiar debugging window. you can see the variable list, post, and get values.