13
votes

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?

4
Please check Settings | PHP | Debug -- there should be enough settings to skip/ignore such incoming debug requests. - LazyOne
Thanks, do you want to put that as an answer so you get karma points? - Michael Butler
I'm fine, thnx. Plus .. I did not provide exact settings ... only a hint/general direction. - LazyOne

4 Answers

8
votes

You can ignore a file in PhpStorm in:

Preferences > PHP > Debug > Step Filters

Add it with the + sign in the skipped files section and navigate to the folder containing the file.

phpStorm pref

6
votes

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.

4
votes

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

0
votes

When you land here and you have a *nix system you can consider using the following method:

  • Disabling remote_autostart in your php.ini by using debug.remote_autostart=0
  • Use one of the methods to enable the xdebug debugger on a session per session basis as documented on this page.
  • I personally made an alias to easily start the debugger on the command line:

    $ alias enable_debugger='export XDEBUG_CONFIG="idekey=session_name"'
    

    This way you can easily enable the debugger for one command line session using the following command:

    $ enable_debugger