Connecting Tech Pros Worldwide Forums | Help | Site Map

how to compile PHP with GD support?

Encapsulin
Guest
 
Posts: n/a
#1: Jul 17 '05
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 ?


Mike Willbanks
Guest
 
Posts: n/a
#2: Jul 17 '05

re: how to compile PHP with GD support?


Encapsulin,[color=blue]
> 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 ?[/color]

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
ljb
Guest
 
Posts: n/a
#3: Jul 17 '05

re: how to compile PHP with GD support?


encapsulin@gmail.com wrote:[color=blue]
> 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 ?[/color]

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).
Encapsulin
Guest
 
Posts: n/a
#4: Jul 17 '05

re: how to compile PHP with GD support?


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.

Encapsulin
Guest
 
Posts: n/a
#5: Jul 17 '05

re: how to compile PHP with GD support?


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.

ljb
Guest
 
Posts: n/a
#6: Jul 17 '05

re: how to compile PHP with GD support?


encapsulin@gmail.com wrote:[color=blue]
> 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[/color]

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

cle.arodef
Guest
 
Posts: n/a
#7: Jul 17 '05

re: how to compile PHP with GD support?


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.

Closed Thread