PHP remote debugging-XDEBUG: xdebug_PHP debugging tutorial

Source: Internet
Author: User
Tags php server
Remote debugging of PHP: XDEBUG. XDEBUG for PHP remote debugging. I used xdebug for local debugging during XDebug development. However, recently I joined some projects, and the environment was too complex, you need to build a local PHP remote debugging XDEBUG to debug xdebug.

During development, I used XDebug for local debugging, but recently I joined some projects and the environment was too complicated. it was really too troublesome to build a local development environment, so how can we use xdebug for remote debugging?

Here I use a virtual machine to build a simulated environment to illustrate the experiment:

1. Virtual Machine IP address: 192.168.174.130, which is used to build a lampp environment

2. Physical Machine IP address: 192.168.174.1, which is the IDE development environment.

First, I installed a lampp in the virtual machine and added a vhosts, as shown below:

vim /opt/lampp/etc/extra/httpd-vhosts.conf
 
    ServerAdmin webmaster@dummy-host.example.com  DocumentRoot "/data/web"    
  
           Options All        AllowOverride All        Require all granted    
    ServerName www.test.com  ErrorLog "test-error_log"  CustomLog "test-access_log" common
  

In order to set a domain name for vhosts, you need to modify the/etc/hosts of the physical machine before accessing it:

192.168.174.130 www.test.com

In the key step, we need to set php. ini in the virtual machine to support xdebug remote debugging. the following code is added:

vim /opt/lampp/etc/php.inizend_extension="/opt/lampp/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so"[xdebug]xdebug.default_enable=1xdebug.remote_enable=1xdebug.remote_handler=dbgpxdebug.remote_host=192.168.174.130xdebug.remote_port=9000xdebug.remote_connect_back=1xdebug.remote_autostart=1 

The two most critical settings are xdebug. remote_host and xdebug. remote_connect_back. remote_host must be set to the server ip address, and remote_connect_back must be set to 1 or on

Now, the server is set up. next we will set the ide. forgive me for being an ide tool party. I use Intellij IDEA, and PHPStorm settings are the same.

First, set the project's server

Enter the address of the VM server that can be accessed normally in the Host field. the previously set virtual domain name is www.test.com, so this is also written in my figure.

The most critical setting is to check the path ING and write the file to be debugged into the path on the server. for example, I need to debug. php, and the web Directory we set on the VM server is/data/web/, then the ing path should be/data/web/. php.

After all the settings are complete, you can start the process like local debugging.

OK, there is no technical content, but I hope to help my friends who need it, pay attention to the IP address in the article, modify the address of your own server.

The above content will share with you the knowledge about remote PHP debugging XDEBUG. I hope you will like it.

Articles you may be interested in:
  • Install and use php Xdebug debugging extension.
  • Use XDebug debugging and unit test coverage rate analysis
  • Using NetBeans + Xdebug to Debug PHP programs
  • Php performance optimization analysis tool XDebug large website debugging tool
  • Resolve phpstorm + xdebug remote breakpoint debugging
  • Parsing VS2010 using the VS. PHP plug-in to Debug PHP
  • How to Debug PHP using FireFox plug-in FirePHP
  • Use Zend Studio + PHPnow + Zend Debugger to build a PHP server debugging environment
  • Phpstorm configuration Xdebug debugging PHP Tutorial
  • Solve ThinkPHP errors reported when the debug mode is disabled.

During development of idea, I used XDebug for local debugging, but recently I joined some projects and the environment was too complicated. I had to build a local development project...

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.