Xdebug laravel artisan commands

If you're using XDebug version 3, try:

php -dxdebug.mode=debug -dxdebug.client_host=host.docker.internal -dxdebug.client_port=9003 -dxdebug.start_with_request=yes artisan your:command

I got it working with remote_autostart=1 and setting the PHP_IDE_CONFIG environment variable to "serverName=localhost". localhost is the name of your server config in PHPStorm. Now when I run php artisan I can break at the regular breakpoints.

Let me be more clear :)

If you've got xdebug working with PHPStorm and regular requests this is what you should do to get it working with command line php (artisan).

You have configured paths in PHPStorm so it knows which file it should show you with the breakpoints. These paths are configured under a server (Preferences -> Languages & Frameworks -> PHP -> Servers).

The name of this server should be the serverName value in the PHP_IDE_CONFIG environment variable.


Maybe this will help someone.

In short I had the same problem but I didn't have luck with accepted answer. My solution is to run this from the command line:

php -dxdebug.remote_enable=1 -dxdebug.remote_autostart=on -dxdebug.remote_mode=req -dxdebug.remote_port=9000 -dxdebug.remote_host=127.0.0.1 artisan my:command