RSS

Php Configure command doesnot work on mac osx with intel arch

This entry was posted on Feb 24 2010

I have wanted to run my php extensions that I’ve wrote earlier in a linux machine on mac os x snow leopard, but the intel architecture came with the snow leopard does not allow me to that. Basically my extensions are written in 32 bit but my development environment is in 64bits now. By the way I am using Zend Server CE for now.

Normally you should build php for your new extension by running the following commands

phpize
./configure (add some configuration parameters here)
make

But it won’t help and gives an error like this:

mach-o, but wrong architecture in Unknown on line 0

The solution is to add some extra build parameters before the configuration command:

MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ LDFLAGS=’-O3 -arch i386 -arch x86_64′ CXXFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ ./configure

Then you’re ready to go.

Post a Comment