I'm working on a project with a number of developers over Git and the existing codebase uses PECL YAML PHP extension (v1.0.1).
I have tried a number of steps to install the PECL YAML extension on my MAMP server and to no joy!
I am assuming the other developers are on Linux.
First couple of attempts at install revealed this error in my php_error_log:
"[16-Jul-2011 11:29:13] PHP Warning: PHP Startup: Unable to load dynamic library '/Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/yaml.so' - dlopen(/Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/yaml.so, 9): no suitable image found. Did find: /Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/yaml.so: mach-o, but wrong architecture in Unknown on line 0"
After a large amount of time googling I realised that I wasn't alone and it's because my extension that I compiled using "./pecl i yaml" was a 64 bit version
"file yaml.so": yaml.so: Mach-O 64-bit bundle x86_64
However, comparing this to working extensions on my MAMP setup i.e. "file xdebug.so":
xdebug.so: Mach-O universal binary with 2 architectures
xdebug.so (for architecture ppc): Mach-O bundle ppc
xdebug.so (for architecture i386): Mach-O bundle i386
So I discovered a number of blogs that helped me to identify the exact problem.
Can't run 64 bit extensions on 32 bit MAMP server - makes sense.
My install process is:
- download PECL YAML source
- extract tar and cd into module source
- phpize inside module directory
run .configure using a command from blogs:
"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 –-dis