Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

trogne's avatar

php remote CLI debugging

I'm very confuse about a paragraph here : https://github.com/felixfbecker/vscode-php-debug

"Please also note that setting any of the CLI debugging options will not work with remote host debugging, because the script is always launched locally. If you want to debug a CLI script on a remote host, you need to launch it manually from the command line."

Ok, the PHP script is remote, on a homestead VM. So how do I run, on the command line, the script that sites remotely on the VM, so that I can debug on my host IDE ?

0 likes
1 reply
trogne's avatar

Ok, I edited the xdebug for CLI php on homestead :

sudo vi /etc/php/7.3/cli/conf.d/20-xdebug.ini

zend_extension=xdebug.so
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_host=192.168.0.4
;xdebug.remote_connect_back = 1 ; NOT WORK CLI
xdebug.remote_port = 9000
xdebug.max_nesting_level = 512

Now, running "php script" hits my VScode breakpoint !

I guess he meant that by "If you want to debug a CLI script on a remote host, you need to launch it manually from the command line.".

Do you think ?

Please or to participate in this conversation.