Xdebug Remote debugging with PHPStorm and Digital Ocean Droplet
- Set up a remote server with PHP and XDebug installed.
- 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.
- To set op the SSH tunnel that will allow PHPSTORM to listen to incomming Xdebug connections enter this command:
1ssh -R 9000:127.0.0.1:9000 email@example.com
- 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.
- Because of the SSH tunnel we don’t need any extra configuration.
- Open your browser and go to the website you would like to debug (which hosted on the remote server.)
- Make sure the Xdebug helper plugin is installed in your browser, activate it and refresh the page.
- PHPSTORM should start blinking now to ask you if you want to allow the incomming connection.
- 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