Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I ignore certain files while debugging in PHPStorm?

I have debugging working in PHPStorm with Xdebug and my local apache webserver. I'm also using CodeSniffer to check my code style. CodeSniffer (phpcs.bat) is a tool you can enable in PHPstorm that is actually an external PHP script that runs every 3-5 seconds. The annoying thing is, whenever I have debug enabled (Listen for connections), it tries to debug the phpcs script even though it is not a part of my project. What's even odder is that phpcs is run via the php command line, NOT the apache server of which Xdebug is a part.

Is there anyway to stop phpStorm from debugging this external, command-line script?

like image 429
Michael Butler Avatar asked Aug 08 '13 13:08

Michael Butler


People also ask

Why is Xdebug not working?

Xdebug cannot connect to PhpStorm This means that Xdebug tries to connect to the host and can't make the connection. To fix the issue, set xdebug. remote_connect_back=0 ( xdebug. discover_client_host=false for Xdebug 3) and make sure that xdebug.

How do I debug xdebug?

Press F5 to start the debugger. Click the new XDebug Helper extension and click the Debug option. Finally, refresh the page in the browser to let VSCode react and start the debugging process.


2 Answers

There are settings in Languages & Frameworks > PHP > Debug that allow you to remove the break-at-first-line behavior and ignore unregistered connections. enter image description here

like image 161
Lauri P Avatar answered Sep 27 '22 23:09

Lauri P


One possible solution is to add the following parameters to the bat file that runs phpcs:

-d xdebug.remote_host="8.8.1.1" \
-d xdebug.remote_enable=0 \
-d xdebug.remote_autostart=0

This sets custom PHP ini settings on the command line interface.


Alternately, go to Settings | PHP | Debug in PHPStorm and add a directory to the debug ignore list.

like image 34
Michael Butler Avatar answered Sep 27 '22 22:09

Michael Butler