xdebug_php Example of PHP remote debugging

Source: Internet
Author: User
I use xdebug in the development of the local debugging, but recently joined some projects, the environment is too complex, to build a development environment in the local is really too troublesome, then how can we use Xdebug to remote debugging?

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

1. Virtual machine ip:192.168.174.130, virtual machine for building LAMPP environment

2. Physical machine ip:192.168.174.1, this is the IDE's development environment.

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

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

Here in order to facilitate the vhosts set a domain name, this need to modify the physical machine/etc/hosts before access:

192.168.174.130 www.test.com

The key step is to set the php.ini in the virtual machine to support Xdebug remote debugging, adding the following code:

The most critical two settings xdebug.remote_host and xdebug.remote_connect_back,remote_host to be set to the server Ip,remote_connect_back to be set to 1 or on

Here, the server is set up, next we set up the IDE, please forgive me is an IDE tool party. I use the IntelliJ idea, and the Phpstorm settings are the same.

First set up the project's server

In the host to fill in, to normal access to the address of the virtual machine server, we previously set the virtual domain name is www.test.com, so I also wrote this picture.

The most critical setting is to hook up the path map, and then write the file that needs to be debugged on the server, such as I need to debug a.php, and on the virtual machine server we set the Web directory is/data/web/, then it should be mapped to the path is/data/web/ It's a.php.

After everything has been set up, you can start with the local debugging as well.

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

The above content to share the PHP remote debugging Xdebug related knowledge, I hope you like.

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