Xdebug issue
I'm trying to get xdebug remote debugging to work. It does not seem to connect with the server. So, a few basic questions on phpstorm and xdebug:
Server has xdebug installed, the xdebug info shows up in phpinfo() and phpstorm confirms it is installed.
In php.ini i have
zend_extension="/usr/lib/php/modules/xdebug.so"
xdebug.remote_enable=true
xdebug.remote_host=193.xxx.xxx.xxx
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
phpstorm runs on my macbook that is connected via VPN to an address in the same network as the server. Firewall rules should not matter, but I've opened 9000 anyway.
When I debug it says "Executing the script on server..." for like 10 seconds and then the Validate xdebug dialog pops up and it has two things on its mind:
First, it says that xdebig is installed. Just an information notice.
Second it says "Cannot establish debug connection", and it asks me to check remote debug host and that port 9000 is open. I've verified this, these settings are correct.
The clients says: Waiting for connection on port 7,815. Is this the source port or what? The port number seems to change every time I do a new debug. Shouldn't it say 9000?
If I ignore the warning i fires up firefox with the debug URL, but it does not show anything, it seems to be trying to establish connection, forever. The client says "Waiting for connection port 9000 with ide key Phpstorm1"
So... any help is useful. Thanks.
Please sign in to leave a comment.
Hello Erik,
When checking Xdebug setup, PhpStorm executes script on server that tries to connect back to IDE (using remote_host and remote_port settings), just like Xdebug will do once debugging is started. If script says 'Cannot establish connection', your network configuration is the most likely reason. Please double-check your routing rules and open port in firewalls (on your server, client machines and routers inbetween, if any).
You can also test connection yourself:
- deselect 'Validate Xdebug configuration...' checkbox on your 'Php on server' run configuration screen
- start debugging so that 'Waiting for connection on port 9000 with ide key XXX' appears
- on server machine run
If connection was successful, it should say something like
What for 'Waiting for connection on port 7,815' message, it is shown by 'JavaScript debug' debug session, which is not related to PHP debugging at all (until WI-676 is implemented).
Regards,
Kirill
Aha, then I know what to do. The VPN terminator drops traffic from the server to the client on port 9000. I tried connecting directly to the server network (not via VPN) and it worked rigt away.
Still: Why open port 9000 INBOUND to the server network if the traffic on 9000 is FROM the server? Or is both server and client port number fixed on 9000?
Hello Erik,
Up to my knowlegde, Xdebug connection is always initiated from server to the client. When connected, data is sent between server and client in both directions.
You can configure which port to use. Server-side setting is 'xdebug.remote_port' in php.ini, client-side is 'Xdebug port' at File | Settings | PHP | Debug page.
Regards,
Kirill
Probably just me assuming things. When the xdebug validator says "please make sure port 9000 is open" I assumed it was inbound to the server.