Eclipse for php + Xdebug build a PHP debugging environment

Source: Internet
Author: User
Tags php debug php debugger vc9

Eclipse for php + Xdebug build a PHP debugging environment

 

Step 1: Go to the Eclipse official website to download PHP-Eclipse: http://www.eclipse.org/downloads/packages/eclipse-php-developers/heliossr1

Step 2: Download Xdebug (at: http://xdebug.org/download.php, my phpbench is PHP 5.3.28 Thread Safety, Apach is 2.2.25, the port number is 8080), The Xdebug version I downloaded is php_xdebug-2.2.3-5.3-vc9.dll, and put it in the PHP/ext directory.

 

Step 3: Find php. ini in PHP5 and add the following configuration information at the end of the file:

Zend_extension = D: \ php \ ext \ php_xdebug-2.2.3-5.3-vc9.dll

; Zend_extension_ts = D: \ php \ ext \ php_xdebug-2.2.3-5.3-vc9.dll

; Extension = php_xdebug-2.2.3-5.3-vc9.dll

[Xdebug]

Xdebug. auto_trace = On

Xdebug. show_exception_trace = On

Xdebug. remote_autostart = On

Xdebug. remote_enable = On

Xdebug. collect_vars = On

Xdebug. collect_return = On

Xdebug. collect_params = On

Xdebug. trace_output_dir = "D:/xDebugLog"

Xdebug. profiler_output_dir = "D:/xDebugLog"

Xdebug. profiler_enable = On

Xdebug. remote_host = localhost

Xdebug. remote_port = 9000

Xdebug. remote_handler = dbgp

 

Note: if there are other zend_extension_ts files in the file, comment them out. Otherwise, apache cannot be started.

 

Step 4: start apache.

 

Step 5: Find "PHP Debug" in the Properties of the eclipse project and select "XDebug" in the PHP Debugger"

 

Step 6: Configure PHP Servers in Windows> Preferences.

Step 7: Configure PHP Executables in Windows> Preferences.

Step 8: in Run-> Debug mappings, check that the configuration of Path Mapping is consistent with that in Step 6.

 

Next, go to the debug interface and start to set the breakpoint for debugging.

 

Configuration problems:

 

1. Xdebug is not found in phpinfo (); printed information.

Solution: in the php. ini file, make the following changes:

Zend_extension_ts = D: \ php \ ext \ php_xdebug-2.2.3-5.3-vc9.dll

[Xdebug]

Xdebug. auto_trace = On

 

To:

; Zend_extension_ts = D: \ php \ ext \ php_xdebug-2.2.3-5.3-vc9.dll

Extension = php_xdebug-2.2.3-5.3-vc9.dll

[Xdebug]

Xdebug. auto_trace = On

 

2. Add a breakpoint to the code, but the breakpoint is invalid and cannot be stopped.

Solution: in the php. ini file, make the following changes:

; Zend_extension_ts = D: \ php \ ext \ php_xdebug-2.2.3-5.3-vc9.dll

Extension = php_xdebug-2.2.3-5.3-vc9.dll

[Xdebug]

Xdebug. auto_trace = On

 

To:

Zend_extension = D: \ php \ ext \ php_xdebug-2.2.3-5.3-vc9.dll

; Zend_extension_ts = D: \ php \ ext \ php_xdebug-2.2.3-5.3-vc9.dll

; Extension = php_xdebug-2.2.3-5.3-vc9.dll

[Xdebug]

Xdebug. auto_trace = On

 

My php version is obviously Thread safe, but zend_extension_ts is used here, but it cannot be understood.

 

3. the breakpoint can only take effect on the first line, and the rest cannot be stopped.

Solution: Refer to Step 5 above and select Use MultiSession. Refer to Step 8 above to confirm the configuration of Path Mapping.

 

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.