This article mainly records how to solve the problem of zendstudio communicating with xdebug in the Virtual Machine xdebug environment, so as to resolutely display the 57% progress bar on the debugging interface: this article mainly records how to solve the problem of zendstudio communicating with xdebug in the Virtual Machine xdebug environment, so as to resolutely display the 57% progress bar on the debugging interface:
Script ec (2); script
Symptom: zend studio xdebug 57% waiting for xdebug session
The development environment of the author is usually a windows host machine + vmare Linux Virtual Machine. the linux samba function shares the directories under the virtual machine to windows for disk ing, such a development environment can quickly implement a complete Linux code debugging environment in windows.
When xdebug is installed for php to debug code under the virtual machine today, xdebug is configured according to the online steps, because the network of my virtual machine environment is NAT.
The network segment of the linux virtual machine is 192.168.2.0/255.255.255.0, And the gateway is 192.168.2.2.
The network segment of the windows host machine is 192.168.1.0/255.255.255.0.
When a windows browser accesses the http service under the virtual machine, it is forwarded through the nat virtual network card of vmare. The p bound to this network card is 192.168.2.1. Then the problem arises. The ip addresses of all requests obtained under the virtual machine are 192.168.2.1, and the network is blocked when the request for xdebug is obtained and the information is forwarded to zend studio. The xdebug port I set is 19000, as shown in the following figure:
We can see that our request is sent to port 19000 of 192.168.2.1, but this is stuck because the syn_sent process is not working and php cannot connect to zend studio on the windows host. As long as the problem is located, the fastest solution is to enable iptables port forwarding and forward all data sent to port 19000 of 192.168.2.1 to the host machine IP address 192.168.1.105.
We use root to configure the following iptabless rules:
Iptables-t nat-a output-p tcp-d 192.168.2.1 -- dport 19000-j DNAT -- to 192.168.1.105: 19000
In this way, zend studio can easily receive xdebug debugging data from php.
The virtual environment in the NAT network mode is quite painful. If you switch to the Bridge Mode to make the host machine and the virtual machine have the same network segment, the problem can be solved.