Debugging CommandLine PHP running on Linux from Windows


I'm a longtime and enthusiastic user of PHPStorm (since v2) and have always admired the remote debugging facility.

I'm now writing some command line scripts in PHP and would like to do the same for this.

Are there any particular videos I should look at?

I guess the principles would be the same, ie.setup xdebug in the CLI version of php.ini, but the way in which the PHP script is launched remotely must be different?

Or maybe I should wrap my CLI script into a fake web-page? That would have different privileges for system access, but I might be able to get away with that by granting injudicious rights to www-user!

Any help welcome....

1 comment

Hi there,

Simple scenario:

1) Create SFTP deployment entry and mark it as Default for this project
2) Define Remote PHP Interpreter and choose it for this project
3) Just use ordinary CLI debug ("PHP Script" type of Run/Debug configuration)

Now IDE will connect to your remote host and will execute your script via SSH.

Obviously, xdebug still should be installed and configured on remote server

If SFTP/SSH is not available -- you can look at

If working with docker containers:

Related links:


Please sign in to leave a comment.