Pregunta

I need to debug a console script run from within my development VM (because of different machine state).

I'm using Netbeans, and I can debug scripts called from the browser just fine.

How do you achieve this, is this possible?

I tried Debugging php-cli scripts with xdebug and netbeans?, but I think this applies only to running the script locally.

My current xdebug configuration:

[XDEBUG]
xdebug.max_nesting_level=200
xdebug.remote_connect_back=1
xdebug.default_enable=1
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.idekey=netbeans-xdebug
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.collect_params=4
¿Fue útil?

Solución

So, following this https://www.adayinthelifeof.nl/2012/12/20/debugging-remote-cli-with-phpstorm/, I found out that you need to specify the remote host.

Xdebug must know where to send the data to.

I ended up editing my xdebug configuration to look like this:

[XDEBUG]
xdebug.max_nesting_level=200
xdebug.remote_connect_back=1
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.idekey=netbeans-xdebug
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.collect_params=4

xdebug.remote_host=HOST_IP #changed this, removed remote_autostart

So now you just have to turn debugging on in Netbeans and run export XDEBUG_CONFIG="idekey=netbeans-xdebug" in your VM's console.

Next run the script you want to debug.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top