📜 ⬆️ ⬇️

Debugging with XDebug and PhpStorm (addition)

Good day,% username%!

I read today the article “Debugging with XDebug and PhpStorm using the example of 1C-Bitrix site” . In it, the author uses the "green bug" to start debugging. A few more debugging methods have been suggested in the comments, 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 impossible. Therefore, forced to write a separate article.

In xdebug there is the possibility of autostart, without any intricacies. Simply place the breakpoints and open your application in the browser, xdebug will pick up the start itself.

So my configuration is:

')
1. Configure XDebug

In php.ini we connect the extension and set the parameters:
zend_extension="%  php%/ext/php_xdebug.dll" ;        xdebug.remote_autostart=on xdebug.remote_enable=on xdebug.remote_handler="dbgp" xdebug.remote_host="localhost" ;    9000,   openserver    php xdebug.remote_port=9001 xdebug.remote_mode=req ; IDE (  )   xdebug.idekey="PHPSTORM" 

2. Configure PhpStorm

Configure the interpreter if you have not done it yet.

image

image

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

image

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

image

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

image

At this setting is completed, you can use.

Using

To get started, arrange breakpoints, enable wiretapping of the XDebug port, and open your application.

image

image

Breakpoints will be caught automatically, without the need to poke at the green beetle. I hope the information is useful to someone.

That's all, thank you for your attention.

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

Source: https://habr.com/ru/post/250323/


All Articles