tags:

views:

2230

answers:

3

I've followed the helpful instructions here: Install GD for PHP on Mac OS X 10.5 Leopard

And I have my extension directory in php.ini file like this: extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"

But when I try and load GD, I get an error: PHP Startup: Unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/gd.so' - (null) in Unknown on line 0 GDB - GNU Debugger protocol => $Revision: 1.88 $

This is a common error. Can someone point me in the right direction.

A: 

The path to extension_dir was wrong.

Rimian
A: 

After you do a new install of PHP (for example, to have PHP compiled with GD2 on Mac OS X) this fixes the most common errors related to PHP extensions not loading (and therefore not allowing PEAR and others to start).

Type in Terminal.app:
sudo mv /usr/bin/php /usr/bin/php_back
sudo ln -s /usr/local/php5/bin/php /usr/bin/php


This makes a backup of PHP's CLI that comes bundled with OSX, and then symlinks to the new correct location (be careful, since this location may vary with each PHP's installation, in this case you should replace /usr/local/php5/bin/php with the correct route to the newly installed file).

fandelost
A: 

I had exactly the same error, and it took me several hours to track down. The answer is that you need to make sure you're compiling the right version for your processor. In my case, I was not remembering that the PPC G5 is a 64-bit processor, and this was failing because I was using the 32-bit versions.

I also found it was helpful to change the two config lines to be more specific about setting things up for the PPC64 architecture, as follows

For jpeg-6b:

THE FOLLOWING LINE DOES NOT WORK PROPERLY:

MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" CXXFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" LDFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -bind_at_load" ./configure --enable-shared

BUT THIS ONE DOES (ON THE G5 AT LEAST):

MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS=" -arch ppc64 -g -Os -pipe -no-cpp-precomp" CCFLAGS=" -arch ppc64 -g -Os -pipe" CXXFLAGS="-arch ppc64 -g -Os -pipe" LDFLAGS="-arch ppc64 -bind_at_load" ./configure --enable-shared

For GD:

THE FOLLOWING LINE DOES NOT WORK PROPERLY:

MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" CXXFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" LDFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -bind_at_load" ./configure --with-zlib-dir=/usr --with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/X11R6 --with-freetype-dir=/usr/X11R6 --with-xpm-dir=/usr/X11R6

BUT THIS ONE DOES (ON THE G5 AT LEAST):

MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS=" -arch ppc64 -g -Os -pipe -no-cpp-precomp" CCFLAGS=" -arch ppc64 -g -Os -pipe" CXXFLAGS="-arch ppc64  -g -Os -pipe" LDFLAGS=" -arch ppc64  -bind_at_load" ./configure --with-zlib-dir=/usr --with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/X11R6 --with-freetype-dir=/usr/X11R6 --with-xpm-dir=/usr/X11R6