knuspermagier.de
Der privateste Blog von Philipp.

How to fix Xdebug, Virtual Machines and PHPStorm.

I'll confess: I'm a var_dump-debugger.

But sometimes it comes in really handy to have a real debugger at hand. Unfortunately it took me some time to figure out what I need to do to allow the Xdebug in my virtual environment to talk to PHPStorm. There are a lot of tutorials, but all I read miss one critical thing:

ssh -R 10000:localhost:10000 vagrant@funnyvagrantvm.local

Yes. Assuming your xdebug.remote_port is 10000, you'll have to open a SSH tunnel from your host machine to your virtual machine. (Maybe you don't need this if you configured your VM in a more open way, then all the other tutorials may be enough.)

Bonus content: My xdebug.ini:

zend_extension=xdebug.so
xdebug.remote_enable = 1
xdebug.remote_connect_back = 0
xdebug.remote_port = 10000
xdebug.remote_autostart = 1
xdebug.idekey = phpstorm
xdebug.max_nesting_level = 250

Especially xdebug.remote_autostart is nice when you need to debug your integration tests that test against your HTTP API.

Kommentare, Feedback und andere Anmerkungen?
Schreib mir eine E-Mail 🤓