1

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

2 Answers 2

1

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)

2
  • 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, 2010 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, 2010 at 2:55
1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .