Skip to content

Instantly share code, notes, and snippets.

@roscius
Forked from dhrrgn/VagrantXDebug.md
Last active May 23, 2017 20:11
Show Gist options
  • Select an option

  • Save roscius/ade3cfd1f9864f761f761156391e6ef1 to your computer and use it in GitHub Desktop.

Select an option

Save roscius/ade3cfd1f9864f761f761156391e6ef1 to your computer and use it in GitHub Desktop.

Configure

xdebug.ini

/etc/php/7.1/mods-available/xdebug.ini <--inside the vagrant box

xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
xdebug.idekey=vagrant     
xdebug.remote_host=10.0.2.2

The remote_host is the IDE's host ip from the vagrant box. 10.0.2.2 seems to be the default...i think, works for me.

In PHPStorm

Setup Server

Add Debug Configuration

Run > Edit Configurations...

Browser - Start Debugging

Create a bookmarket - use IDE Key VAGRANT (as above)

https://www.jetbrains.com/phpstorm/marklets/

Set a breakpoint

Click Listen for Debug Connections in Tool Bar

Click Bookmarket in Browser

Load page

Command Line - Start Debugging

Run > Debug...

Set a breakpoint

Run your command, then switch to PHPStorm

Profit!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment