XDebug from host to Vagrant VM?
Hi, this case is similar to this one and I tried a few of the solutions, but my debug configuration for the VM does not even get started. I have tried things on my Intellij Idea 11.1, and a couple of trials for PHPstorm 6 and Intellij 12 to no avail. Here is my scenario:
- Vagrant precise32 VM (see vagrantup.com)
- Configured a forwarded port from guest 80 to host 4567 -- This is the vagrant default port mapping for http, and it does work fine.
- Configured a forwarded port from guest 9000 (default xdebug port) to a specific host port -- tried 4568, 33234, 9000
- Created a Web Application debug configuration, created Web server config that points to port 4567.
Once all the above is done, I hit debug and I get the following odd behavior:
- In both Intellij editors I get "Error running debugger port NNNN is busy" and the session cannot even start. This happens independently of whether I choose any of the above three ports (4568, 33234, 9000)
- In PhpStorm, I get no message, the debugger starts, but breakpoints are not hit.
Troubleshooting steps so far, to no avail:
- Tried different ports, up to and including mapping the guest 9000 to host 9000, so no need to mess with Project Settings / PHP / Xdebug.
- Created tcp/udp firewall rules on the host to open up passage for all the above ports. -- Still, see no point in this as the VM is using a local port mapped.
- Turned off firewall on host.
- Made sure that VM is not running any firewall, by verifying that there are no iptables rules defined -- Note that both ssh / http work fine.
- Tried a couple of the solutions listed on the above thread, but all to no avail. I do believe that likely the vagrant VM because it is using port mapping behaves differently than the scenario described in the thread I listed.
Anyhow, any help would be appreciated.
Thanks
Please sign in to leave a comment.
Hi there,
I have not worked with vagrant myself, so cannot give you 100% correct advice.
In any case, please check these links -- maybe they will help you to notice what you possibly may have missed:
As for debugging approach, I always recomment this manual/article -- have a look in case you have not seen it yet: http://confluence.jetbrains.com/display/PhpStorm/Zero-configuration+Web+Application+Debugging+with+Xdebug+and+PhpStorm
Thanks Andriy, the first link clued me into the problem and the solution which consisted of two fixes:
Once the above two fixes were put in place, things worked on both PhpStorm and Intellij Idea.
xdebug.remote_enable=1
xdebug.remote_host=10.0.2.2
xdebug.profiler_enable=true
xdebug.profiler_output_dir="/tmp"
http://www.virtualbox.org/manual/ch06.html#natforward
Pierre