Eclipse + php plug-in + Xdebug PHP Development/debugging environment Guide

Source: Internet
Author: User
Eclipse + php plug-in + Xdebug PHP perfect development/debugging environment Guide recently began to use the Zend framework to develop medium-sized application systems. due to the use of a fully object-oriented framework to develop programs, in addition to development ideas, the previous Editplus + Dreamweaver editor combination obviously cannot meet my requirements. Eclipse + php plug-in + Xdebug is a perfect PHP Development/debugging environment Guide.

Recently, the Zend Framework has been used to develop medium-sized application systems. because the development of programs is based on a fully object-oriented framework, the previous Editplus + Dreamweaver editor combination obviously cannot meet my requirements. My new environment is initially set to Eclipse + PDT plug-in + Xdebug + apache (the most popular WEB server platform on Unix ).

Previously, I had been envious of the automated functions of dotNET and Java IDE such as automatic code sniffing, code prompts, and program breakpoint debugging. However, I can only use echo and var_dump () to debug the program by writing my own PHP code, can PHP also implement breakpoint debugging? The Debug option was previously found in the PHP plug-in of Eclipse, indicating that the debugging function should be feasible, but I don't know how to configure it, I ran to google to find information and found that there was not a complete configuration document. I had to splice the information and then test it.

The result is: PHP breakpoint debugging is perfect!

========================================================== ==================

This article is a series of original articles. for reprinted articles, please indicate the place where the articles are originated from thoughts. author: sin in the haze

========================================================== ==================

The detailed process is as follows.

Step 1:

1. first download and install the corresponding software

Jdk is absolutely necessary. it is the most basic requirement for running Eclipse. download it here.

Eclipse integrates the PHP development plug-in version. download it here, select the version of your own operating system, and then download it to your local computer.

XDebug is downloaded here. select a file to download based on your PHP version.

Apache (the most popular WEB server platform on the Unix platform) + PHP module installation method is recommended.

2. software installation

After installing JDK, configure the system variables as follows:

The second is to install Eclipse. Eclipse does not need to be set. as long as JDK is set up, Eclipse can be directly run at any location.

Finally, install Xdebug

I am using PHP5.2.5, the downloaded xdebug file name is: php_xdebug-2.0.3-5.2.5.dll, put the file under the php/ext folder

?

Xdebug configuration

Open php. ini

Add the following configuration code to the last line. The Configuration instructions are commented out.

; Load Xdebug

Zend_extension_ts = "c:/php/ext/php_xdebug.dll"

; Xdebug configuration

[Xdebug]

; Enable automatic tracking

Xdebug. auto_trace = On

; Enable exception tracking

Xdebug. show_exception_trace = On

; Enable automatic start of remote debugging

Xdebug. remote_autostart = On

; Enable remote debugging

Xdebug. remote_enable = On

; Collect variables

Xdebug. collect_vars = On

; Collect return values

Xdebug. collect_return = On

; Collect parameters

Xdebug. collect_params = On

Note that the path after zend_extension_ts must be an absolute path. after saving the file, restart the server.

Use phpinfo () to view the php configuration. if the installation is successful, you can see the following information:

The following is the eclipse configuration

For detailed configuration, see the description (click to enlarge all images)

Eclipse global configuration: (click to enlarge)

  

Test Server configuration: click PHP Server... in the window above (click to enlarge)

  

PHP project overall configuration: After opening or creating a php project, right-click the project and select Properties (click to enlarge to view details)

     

After the configuration is completed according to your actual requirements, the overall debugging environment is fully configured. start enjoy!

The following describes how to start debugging.

1. first open the page you want to debug. here I will use index. php on the emlog homepage as an example.

In the eclipse menu, select the sequence as shown in the figure:

  

At this time, eclipse will start the debug interface. EFFECT: (click to enlarge)

  

If your server is correctly configured, the browser will pop up and you will see the program page.

Now let's focus on the cool PHP breakpoint debugging function.

Right-click the line where you want to set the breakpoint and select Toggle Breakpoints

  

After setting, start debug again.

The following is an example (click to enlarge)

  

?

Someone will ask, this is the homepage. what if the page I want to debug contains parameters or cannot be accessed directly?

The answer is simple. you only need to set a breakpoint on the page for debugging, start any page that can be accessed directly during debugging, and click the page you want to access from the page, you can also access the page that calls the file you want to debug. eclipse automatically jumps out when the breakpoint is running, and then you can start debugging.

This article comes from WEB development network original article link: http://www.cncms.com.cn/php/14008_3.htm

?

?

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.