1
votes

This is my first post here, I post because after reading through X articles googling can't get PhpStorm, Xdebug work with CLI scripts.

Already tried to follow advices from:

I had it working, but after destroy vagrant recently and now can't fully restore this feature.

SETUP:

  • I'm running Symfony project on Vagrant.
  • Debugging of "webpages" on my server works just perfectly.
  • When I try debug CLI Command I prequisite it with:

    export XDEBUG_CONFIG="XDEBUG_SESSION=1"
    export PHP_IDE_CONFIG="serverName=vagrant"
    

XDEBUG.INI (on Vagrant):

zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_host=192.168.0.133 (ip I get from ifconfig -a on Vagrant)
xdebug.remote_port=9000
xdebug.max_nesting_level=2500
xdebug.remote_handler=dbgp
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
xdebug.idekey="PHPSTORM"

Any help much appreciated. Digged through X articles on web but in my eyes all configurations look ok, no idea what to do...

1
1) xdebug.remote_connect_back=1 -- set it to be 0 (disable this functionality) 2) xdebug.remote_host=192.168.0.133 (ip I get from ifconfig -a on Vagrant) -- this should be an IP of your computer where PhpStorm is running as seen from vagrant machine 3) It's possible that your Linux of Vagrant VM uses 2 different php.ini files: one for Apache and one for CLI scripts -- so you need to ensure that you are editing the right ini file for CLI environment 4) Share your php -i output 5) If still nothing -- enable xdebug log and see what it has to sayLazyOne
6) All PhpStorm PHP debug related articles and manuals: confluence.jetbrains.com/display/PhpStorm/…LazyOne
LazyOne "this should be an IP of your computer where PhpStorm is running as seen from vagrant machine " - made mistake here - thank YouPiterr
So .. that means that it's now solved? because it's not 100% clear from your last short message.LazyOne

1 Answers

3
votes
  1. Set xdebug.remote_connect_back to be 0.

    This option prevents you from using right IP address when you are doing Remote CLI debugging. Since it's a CLI debug, the IP will always be local (vagrant machine) while you need another one.

    This option works OK when debugging over browser as request comes from your "real" computer. But when doing CLI debug .. request will be local to Vagrant machine.

    When this option is set to 1 (as it is done now) it ignores the setting from #2 below.

  2. xdebug.remote_host=192.168.0.133 (ip I get from ifconfig -a on Vagrant) -- this should be an IP of your computer where PhpStorm is running as seen from Vagrant machine.

Combination of those 2 above will do the job for you.