Skip to content

Instantly share code, notes, and snippets.

@leostaples
Last active December 11, 2015 03:38
Show Gist options
  • Save leostaples/4538869 to your computer and use it in GitHub Desktop.
Save leostaples/4538869 to your computer and use it in GitHub Desktop.
Xdebug set-up

Setting up Xdebug

1.) Modify Xdebug settings on sandbox

cd vosbox

vagrant ssh

nano /etc/php.d/xdebug_sandbox.ini

Set contents to:

; xdebug remote debugging configurations
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_port = 9001
xdebug.remote_log = /var/log/httpd/xdebug_log
xdebug.remote_connect_back = 1

Then

service httpd restart

2.) Set up your IDE

I tried to set up SublimeText using the SublimeXdebug plugin but it does not seem to support remote debugging/path mappings. PHPStorm was easy to get working with Xdebug but it's not free.

In the end I used the standalone MacGDBP.

Under Preferences > General set:

Xdebug Port: 9001

Under Preferences > Paths set:

Local: /Users/<username>/vosbox/workspace
Remote: /vagrant/workspace

Restart MacGDBP.

Note: Another plus point for MacGDBP is that it automatically locates the Zend/BBC PAL classes without setting up further path mappings. I remember having to checkout local versions of these files with Eclipse in the past.

3.) Debug

Visit the url you wish to debug, e.g. http://pal.sandbox.dev.bbc.co.uk/news, and you should see the debugger break on the first line of tabloid mvc.php

To set a break point, click + at bottom of Breakpoints window and choose a file and click the line you want to break on.

Visit the url again, then click the Run button to skip to your breakpoint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment