Xdebug and PhpStorm remote does not work

2019-08-26 23:51发布

问题:

Is there a possibility to check if the web server is sending something to Chrome?

I have setting up PhpStorm and the web server in the same way, I have read in 1000 tutorials, but my PhpStorm doesn't receive anything from chrome.

Here are some settings:

php.ini

zend_extension="/usr/lib/php/20160303/xdebug.so"
xdebug.coverage_enable=on
xdebug.default_enable=on
xdebug.profiler_enable=on
xdebug.profiler_output_dir="/tmp"
xdebug.remote_autostart=on
xdebug.remote_port=9001
xdebug.remote_enable = on
xdebug.remote_connect_back = on
xdebug.idekey=PHPSTORM
xdebug.remote_handler=dbgp

I have disabled the firewall on the server. PhpStorm is listening on the port 9001.

Some ideas?

回答1:

The solution is very easy! The only thing I forgot was the ssh tunnel to my remote server from my local machine.

Here an example running config:

[xdebug]
zend_extension="/usr/lib/php/20160303/xdebug.so"
xdebug.remote_autostart=on
xdebug.remote_host=localhost
xdebug.remote_port=9001
xdebug.remote_enable = on
xdebug.idekey=PHPSTORM

Use as chrome plugin the XDebug Helper https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc

And as last step create an ssh tunnel to the remote server:

ssh -R 9001:localhost:9001 user@dev.server.com -N