For most of the Drush commands it is not too difficult to get XDebug and Drush working togethr and catch staff in your IDE, e.g. PhpStorm.

However, I ran into a deadlock when Drush is calling itself for a sub-process. This happens e.g. if you execute drush @site updatedb because this will invoke a second PHP task for the cache-clear all command. This second PHP task wants to connect to the Xdebug port as well which is still in use by the parent PHP task. This results in a deadlock: the child is waiting for the XDebug port to become available and the parent task is waiting for the child task - for ever or until Ctrl-C.

Is there a way around this?

1 Answer 1


In PhpStorm at least, under File >> Settings >> PHP >> Debug you can find Max. simultaneous connections and crank it up. I typically keep it at 8 but probably 3 is enough.

  • That might help, I'll give that a try, thanks a lot.
    – jurgenhaas
    May 23, 2014 at 11:18
  • Indeed, this solved the problem and to my surprise that even works if you're debugging remote drush sessions. That means, not the listening port at the remote host was the limiting factor, it's been PhpStorm which only accepted one session at a time.
    – jurgenhaas
    May 23, 2014 at 11:36
  • I don't want to say how many hours I wasted away trying to figure this out. But, I'll say it... probably 6 or 7. Nov 14, 2014 at 20:55
  • This is awesome. I have been trying to make this work on and off for ages! Wish I could +1 it more.
    – Malks
    Feb 2, 2015 at 2:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.