Preferences >> Languages & Frameworks >> PHP >> Servers
Add a server:
Name: mydomain.dev
Host: mydomain.dev
Check: Use path mappings and define the absolute path on the server for webroot
This assumes you are using port 9000
From your local machine:
ssh -R 9000:localhost:9000 [SSH_CONFIG]
On the remote machine:
export XDEBUG_CONFIG="idekey=PHPSTORM remote_host=127.0.0.1 remote_port=9000”
Use the Name:
you setup in PHPStorm
export PHP_IDE_CONFIG=“serverName=mydomain.com"
Testing drush ev
. Set a breakpoint in a function like menu_get_item()
On the remote machine:
drush ev 'return menu_get_item();'
Now let's debug Drush:
Add an alias on the Remote machine:
function bugon() {
export XDEBUG_CONFIG="idekey=PHPSTORM remote_host=127.0.0.1 remote_port=9000";
export PHP_IDE_CONFIG='serverName='"$@";
}
function bugoff() {
unset XDEBUG_CONFIG && unset PHP_IDE_CONFIG;
}
Now you can enable:
bugon mydomain.com
and disable:
bugoff
Open you local version of Drush. Mine is at:
/Users/shenry/.composer/vendor/drush/drush
Add a server configuration with path mappings. I just used the same mydomain.dev
Map the local path to the path on the Remote machine:
My remote path was:
/usr/local/share/drush
In PHPStorm open:
commands/core/help.drush.inc
Set a breakpoint in:
drush_show_help()
On the remote machine run:
drush -h
Score!!