Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debug PHP command line script in PHPStorm

I use PHPStorm as my primary tool for debugging PHP and am very pleased. So far I've been using Firefox to run the scripts, and PHPStorm catches breaks perfectly.

Now I have a situation where I am running a PHP script via command line (not browser) and want to know if there's a way to setup PHPStorm to catch breaks when running a PHP script via command line?

like image 864
JoshuaDavid Avatar asked Sep 10 '25 15:09

JoshuaDavid


1 Answers

To enable PHP Debuging with Xdebug on the shell/command line with Phpstorm is very easy:

export XDEBUG_CONFIG="idekey=PHPSTORM"

In windows CLI, use set instead of export.

set XDEBUG_CONFIG="idekey=PHPSTORM"

Ensure Phpstorm is listening to the PHP Debug connections.

To disable debugging from command line end:

unset XDEBUG_CONFIG

This (PHPSTORM) is the default Phpstorm IDE-Key.

like image 135
Venkat Kotra Avatar answered Sep 12 '25 10:09

Venkat Kotra