building PHP w/ gd on MacOS X


i want to build php with gd on my macos x.

first i installed all libraries (zlib, pnglib and jpeg) and then installed gd. after this i wanted to compile php for gd.

"./configure" was ok but then with "make" the following error came:

Making all in ext
Making all in gd
/bin/sh /Users/firewall/Desktop/php-4.0.5/libtool --silent --mode=compile cc -I. -I/Users/firewall/Desktop/php-4.0.5/ext/gd -I/Users/firewall/Desktop/php-4.0.5/main -I/Users/firewall/Desktop/php-4.0.5 -I/usr/include/httpd -I/Users/firewall/Desktop/php-4.0.5/Zend -I/usr/local/include -I/Users/firewall/Desktop/php-4.0.5/ext/mysql/libmysql -I/Users/firewall/Desktop/php-4.0.5/ext/xml/expat/xmltok -I/Users/firewall/Desktop/php-4.0.5/ext/xml/expat/xmlparse -I/Users/firewall/Desktop/php-4.0.5/TSRM -traditional-cpp -DDARWIN -DUSE_HSREGEX -DUSE_EXPAT -DHARD_SERVER_LIMIT=1024 -DEAPI -DSUPPORT_UTF8 -DXML_BYTE_ORDER=21 -g -O2 -c gd.c
gd.c:91: conflicting types for `gdIOCtx'
/usr/local/include/gd_io.h:18: previous declaration of `gdIOCtx'
make[3]: *** [gd.lo] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

do you have any idea what the problem is?

gd.c:91: conflicting types for `gdIOCtx'
/usr/local/include/gd_io.h:18: previous declaration of `gdIOCtx'

gdIOtx has been declarated as two different types (int and string for example).
look at the source in /usr/local/include/gd_io.h and try to figure out which type it should be.

Otherwise something is wrong with your gd installation.
I don't know the particlulars of your error but I have finally got gd running doing the following:

First build gd as explained by Scott Anguish at Stepwise:

Next you need to build PHP, here is what I did

mkdir build-php-4.0.5
cd build-php-4.0.5

gnutar -xzf php-4.0.5.tar.gz

mv \

pushd php-4.0.5

./configure \
--with-xml \
--with-zlib \
--with-jpeg-dir=/usr/local \
--with-gd=/usr/local \

sudo make install
sudo cp php.ini-dist /usr/local/lib/php.ini

This was just Scott's PHP instructions appended to add the gd & jpeg extentions. If you do not add the jpeg extention, you will not be able to use gd to manipulate jpegs. Just as a note, although the jpeg and gd libraries are located at /usr/local/lib PHP for some dumb reason appends /lib to the paths. It took me several hours of frustration trying to figure out way I was getting incorrect path errors during the build.

Now if someone can get NetPBM working I'll be set.:D