Installing PHP extensions on Mac OS X under xampp

The other day I installed xampp on a mac os x running snow leopard but I was having an issue installing any extra extensions like xdebug and apc. I found out it was because it was compiling the extensions in 64bit but xampp is compiled in 32bit and I did the following to fix the issue:

  1. Download and extract the source
  2. Run phpize
  3. Adding the following parameters to configure:
    ./configure MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS="-arch i386 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch i386 -g -Os -pipe" CXXFLAGS="-arch i386 -g -Os -pipe" LDFLAGS="-arch i386 -bind_at_load"
  4. make (and make install if required)
  5. done :)

If that doesnt work, try adding:

--with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config-5.3.1

to the configure command.

I hope that will help some people out there, because it was driving me insane!

Tags: , , , , ,

2 Responses to “Installing PHP extensions on Mac OS X under xampp”

  1. James says:

    Hello,

    I followed your instruction to install the extensions intl but it keep prompting me the error “duplicate static” in collator class when I executed “make” or “gnumake”.

    Do you know anway to fix it?

    Thank you very much.

  2. Brian says:

    Thanks for this, I was able to install on OS X 10.6 after building w/ the additional flags on the ./configure command.

    Note, I did have to run: ‘make clean’ to get rid of the previous build that I ran that didn’t work which resulted in the following error:

    PHP Warning: PHP Startup: Unable to load dynamic library ‘/Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/apc.so’ – dlopen(/Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/apc.so, 9): no suitable image found. Did find:
    /Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/apc.so: mach-o, but wrong architecture in Unknown on line 0

    Thanks again.

Leave a Reply