Reputation: 2470
I've got the PhpStorm 10.0.3 and trying to debug a CLI script that runs on a remote server.
I've got reverse SSH tunnel set up from my local machine to the remote server.
Remote server xDebug is configured with the following:
# /etc/php5/apache2/conf.d/20-xdebug.ini
# /etc/php5/cli/conf.d/20-xdebug.ini
zend_extension=xdebug.so
xdebug.remote_enable=true
xdebug.idekey=PHPSTORM
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
I try to start a script like this:
php -dxdebug.remote_autostart=On /var/www/index.php
The PhpStorm debug tabs get's opened (sometimes it's gray), but it does not prompt me to fix file mappings, it does not open the debugged file and does not point to the breakpoint line. The remote server script execution gets blocked until I manually kill the debugging session.
When I debug over Apache2 using GET parameter:
?XDEBUG_SESSION_START=1
The debugging works fine and I get prompted to fix the file mappings.
Any idea why is that?
I was studying below, but it does not solve my problem: https://confluence.jetbrains.com/display/PhpStorm/Debugging+PHP+CLI+scripts+with+PhpStorm (Question: How my script should now that debugging should start without remote_autostart setting set? In green hint they say it is optional.)
and XDebug: how to debug remote console application? (Re: Setting the remote_host in the XDEBUG_CONFIG variable to my local computer external IP [check the copied bash snippet] does not seem to be working. My local computer is not accessible via external IP, it's only accessible via reverse SSH tunnel)
export XDEBUG_CONFIG="remote_host=$(echo $SSH_CLIENT | awk '{print $1}') idekey=PHPSTORM"
Upvotes: 0
Views: 849
Reputation: 2470
There were actually 2 problems here. As in the @LazyOne comment, there was a port collision with the PHP5-FPM service. In my case I've turned it off, as the client's server configuration does not use FPM anyway.
I also had to export PHP_IDE_CONFIG variable on the remote host:
export PHP_IDE_CONFIG="serverName=serverNameInPHPStorm"
That host is a configured on the PHPStorm side (Settings / Preferences | Languages & Frameworks | PHP | Servers). I've also had to map the root project folder on the remote server path location, as they are different between my local/dev machine and the remote.
Upvotes: 2