Debugging a remote site over ssh
I'm new to PHPStorm, but have been doing remote PHP debugging for years with xdebug. The instructions I've found so far don't seem to cover my case.
Here's what I do with Komodo:
- I install xdebug.so on the remote instance of apache. I configure PHP to use localhost:9000 with dbgp as the protocol.
- I open the project, which has the same sources as the server.
- I make Komodo listen on some port (say, 9999) for debugging connections.
- I open an SSH connection from my work machine to the remote server using a reverse proxy (ssh -R 9000:localhost:9999 myuser@myremote.host)
- I either browse to the web page I want to debug using XDEBUG_SESSION_START=1 in the query string, or if I want to debug a PHP script, I start up the script with XDEBUG_CONFIG="remote_port=9000 remote_enable=1" in the environment.
- After a brief pause, Komodo puts up a dialog indicating there's in incoming connection, and how I want to map the remote sources to the sources on my laptop.
This was also how I did things with the old Zend IDE, some years back.
I'm having trouble figuring out how to get PHPStorm to work this way. I assume it can. But the wizard isn't asking me for the right stuff thus far.
How do I do this?
Please sign in to leave a comment.
After a while, I found in 8.0.1 that there's a PHP >> Debug settings page, which seems to have the settings I need to do this.
When I start up a drush script on the remote, PHPStorm responds, and sees I am trying to debug drush.php (the entry point). But while I've added a copy of my remote drush to a local directory and imported that directory as an "external library", drush.php still isn't mapping, even though if I step through the app, PHPStorm indicates its moving from line to line in the file.
So now I have a connection, but no mapping and no break points.
What do I need to do here?
I can get something served via HTTP to work, but not running a CLI. This is frustrating.
I'm now doing something like this:
XDEBUG_CONFIG="remote_port=9000 remote_enable=1" drush @test scr my-script.php
This gets PHPStorm's attention, but while PHPStorm knows I am starting my debugging at drush.php, the IDE makes no attempt whatsoever to map drush.php to a local file. This is different behavior from doing a remote debug off apache, where I am asked for mapping information.
It would help if I knew where to set mappings w/o waiting for PHPStorm to prompt me. Because it looks like it's never going to ask.
Jetbrains folk: is this even possible?????
Hi there,
PhpStorm v8 allows you to use Remote Interpreters -- it will connect over SSH to the remote host and will execute your script (note: script execution is initiated from IDE side).
Some old threads: