Setting up the working xdebug on a virtual guest is the same as setting up the debug for the remote server.
Our setup is the following:
- Fedora desktop running a VirtualBox instance
- Fedora virtual guest on the same desktop running via the a virtual bridge
- Netbeans php project on desktop
First of all, make sure the xdebug is installed:
$ rpm -aq|grep xdebug php-pecl-xdebug-2.2.3-1.fc14.remi.1.i686
Configure the ini file:
zend_extension=/usr/lib/php/modules/xdebug.so xdebug.remote_enable = on xdebug.remote_autostart = on xdebug.remote_handler = dbgp xdebug.remote_port = 9000 <h1>The address of the current virtual guest on the network</h1> xdebug.remote_server = [GUEST_NETWORK_ADDRESS] xdebug.remote_mode = req output_buffering = off xdebug.remote_log = "/var/log/xdebug.log" <h1>Must be same as in Netbeans configuration</h1> xdebug.idekey = "netbeans-xdebug"
Restart Apache server on guest in case of fixes made.
$ sudo service httpd restart
Check the Netbeans configuration to match the above
We will need a tunnel for the whole thing to work. Open a new terminal on your desktop and run the following:
$ ssh -R 9000:[VIRTUAL_BRIDGE_IP]:9000 [USER_NAME]@[GUEST_NETWORK_ADDRESS]
Check it another terminal window on desktop, the output should look like the below:
$ netstat -a -n | grep 9000 tcp 0 0 [VIRTUAL_BRIDGE_IP]:41610 [VIRTUAL_BRIDGE_IP]:9000 ESTABLISHED tcp6 0 0 :::9000 :::* LISTEN tcp6 0 0 [VIRTUAL_BRIDGE_IP]:9000 [VIRTUAL_BRIDGE_IP]:41610 ESTABLISHED
Now the xdebug should become to be available in Netbeans like the below: