Xdebug Remote debugging with PHPStorm and Digital Ocean Droplet

  1. Set up a remote server with PHP and XDebug installed.
  2. Because firewalls will be firewalls, we probably will need an SSH tunnel set up to the server in order for XDebug to work. So, better say goodby to “Remote” debugging, or prepare yourself for some serious hair pulling.
  3. To set op the SSH tunnel that will allow PHPSTORM to listen to incomming Xdebug connections enter this command:
    ssh -R 9000: root@
    (I’m using the GIT Bash on Windows to get all these cool linux command. But you could use Putty too if you want.)
  4. After the SSH tunnel is setup (should be okay, if the previous command succesfully logged you in to the remote machine), click the “Start listening for PHP Debug connections” button.
  5. Because of the SSH tunnel we don’t need any extra configuration.
  6. Open your browser and go to the website you would like to debug (which hosted on the remote server.)
  7. Make sure the Xdebug helper plugin is installed in your browser, activate it and refresh the page.
  8. PHPSTORM should start blinking now to ask you if you want to allow the incomming connection.
  9. If it doesn’t try rebooting some stuff.

This is the Xdebug stuff you need  to put in your php.ini file in your Digital Ocean doplet:

xdebug.remote_enable = 1
xdebug.remote_port = 9000