01
Nov
07

MAMP and Xdebug

MAMP is an extremely easy to install and use web-server with php and mysql for mac.

Once, your projects become bigger, you’ll definitely feel the need for a php debugger. Xdebug is a powerful open-source php debugger i prefer over the other mostly closed source once. There is a powerful KDE tool for analysing Xdebug output, see this example.

But as for now, i had no Xdebug extension for my mac development system, cause i didn’t want to recompile the web-server stuff. Today i found, that Komodo has a dynamic Xdebug extension bundled with there commercial IDE.

As i use Eclipse, i don’t need this IDE, but i downloaded the IDE trial and extracted the xdebug.so for me.

If you have this xdebug.so, all you need to do is to place this into
/Applications/MAMP/Library/share/php/xdebug.so
and then edit your /Applications/MAMP/conf/php5/php.ini like this:

; xdebug config Mac OS X
zend_extension=/Applications/MAMP/Library/share/php/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.idekey=


7 Responses to “MAMP and Xdebug”


  1. 1 Stephen McConnell Jan 20th, 2008 at 3:56 am

    Komodo must have done something, because I was not able to extract xdebug.so from their installation. How did you do that?

  2. 2 Jakob G. Thomsen Feb 7th, 2008 at 12:47 am

    Stephen: You don’t have to download the whole Komodo IDE, they have released the xdebug.so at http://aspn.activestate.com/ASPN/Downloads/Komodo/RemoteDebugging for various OS.

  3. 3 Cornelius Weiss Feb 7th, 2008 at 11:53 am

    Hi Jakob,

    thanks for the link!

    The word “xdebug.so” is a link in my original post :-) , but it’s only the php5.2 version.

    cu
    conny

  4. 4 Dano! May 5th, 2008 at 7:02 am

    Be careful of getting the latest xdebug.so. The version I found was v2.1.0-dev, which has some problems with the most recent version of Eclipse and PDT. Tripped me up for quite some time.

    From the Eclipse newsgroup:

    A change has been made in the xdebug 2.0.3 which appears to causes a problem for PDT using xdebug. So at this time it is not recommended to upgrade to 2.0.3 and to continue using xdebug 2.0.2 with PDT 1.0.2 and the PDT 1.1 Nightly/Integration builds.

    The only way I found to get the old version is to download the source from xdebug.org and compile it. If you don’t have the Xcode tools, they are not hard to install: insert Disc 2 from the install CDs, open the “Xcode Tools”, double click on the XcodeTools.mpkg, and go outside for a bit and enjoy the weather. When you come back, greb the 2.0.2 version of xdebug, unpack it, go to that directory in a terminal, and follow the directions in the README.

  5. 5 Pete Jun 18th, 2008 at 8:01 pm

    Still not getting this to appear in my phpinfo using mamp.. any suggestions?

    Here is what my php.ini file looks like:
    [xdebug]
    zend_extension=/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20050922/xdebug.so
    xdebug.remote_enable=1
    xdebug.remote_handler=dbgp
    xdebug.remote_mode=req
    xdebug.remote_host=192.168.1.101
    xdebug.remote_port=8888

    Thank you :)

  6. 6 Marian Nov 3rd, 2009 at 3:31 am

    Pete’s problem might have been that the Zend Optimizer doesnt play well with xdebug. You have to deactivate it in the MAMP options. I found this here: http://technosophos.com/content/debugging-your-php-code-xdebug-mamp-textmate-and-macgdbp-support

  7. 7 loige Dec 25th, 2009 at 12:45 am

    Really simple to install this way and it works like a charm :) tnx

Leave a Reply