By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,406 Members | 1,470 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,406 IT Pros & Developers. It's quick & easy.

how to compile PHP with GD support?

P: n/a
Hello there,
I am tryin to compile PHP with GD support:

# cd php-4.3.11
# ./configure \
--with-gd=/usr/local/src/gd-2.0.33/ \
--with-png-dir=/usr/local/src/libpng-1.2.8/ \
--with-zlib-dir=/usr/local/src/zlib/ \
--with-jpeg-dir=/usr/local/src/jpeg-6b/

....
checking for GD support... yes
checking for the location of libpng... /usr/local/src/libpng-1.2.8/
If configure fails try --with-jpeg-dir=<DIR>
configure: error: libpng.(a|so) not found.

why libpng.(a|so) not found ?

# ls -l /usr/local/src/libpng-1.2.8/libpng.a
-rw-r--r-- 1 root wheel 160448 May 31 12:48
/usr/local/src/libpng-1.2.8/libpng.a

What is my mistake? Where to read about correct way for installing php
+ gd + libjpeg + libpng ?

Jul 17 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Encapsulin,
checking for the location of libpng... /usr/local/src/libpng-1.2.8/
If configure fails try --with-jpeg-dir=<DIR>
configure: error: libpng.(a|so) not found.

why libpng.(a|so) not found ?

# ls -l /usr/local/src/libpng-1.2.8/libpng.a
-rw-r--r-- 1 root wheel 160448 May 31 12:48
/usr/local/src/libpng-1.2.8/libpng.a

What is my mistake? Where to read about correct way for installing php
+ gd + libjpeg + libpng ?


You may wish to check the PHP manual:
http://us3.php.net/manual/en/ref.image.php

If it doesn't find libpng, libjpeg or libxpm it can fail.
You may wish to specify the directory...
--with-jpeg-dir=DIR --with-png-dir=DIR --with-xpm-dir=DIR

Also note that libpng requires the zlib library :) so you may need to
add --with-zlib-dir=DIR

Hope that helps.

Mike
Jul 17 '05 #2

P: n/a
ljb
en********@gmail.com wrote:
Hello there,
I am tryin to compile PHP with GD support:

# cd php-4.3.11
# ./configure \
--with-gd=/usr/local/src/gd-2.0.33/ \
--with-png-dir=/usr/local/src/libpng-1.2.8/ \
--with-zlib-dir=/usr/local/src/zlib/ \
--with-jpeg-dir=/usr/local/src/jpeg-6b/

...
checking for GD support... yes
checking for the location of libpng... /usr/local/src/libpng-1.2.8/
If configure fails try --with-jpeg-dir=<DIR>
configure: error: libpng.(a|so) not found.

why libpng.(a|so) not found ?

# ls -l /usr/local/src/libpng-1.2.8/libpng.a
-rw-r--r-- 1 root wheel 160448 May 31 12:48
/usr/local/src/libpng-1.2.8/libpng.a

What is my mistake? Where to read about correct way for installing php
+ gd + libjpeg + libpng ?


If you say --with-png-dir=X, then PHP configure will look for
"X/lib/libpng.a" or "X/lib/libpng.so" (or whatever replaces .so on
your platform). Note the "/lib/" that gets inserted after your path.
Configure expects a certain directory structure where lib/ and include/
directories can be found under a common root ("X") directory. With
your setup, that won't work. You probably should actually install the
libraries (zlib, libpng, jpeg).
Jul 17 '05 #3

P: n/a
Ok, thank you all for your comments,
but i still not shure, what is wrong.

I have read http://us3.php.net/manual/en/ref.image.php
that manual said, that GD supports GIF by default. Ok, let me start
with gifs:

1) compilling GD:

# cd /usr/local/src/gd-2.0.33
# env CPPFLAGS="-I../zlib -I../libpng-1.2.8" LDFLAGS="-L../zlib
-L../libpng-1.2.8"
\
../configure --disable-shared --without-freetype --without-jpeg
# make
# cp .libs/* .
# ./gddemo
(gddemo generates demoout.gif,demoout.png, so, GD is compilled and
works)

2) compilling php:

# cd /usr/local/src/php-4.3.9
# ./configure \
--with-gd=/usr/local/src/gd-2.0.33
--with-apxs=/usr/local/apache/bin/apxs --with
-mysql
# make

ext/mysql/libmysql/my_tempnam.lo: In function `my_tempnam':
/usr/local/src/php-4.3.9/ext/mysql/libmysql/my_tempnam.c:115: warning:
tempnam() possibly used unsafely; consider using mkstemp()
ext/gd/gd.lo: In function `zm_deactivate_gd':
/usr/local/src/php-4.3.9/ext/gd/gd.c:390: undefined reference to
`gdFreeFontCache'
*** Error code 1

Stop in /usr/local/src/php-4.3.9.

What is wrong now?
Many thanks.

Jul 17 '05 #4

P: n/a
Well, i have read
http://www.onlamp.com/pub/a/php/2003/03/27/php_gd.html

And now i have GD (png,gif) with my php engine, but jpeg still not
supported:

1)compiling jpeg lib:
# cd /usr/local/src/jpeg-6b
# ./configure --prefix=/usr && make && make install

2) compiling php:
# cd /usr/local/src/php-4.3.9
# ./configure --with-gd --with-zlib-dir=/usr/include
--with-apxs=/usr/local/apache/bin/apxs --with-
mysql --with-jpeg-dir=../jpeg-6b
# make clean && make && make install

/usr/local/src/php-4.3.9/ext/gd/libgd/gd_jpeg.c:42:21: jpeglib.h: No
such file or directory
/usr/local/src/php-4.3.9/ext/gd/libgd/gd_jpeg.c:43:20: jerror.h: No
such file or directory
/usr/local/src/php-4.3.9/ext/gd/libgd/gd_jpeg.c:53: error: syntax error
before "cinfo"
/usr/local/src/php-4.3.9/ext/gd/libgd/gd_jpeg.c: In function
`fatal_jpeg_error':
/usr/local/src/php-4.3.9/ext/gd/libgd/gd_jpeg.c:58: error: `cinfo'
undeclared (first use in this function)
....
/usr/local/src/php-4.3.9/ext/gd/libgd/gd_jpeg.c:764: error: `outfile'
undeclared (first use in this function)
*** Error code 1

Stop in /usr/local/src/php-4.3.9.

Jul 17 '05 #5

P: n/a
ljb
en********@gmail.com wrote:
Well, i have read
http://www.onlamp.com/pub/a/php/2003/03/27/php_gd.html

And now i have GD (png,gif) with my php engine, but jpeg still not
supported:

1)compiling jpeg lib:
# cd /usr/local/src/jpeg-6b
# ./configure --prefix=/usr && make && make install

2) compiling php:
# cd /usr/local/src/php-4.3.9
# ./configure --with-gd --with-zlib-dir=/usr/include
--with-apxs=/usr/local/apache/bin/apxs --with-
mysql --with-jpeg-dir=../jpeg-6b
# make clean && make && make install

/usr/local/src/php-4.3.9/ext/gd/libgd/gd_jpeg.c:42:21: jpeglib.h: No
such file or directory


You have to point your PHP configure to where the jpeg library got
installed, not where it was built (so it can find headers and such).
Try: --with-jpeg-dir=/usr

Jul 17 '05 #6

P: n/a
hello guys. where can i find more information on simply learning how
to configure. i'm reading through php manual as i'm trying to get gd
installed with jpep support. however, i'm not sure what i'm doing.
i've gone through a few sites with incomplete details. my system was
built buth php 4.2.2 as the default. i can't even find the directory.
any help is greatly appreciated. thanks.

Jul 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.