Web Projects Outsourcing

Xdebug in Netbeans for a VirtualBox Guest Host

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:

  1. Fedora desktop running a VirtualBox instance
  2. Fedora virtual guest on the same desktop running via the a virtual bridge
  3. Netbeans php project on desktop

First of all, make sure the xdebug is installed:

$ rpm -aq|grep xdebug

Configure the ini file:

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

Netbeans config for php xdebug

Netbeans config for php xdebug

We will need a tunnel for the whole thing to work. Open a new terminal on your desktop and run the following:


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:

xdebug working in Netbeans on virtual guest

xdebug working in Netbeans on virtual guest

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.