Setting up XMAPP on a mac with xdebug

This post is about setting up XMAPP on a mac with xdebug.

The first thing we are going to do is to change the document root inside xampp to the ‘Sites’ folder. Changing the DocumentRoot has a few benefits – one being that its far easier to get to in the finder and your editor!

Changing the DocumentRoot in XAMPP

  • Install xampp from
  • open /Applications/XAMPP/xampfiles/etc/ in finder; right click > get info
    make sure its read / write by everyone
  • open /Applications/XAMPP/xampfiles/etc/httpd.conf
  • scroll down to ‘DocumentRoot’
  • type in the location of your ‘sites’ folder [ /Users/username/Sites ]
  • scroll down to the <Directory> config
  • replace /Applications/XAMPP/xamppfiles/htdocs with /Users/username/Sites
  • save
  • restart apache
  • goto http://localhost to see what you have =)

setting up xDebug

This will allow you to have proper debugging for your php apps. In the long run this will save you hours of time.

  • open /Applications/XAMPP/xamppfiles/etc/php.ini
  • scroll to the very end
  • make sure the xDebug lines are not commented out, add them if they arent there

[Zend] zend_extension = /full/path/to/ xdebug.remote_enable = 1
xdebug.remote_port = 9000 xdebug.remote_host = localhost
  • restart apache

Now you have a decent setup you should configure SVN or git to handle your version tracking. Personally I use git and have developed a workflow that I am comfortable with – this takes time and the only real way to know what works and what doesn’t is to try lots of options and stick with the ones that work for you.

A few hints: http://localhost/phpmyadmin will take you to a local phpmyadmin install where you can create databases, etc. You should configure a password on your mysql to keep it safe though =)

You can also install mysqlworkbench this will make changing your database and adding / manipulating data much easier.

You will now be able to use any debugger that works with xdebug – eclipse has built in debugging, so does netbeans. macGDBp is good too =)

This Post Has 2 Comments

  1. shaack

    This dont works, because there are no “xDebug lines” at the end of the php.ini

  2. Sachin Sharma

    [XDebug] is the forth last tag in the php.ini file. last one is [eAccelerator] .

Leave a Reply