Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 

Disable XDebug for Code Sniffer but enable for CLII scripts I use VS Code for php development. I use XDebug, but out of the box it catches phpcs calls on linting documents, making impossible to use xdebug due to numerios interruptions.

The solution was to disable XDebug globally and enable per virtual host.

Globally it can be disabled in php.ini (or another ini file for php, in my case of OpenSuse I use custom file /etc/php7/conf.d/xdebug.ini) and then enable it in .htaccess for needed hosts or for all of them.

So in my php .ini file I have directives

xdebug.remote_autostart = 1
xdebug.remote_enable = off

And in my .htaccess file I have directive

php_flag xdebug.remote_enable on

This worked till I needed to debug a php command line script with XDebug in my VS Code. The solution was to run php with a proper key like

php -d xdebug.remote_enable=1 script.php

And finally, not to forget a key, I created a shortcut script ~/bin/pd containing code

#!/bin/bash
set -o xtrace
php -d xdebug.remote_enable=1 $@

So to run a CLI script and let XDebug listen to I run command pd script.php

P.S. set -o xtrace line is not needed in general. I use it to debug bash scripts.

Please register to post comments.

Found a typo? Please select it and press Ctrl + Enter.
FaLang translation system by Faboba
ОУН-УПА: легенда спротиву Українська Дивізія «Галичина» Зиновій Книш: спогади й матеріали до діяння УВО і ОУН Реаніматор електронних текстів Забуттю не підлягає 1917-1991

See a typo?

Select the text block and press

CTRL+Enter

Comments

  • NotificationAry - get emails on Joomla content is submitted, added or changed

    Berndi Berndi 30.06.2019 11:45
    The fields %TO_NAME% and %TO_USERNAME% are empty

    Read more...

     
  • NotificationAry - get emails on Joomla content is submitted, added or changed

    Berndi Berndi 30.06.2019 11:43
    My fault, I made it

    Read more...

     
  • NotificationAry - get emails on Joomla content is submitted, added or changed

    Berndi Berndi 30.06.2019 10:46
    I did. Now I'm asking me how to put the surename into the email... :-|

    Read more...

     
  • NavigationAry - navigate between Joomla menu items like between articles using "prev - next"

    Berndi Berndi 29.06.2019 15:59
    I also miss content in %TO_NAME%

    Read more...

     
  • NotificationAry - get emails on Joomla content is submitted, added or changed

    Berndi Berndi 29.06.2019 15:15
    Hi gruz, I have the problem, that when I use the %AUTHOR% tag, the plugin dosen't send the author ...

    Read more...