Home > Backend Development > PHP Tutorial > How to use Eclipse PDT to debug PHP programs_PHP tutorial

How to use Eclipse PDT to debug PHP programs_PHP tutorial

WBOY
Release: 2016-07-13 10:28:29
Original
900 people have browsed it

This article mainly introduces how to use eclipse pdt to debug PHP code.
1. Download eclipse, just find it from the official website, and confirm that there is a java environment in the current system, that is, jdk and jre.
2. Pdt is installed, using online installation, and the update address is already included in the default. It's just more troublesome to update. (If you directly download the Eclipse version with PDT, you can omit it)
3. Download the debugger. There are two debuggers, one is xdebug and the other is zenddebug. This article uses xdebug.

What you downloaded should be the source code package. Unzip it, then cd to the directory, and then phpize. Sometimes this program may not be available, just run sudo apt-get install php5-dev and it will be fine. Then the familiar config program ./configure will appear. A series of black and white screen characters will appear, followed by make and make install. When the latter two commands are executed, sudo permissions may be required because they involve 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 and add the following configuration items. The configuration content 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_nesring_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

ini files placed in this directory will be automatically loaded by php.
At this point, the installation and configuration of xdebug has been completed.


5. Open eclipse, then select window preference, first configure the service options:
First configure debug, select php, select debug, and select php's debugger as xDebug. Then configure the Server,
Select PHP Servers, then pop up the menu: Then click new, select a name at Name, and configure the url as the main debugging url.
Then set it to default.
Finally configure PHP Executables, add a name, set the path to /usr/bin/php and then set the location of ini at /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 the PHP debugger to XDebug.
6. Everything is ready, create a new php project, these must be found in your apache, then create a new php page, write a piece of code, add a few breakpoints, then right-click the php page and select debug as phpscript to see When you get to the familiar debugging window, you can see the variable list, post, get values, etc.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/788517.htmlTechArticleThis article mainly introduces how to use eclipse pdt to debug PHP code. 1. Download eclipse, just find it from the official website, and confirm that there is a java environment in the current system, that is, jdk and jre. 2. Install pd...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template