Setting up Xdebug
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
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.
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.