Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I install memcache from pecl and I got memcache.so. After that I add in php.ini but I got a error.

[12-Aug-2010 13:02:24] PHP Warning: PHP Startup: Unable to load dynamic library '/Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/memcache.so' - dlopen(/Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/memcache.so, 9): no suitable image found. Did find: /Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/memcache.so: mach-o, but wrong architecture in Unknown on line 0

I tried

$file /Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/memcache.so

I got

/Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/memcache.so: Mach-O 64-bit bundle x86_64

I'm using Mac OS x 10.6.4 64bits

share|improve this question

2 Answers 2

up vote 1 down vote accepted

I guess it's probbaly because php is not build in 64 bit, so you are trying to load a 64 bit module to a 32 bit application and of course it won't work.
You can check this by running file on php binary (or php module if used as module)

share|improve this answer
    
Oh!!! yes. I got result like this. So, how to build i386 edition for memcache ? php: Mach-O universal binary with 2 architectures php (for architecture ppc): Mach-O executable ppc php (for architecture i386): Mach-O executable i386 –  saturngod Aug 13 '10 at 1:42
    
I got it. I compile like this. phpsize CFLAGS='-O3 -fno-common -arch i386 -arch x86_64 -g -Os' LDFLAGS='-O3 -arch i386 -arch x86_64' CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64 -g -Os' ./configure --disable-dependancy-tracking --disable-shared -enable-static –  saturngod Aug 13 '10 at 2:55

The main answer helped a lot for figuring out that I had compiled wrong, but to compile the module correctly I found this worked for me:

$ cd your-php-module
$ /Applications/MAMP/bin/php5/bin/phpize
$ ./configure CFLAGS="-arch i386" --with-php-config="/Applications/MAMP/bin/php5/bin/php-config"
$ make
$ make install
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.