New in 4.0: Easier debugging of remote PHP command line scripts

Posted on by Egor Malyshev

Many of PhpStorm users like to debug their PHP web applications and local command line scripts using our zero-configuration debugging approach due to its simplicity and comfort. This time we would like to announce that since PhpStorm 4.0 you can use this approach for debugging remote PHP command line scripts.

For those who are not familiar with PhpStorm debugging features yet, this type of debugging uses the ‘Listening’ mode and doesn’t require any run configuration or any other extra actions.

‘Start Listen PHP Debug Connections’ action

Zero-configuration debugging is based on analyzing your environment variables. Therefore it is hard to support debugging of remote PHP command line scripts in the listening mode because  there is no definite way to detect the  path mapping configuration to be used for such debug sessions.

You, our users, have asked us to provide a way to debug remote PHP command line scripts using the listening mode (see WI-7906) and we’ve implemented a generic mechanism to specify the path mapping configuration to  use.

To tell PhpStorm which path mapping configuration it should use for a connection from a certain machine you need to set the value of the “PHP_IDE_CONFIG” environment variable to “serverName=SomeName”, where ‘SomeName’ is the name of the server configured in ‘Project Settings | PHP | Servers’. And that is all!

Please note that it will work for any debug connection (both for web applications and command line scripts) because this check has the highest priority in the path mapping detection algorithm.

Troubleshooting

Here are some possible problems you can encounter when debugging remote PHP debugging command line scripts:

  1. Your PHP CLI interpreter might use another php.ini configuration file than the one installed on the web server. Run PHP with the ‘–i’ option to check which configuration files it actually uses (see the official documentation for details).
  2. (Xdebug only) Please ensure that ‘xdebug.remote_connect_back’ configuration option is disabled. Thanks to Joshua Johnson for the hint.

Download the latest PhpStorm & WebStorm 4.0 EAP. We’d also love to get your feedback in the issue tracker

Develop with pleasure!

Subscribe

Subscribe for updates