Richard
More people have asked for including the GD module in this documentation set. So I finally had the time to research this and write it up and give this to you.
First download the source code from the Freshmeat libjpeg project. I’ve used the source file jpegsrc.v6b.tar.gz.
First unpack the source code and then go into the folder “jpeg-6b” for the source and execute the following commands:
cp /usr/share/libtool/config.guess .
Which will copy these files to the current directory. They are required for the configuration fase of this installation.
Next for 64 bits systems use:
CFLAGS="-arch x86_64" \
CXXFLAGS="-arch x86_64" \
LDFLAGS="-arch x86_64" \
./configure --enable-shared
For 32 bits systems use:
./configure --enable-shared
For all use
To compile and
To install the library.
Next step is to recompile the php installation as described on these two pages:
Compiling PHP in 32 bits mode on Leopard
Compiling PHP in 64 bits mode on Leopard
The only change you need to make is to add:
--with-jpeg-dir=/usr/local/lib \
--with-png-dir=/usr/X11R6 \
--with-freetype-dir=/usr/X11R6 \
--with-xpm-dir=/usr/X11R6 \
To the configure statement and it will include this library for you.
For example:
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--sysconfdir=/etc \
--with-zlib \
--with-zlib-dir=/usr \
--with-openssl \
--enable-exif \
--enable-ftp \
--enable-mbstring \
--enable-mbregex \
--enable-sockets \
--with-gd \
--with-jpeg-dir=/usr/local/lib \
--with-png-dir=/usr/X11R6 \
--with-freetype-dir=/usr/X11R6 \
--with-xpm-dir=/usr/X11R6 \
--with-mysql=/usr/local/mysql \
--with-pdo-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-apxs2=/usr/local/apache2/bin/apxs



Comments
4:06 am
I would suggest adding the following code just before running ./configure from the gd-version directory. I always found it necessary on a fresh system.
sudo ln -s /usr/X11R6/include/fontconfig /usr/local/include
ln -s `which glibtool` ./libtool
Not sure why, but gd didn’t like it if i didn’t do this first.
Drew
8:25 am
Drew, I’m not an avid PHP coder myself and I haven’t tested the GD code myself but others ensured me this aproach worked for them. WIth the PHP configure fase we are referencing the X11R6 font stuff and everything compiled and ran wothout errors. Even on a fresh clean install of Mac OS X Leopard.
9:22 pm
on a MacBook G4 running 10.5.6 I’m getting this error after ‘sudo make install’
/usr/bin/install -c -m 644 ./cjpeg.1 /usr/local/man/man1/cjpeg.1
install: /usr/local/man/man1/cjpeg.1: No such file or directory
make: *** [install] Error 71
9:28 pm
after ‘make’ and before ‘sudo make install’ I issued the following commands and now it finished without errors:
mkdir -p /usr/local/include
mkdir -p /usr/local/bin
mkdir -p /usr/local/lib
mkdir -p /usr/local/man/man1
5:30 am
I’m curious why you didn’t use macports and install php5-gd?
4:46 pm
FYI, on Snow Leopard I’m seeing a subfolder config in libtool, so the paths are:
cp /usr/share/libtool/config/config.sub .
cp /usr/share/libtool/config/config.guess .
6:44 am
[...] before attempting install to prevent error 71 as noted in the comment by Tehkemo below and on DIYMacServer.com [...]
4:18 am
Hi Richard I’ve successfully installed php5 off your guide then I went back and tried adding the mcrypt and GD module. Those installed successfully but now that I try recompiling php I get the following error after MAKE
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: Undefined symbols:
_png_check_sig
collect2: ld returned 1 exit status
make: *** [libs/libphp5.bundle] Error 1
These are the configurations I used:
./configure –prefix=/usr/local/php5 \
–mandir=/usr/share/man \
–infodir=/usr/share/info \
–sysconfdir=/etc \
–with-config-file-path=/etc \
–with-zlib \
–with-zlib-dir=/usr \
–with-openssl \
–without-iconv \
–enable-exif \
–enable-ftp \
–enable-mbstring \
–enable-mbregex \
–enable-sockets \
–with-gd \
–with-jpeg-dir=/usr/local/lib \
–with-png-dir=/usr/X11R6 \
–with-freetype-dir=/usr/X11R6 \
–with-xpm-dir=/usr/X11R6 \
–with-mcrypt \
–with-mysql=/usr/local/mysql \
–with-pdo-mysql=/usr/local/mysql \
–with-mysqli=/usr/local/mysql/bin/mysql_config \
–with-apxs2=/usr/local/apache2/bin/apxs
Any idea what it could be. Thanks in advance.