Skip to main content

Remote-Debugging using XDebug and PHPStorm

Category: PHP

Configuration of PHPStorm

By default the remote debugging port is set to 9000. This can be easily changed in the general settings. For now we gonna use the default.

First we need to select "Run -> Edit Configurations..."  at application's menu. There we should add a "PHP Remote Debug" configuration type. Afterwards we have to define informations about the server (url, port, debugger and paths) like in screenshot below. Those settings are made for a server running at localhost, but can be easily adopted for a docker container or a vagrant box.

PHPStorm - Serverkonfiguration

Now we need to define the "Ide key".

PHPStorm - Ide key

Configuration of XDebug

The following settings only refer to remote debugging and should be extended as you wish in php.ini:

; activating Remote-Debugging

; host definition
xdebug.remote_host = localhost

; Remote-log path

; Ide-Key

; this activates remote debugging for every host,
; this option is overwriting remote_host

Now you'll have to restart the server.

Installation and use of chrome extensions

Download: JetBrains IDE Support

Thanks to assistance of this extension, we do not have to add GET-/Cookie-Params ourselves. Just right click the extension's icon and choose "Inspect with PHPStorm".

And finally...

... switch back to PHPStorm, select "Run -> Debug" at the menu for selecting our just made configuration and with "Run -> Start Listening for PHP Debug Connections" we are ready to debug. We just need to set a breakpoint (by clicking it's line number) and reload the page in browser.

Debug content


sudo tcpdump -ni eth1 -n port 9000 -X     

By using tcpdump you can check whether data is send or not.