Skip to content

Instantly share code, notes, and snippets.

@cage-is
Last active February 20, 2019 20:43
Show Gist options
  • Select an option

  • Save cage-is/6b72a871237ccef853ef26dae84f948b to your computer and use it in GitHub Desktop.

Select an option

Save cage-is/6b72a871237ccef853ef26dae84f948b to your computer and use it in GitHub Desktop.

Setting up xdebug on development server

Install xdebug

sudo apt-get install php-xdebug

Edit xdebug.ini

This step might not be 100% necessary but I'm including it because it's one of the things I did in the process.

zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_connect_back=1
xdebug.remote_log=/tmp/debug.log

Create ssh tunnel

From your machine, run this command to create a tunnel on port 9000.

ssh -R 9000:127.0.0.1:9000 url-to-server

Run the script

The serverName portion is used by PhpStorm to identify the server that's connecting to it so that it can use the appropriate path mappings and stuff.

PHP_IDE_CONFIG="serverName=servername" php -dxdebug.remote_enable=1 -dxdebug.remote_autostart=1 -dxdebug.remote_mode=req -dxdebug.remote_port=9000 -dxdebug.remote_host=127.0.0.1 /path/to/script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment