Zach Adams Web Developer and Programmer

Adding XDebug to Varying Vagrant Vagrants (VVV)

January 12, 2015

Using VVV for WordPress development is awesome, however sometimes the errors returned are confusing and difficult to debug. Thankfully there’s a PHP extension which makes tracing the errors returned by PHP and WordPress much, much easier and that’s XDebug.

Installing XDebug on your VVV machine is easy:

SSH into your VVV machine with:

vagrant ssh

Install XDebug with:

sudo apt-get install php5-xdebug

Open your php.ini

sudo vim /etc/php5/fpm/php.ini

Go to the bottom of the file by typing G (capitalized) and enter Insert mode by typing i (lowercase). Paste in the following:

# XDebug Extension
xdebug.remote_handler=dbgp xdebug.remote_mode=req
xdebug.remote_host= xdebug.remote_port=9000

You can also decide whether you want to limit how much information is shown in a var_dump by adding the following settings below the above code:

# Sane limits
xdebug.var_display_max_depth = 5
xdebug.var_display_max_children = 256
xdebug.var_display_max_data = 1024

And if you want no limits on how much information is shown enter the following:

# No limits
xdebug.var_display_max_depth = -1 
xdebug.var_display_max_children = -1
xdebug.var_display_max_data = -1

Exit and save by typing :wq and hit enter.

Restart PHP5-FPM with:

sudo service php5-fpm restart

And you should be good to go! Let me know if you have any problems!