How to use eclipse PDT to debug a PHP program _php tutorial

Source: Internet
Author: User
Tags php debugger
This article is mainly about how to debug PHP code with eclipse PDT.
1. Download eclipse, find it on the official website, and verify that the current system has a Java environment, the JDK and the JRE.
2. Installed PDT, the use of an online installation, the update address is already included in the default. It's just more trouble to update. (Omit if you download the Eclipse version that carries PDT directly)
3. Download the debugger, the debugger has two kinds, one time xdebug, another time zenddebug, this article uses Xdebug.

The download should be the source code package. Unzip, then CD to the directory, then phpize, sometimes there may not be this program, run sudo apt-get install Php5-dev, on it. Then the familiar config program appears./configure a string of black-and-white screen characters, followed by Make,make install. When the latter two commands are executed, sudo permissions may be required because it involves copying the program files to the system directory.


4. Create a 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 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_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 placed in this directory will be loaded automatically by PHP.
At this point, the installation configuration for Xdebug has been completed.


5. Open Eclipse and select window preference to configure the service options first:
First configure debug, choose PHP Select Debug, PHP debugger selected as Xdebug. Then configure the server,
Select PHP Servers, and then pop up the menu: then click New, choose a name at name, and the URL is configured as the main URL for debugging.
Then set to default.
Finally configure PHP executables,add random name, path set to/usr/bin/php and then set the INI location in/etc/php5/apache2/php.ini
The SAPI type should be set to CGI, but it seems to be adjusting but not knowing why.
Finally, the PHP debugger will be set to Xdebug.
6. All ready, create a new PHP project, which can be found in your Apache, and then create a new PHP page, write a piece of code, plus a few breakpoints, and then right-click on the PHP page select Debug as Phpscript can see the familiar debug window, You can see the list of variables, the value of Post,get, and so on.

http://www.bkjia.com/PHPjc/788517.html www.bkjia.com true http://www.bkjia.com/PHPjc/788517.html techarticle This article is mainly about how to debug PHP code with eclipse PDT. 1. Download eclipse, find it on the official website, and verify that the current system has a Java environment, the JDK and the JRE. 2. Installing PD ...

  • 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.