[Original] PHP + Xdebug remote debugging

Source: Internet
Author: User
Tags zts
[Original] PHP + Xdebug remote debugging previously thought that the server and IDE must be on the same server during php debugging. it was not intended to find that xdebug actually supports remote debugging.

After trying it, I found that the configuration was successful, and I still felt comfortable debugging the code!

Ubuntu server where php is located: 192.168.10.XXX

Windows development machine (Zend as IDE): 192.168.40.XXX

PS: PHPStorm can also be configured successfully. I prefer Zend, so take zend as an example.

1. install the php xdebug plug-in on the server

Compile xdebug using php and put it in the php plug-in Directory

/Opt/php/lib/php/extensions/no-debug-non-zts-20121212/xdebug. so

2. configure php. ini

[Xdebug]

Zend_extension = "/opt/php/lib/php/extensions/no-debug-non-zts-20121212/xdebug. so"

Xdebug. remote_enable = 1

Xdebug. remote_handler = dbgp

Xdebug. remote_host = 192.168.10.XXX hosts the server IP address.

Xdebug. remote_port = 9009 conflict between the default port 9000 and the php-fpm, changed to 9009

Xdebug. remote_connect_back = 1

Xdebug. remote_autostart = 0

※After modification, restart the web server.

3. install Zend in windows development

4. configure Zend

1) configure PHP Servers

Start a Server name, set the Debugger mode to Xdebug, and finally set the Startup directory

Switch to the second tab to configure the correspondence between the server directory and the local code directory. (Key steps)

Note: I use samba to make windows and ubuntu use the same code. if the local code is inconsistent with the server, it is unclear what will happen!

2) configure xdebug

Because the default port number of xdebug is changed to 9009, you also need to change it to 9009 here.

3) confirm the debug mode of php

The PHP Server here should be the Server name configured previously.

4) Change the default browser to chrome. The default built-in browser behavior is weird. chrome is recommended.

5. configure the debug startup item

Confirm whether the Debugger is configured as xdebug

6. confirmation result

Click in front of the code line to be debugged, place the breakpoint, refresh the browser, and check whether the breakpoint is in.

If there is no problem, it will go to the breakpoint

Above

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.