I just upgraded my XAMPP to latest release and found myself trapped with no memory of how to install xdebug on a Mac with XAMPP.
1. Install XAMPP Developer package
Building xdebug requires you to have php headers, so download and install corresponding developer package for XAMPP.
2. Download xdebug
Download xdebug source from here or checkout from svn:
svn co svn://svn.xdebug.org/svn/xdebug/xdebug/trunk xdebug cd xdebug
3. PHPIZE
Run phpize
/Applications/XAMPP/xamppfiles/bin/phpize
4. Configure xdebug
Because XAMPP is build for i386 (32-bit) architecture, we have to modify default build flags, which otherwise would build for x86_64 (64-bit):
./configure --enable-xdebug \ --with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config \ CFLAGS="-arch i386 $CFLAGS" CCFLAGS="-arch i386 $CCFLAGS" \ CXXFLAGS="-arch i386 $CXXFLAGS" LDFLAGS="-arch i386 $LDFLAGS" \
edit: configure command updated to append variables instead of prepending them (thanks Sequan).
5. Make
make6. Copy files
Copy the files to PHP extensions directory. You might need to adjust the path for your XAMPP version:
sudo cp modules/* /Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/
7. Configure PHP.ini
Final step is to configure php.ini file. So open /Applications/XAMPP/etc/php.ini with your favorite editor and add the lines to the bottom of it:
[xdebug] zend_extension=/Applications/XAMPP/xamppfiles//lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/xdebug.so xdebug.remote_enable=on xdebug.remote_handler=dbgp xdebug.remote_host=127.0.0.1 xdebug.remote_port=9000
Now restart Apache and you should be good to go.
No related posts.
I discover all local variables display as ” “. Could you have this problem?
I discover all local variables display as ‘Uninitialized’. Could you have this problem?
Something does seem to be broken with this setup, because now my app does not break at the breakpoints.
I will look into it.
You’re a lifesaver! I’ve been banging my head against a wall all night trying to resolve this issue and your solution works perfectly.
Thank you!
When I run
/Applications/XAMPP/xamppfiles/bin/phpizeI get this error:
Cannot find config.m4.
Make sure that you run '/Applications/XAMPP/xamppfiles/bin/phpize' in the top level source directory of the module
Could you please tell me how to resolve it?
Are you in the
xdebugfolder? Can you yourself see the config.m4 file?I have it like so:
$ pwd
/Users/laas/proged/xdebug
$ ls config.m4
config.m4
Hi,
I need to setup xdebug on my 64-Bit Mac OS X Leopard, and your post is the most relevant one I can find for my needs. I have XAMPP working fine and after I generate the xdebug.so file, i receive the following error:
Failed loading /Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/xdebug.so: dlopen(/Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/xdebug.so, 9): no suitable image found. Did find:
/Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/xdebug.so: mach-o, but wrong architecture
Can you please help me?
Thanks
Hi Roosevelt,
Can you check that you configured Xdebug with
i386support as XAMPP is still compiled fori386/ppc, notx86_64.To do that, run:
lipo -info /Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/xdebug.so
And see that it lists
i386as an architecture. If it does not, please recheck step 4 above, to set appropriate flags for the compiler.BTW, I switched my XAMPP for a self-compiled apache and did not need xdebug anymore, so I haven’t recompiled it since. But I still hope this post is not that outdated and still aplies.
Works like a charm on Mac OS 10.6.8. Thanks.
Getting Xdebug to work was a total pain. Thanks for the post! I had to make one small modification, however. On step four you have:
--with-php-config=/Applications/XAMPP/xamppfiles/bin/php-configI had to make this:
--with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config-5.3.1I am using XAMPP 1.7.3
Just to correct one command above so you are not pulling your hair out:
./configure CFLAGS="-arch i386 $CFLAGS" CCFLAGS="-arch i386 $CCFLAGS" CXXFLAGS="-arch i386 $CXXFLAGS" LDFLAGS="-arch i386 $LDFLAGS" --enable-xdebug --with-php-config=/Applications/XAMPP/xamppfiles/bin/php-configYou are right of course – ./configure does prefer env variables to be specified as arguments (though prepending should work in Bash/sh which evaluates variable specifications preceding the commands)
Thank you very much!
Things like this is what makes Internet great!
Thanks a lot!