Cant get xDebug to work remotely with server on php 8.1 on phpStorm
Hi there,
What I want to do in a first step is to debug a HTTP request. To do so, I followed all of your instructions. When I validate the configuration on the Remote Web Server, I get:
When I then run the according HTTP request in debug mode, the debugger console opens, but it is empty, and no frames / breakpoints / variables / whatever are available. Did I miss any step??
The xdebug php.ini settings on the remote host are:
[xdebug]
zend_extension="xdebug.so"
xdebug.mode=debug
xdebug.client_host=MASKED
xdebug.start_upon_error=yes
xdebug.start_with_request=yes
xdebug.client_port=9003
xdebug.log=xdebug.log
And the local php.ini xdebug configs are:
[xdebug]
zend_extension="xdebug.so"
xdebug.mode=debug
xdebug.client_port=9003
xdebug.log=xdebug.log
Note that there's also nothing being logged into the log files; but I get no error messages or whatever when firing a debugging HTTP request.
Regarding the breakpoints, I add them on my local files, and then deploy the according files via PHPStorm's native deployment features via rsynch. Does that actually not upload the breakpoints with it?
Okay well my server connection used to make the Remote Web Server Check is actually an SFTP connection. So I set up an SSH tunnel as you indicate here , then changed this line here on the server's php.ini:
xdebug.client_host=MASKED
to this:
xdebug.client_host=localhost
and the debugging is partially working now. The only problem is that I am not getting any logs...?
Okay after providing an absolute path starting from the server's root, and not a relative file path for the log file, it is all properly working now.
Still, this solution only works by establishing an SSH tunnel, and my host is now blocking me from doing that, for security reasons. Can't I use the traditional approach, without an SSH tunnel?
Please sign in to leave a comment.
It depends on how your server is set up.
In order for you to use the traditional approach, your web server has to be able to connect directly to the PhpStorm machine. Unless the server is on the same LAN (via a VPN or somehow else), it's almost never possible.
Another option is the Xdebug Cloud feature, but it's paid: https://xdebug.cloud/