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
Електронна бібліотека «Exlibris»: історичні дослідження, мемуаристика, публіцистика, художня література Українська етнографія: книги, курси лекцій, статті й матеріали, мапи, фотоальбоми, веб-ресурси Правителі України: портрети, життєписи, матеріали Твори Адріана Кащенка: романтика козацьких часів Народна війна 1917-1932

See a typo?

Select the text block and press

CTRL+Enter

Comments

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

    shteevy shteevy 23.02.2019 01:13
    Hello, not easy for me to give you an akeeba because our Joomla in an Intranet with many things from ...

    Read more...

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

    gruz gruz 22.02.2019 09:49
    Sounds like a bug. To test/fix the issue I need your web-site copy (akeebabackup of your Joomla or a ...

    Read more...

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

    shteevy shteevy 21.02.2019 19:02
    Hello, many thanks for this extension !! :-) Could you please explain me how to get the "notify switch" ...

    Read more...

     
  • MVC Override - change joomla extensions behaviour without changing core files

    gruz gruz 25.01.2019 16:03
    No. It's PHP log files generated at a level higher then Joomla.

    Read more...

     
  • MVC Override - change joomla extensions behaviour without changing core files

    mboquillon mboquillon 25.01.2019 15:59
    In the administrator/logs folder ?

    Read more...