472,119 Members | 1,767 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

how to compile PHP with GD support?

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
6 37941
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
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
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
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
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
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.

Similar topics

3 posts views Thread by paul dallaire | last post: by
1 post views Thread by davmonster | last post: by
4 posts views Thread by Vince | last post: by
5 posts views Thread by Mark Shelor | last post: by
2 posts views Thread by Gustavo | last post: by
6 posts views Thread by Thomas Connolly | last post: by
3 posts views Thread by =?Utf-8?B?QWxleGFuZGVyIFd5a2Vs?= | last post: by
27 posts views Thread by CodeMonk3y | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.