Skip to content

Instantly share code, notes, and snippets.

@dhrrgn
Last active July 7, 2023 19:02
Show Gist options
  • Star 39 You must be signed in to star a gist
  • Fork 12 You must be signed in to fork a gist
  • Save dhrrgn/ba29568b23c22bfcb148 to your computer and use it in GitHub Desktop.
Save dhrrgn/ba29568b23c22bfcb148 to your computer and use it in GitHub Desktop.

Configure

xdebug.ini

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...

Start Debugging

Run > Debug...

Set a breakpoint

Run your command, then switch to PHPStorm

Profit!

@aczietlow
Copy link

First off ++ for taking the time to document this.

According to the xdebug documentation http://xdebug.org/docs/all_settings

When xdebug.remote_connect_back is enabled xdebug.remote_host is ignored. remote_connect_back attempts to connect back to the ipaddress of any http request.

** Please note that there is no filter available, and anybody who can connect to the webserver will then be able to start a debugging session, even if their address does not match xdebug.remote_host. **

Once more, thanks for taking the time to write this in a gist and know that you are an awesome human being.

@k-zakhariy
Copy link

This works fine for me:

xdebug.max_nesting_level=300
xdebug.remote_enable=1
xdebug.remote_connect_back=0
xdebug.remote_port=9000
xdebug.scream=0
xdebug.cli_color=1
xdebug.remote_host=10.0.2.2
xdebug.remote_autostart=1
xdebug.show_local_vars=1
xdebug.idekey=PHPSTORM
xdebug.remote_log=/tmp/xdebug.log
xdebug.remote_handler=dbgp

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