Debugging with XDebug and PhpStorm (add-on)

Good day,% username%!

I read today the article “Debugging with XDebug and PhpStorm on the example of 1C-Bitrix website” . In it, the author uses the "green bug" to run debugging. The comments suggest several more methods for starting debugging, such as special bookmarks, various plugins, etc. In my opinion, all this is inconvenient, besides there is the most simple and convenient option. I could offer it in the comments to the article, but, alas, in read-only this is not possible. Therefore, I have to write a separate article.

Xdebug has the ability to auto start, without any tricks. Simply place breakpoints and open your application in a browser, xdebug will pick up the start itself.

So my configuration is:
  • Web Server - OpenServer 4.8.8
  • PHP 5.4.17
  • XDebug 2.2.3
  • IDE PhpStorm 7.1.

1. Configure XDebug

In php.ini we connect the extension and set the parameters:
zend_extension="%путь до php%/ext/php_xdebug.dll"
;эта опция как раз и отвечает за автостарт
;порт может быть и 9000, но у openserver он зарезервирован под php
;ключ IDE (может быть любым) понадобится позже

2. Configure PhpStorm

We configure the interpreter if you have not done so already.



Next, add the server, if you are a local server, then write in the Host - localhost field , if the remote address is the remote host. The hostname here and in php.ini must match.


Configure XDebug. We take the port from php.ini (xdebug.remote_port). If you do not need XDebug to stop on the first line of the application, disable the two lower checkboxes.


Here we also take values ​​from php.ini: IDE key -> xdebug.idekey, Host -> xdebug.remote_host, Port -> xdebug.remote_port.


On this setup is completed, you can use.


To get started, set breakpoints, turn on the XDebug port wiretap and open your application.



Breakpoints will be caught automatically, without the need to poke a "green bug". I hope the information is useful to someone.

That's all, thanks for your attention.

PS The article has been hanging in the sandbox for about a year, but is still relevant, so I publish it. Thanks to jeston for inviting me .

Also popular now: