Click to See Complete Forum and Search --> : Compiling for PNG support


tarmes
10-21-2002, 11:34 AM
Hi,

I'm trying to add support for the ImagePng command in PHP. I have PHP version 4.2.3 and I am configuring it with the following parameters:

./configure --with-mysql --with-apxs=/www/bin/apxs --enable-track-vars --with-gd=/usr/local/gd-1.8.4 --with-freetype-dir=/usr/l
ocal/freetype-2.1.2 --with-zlib-dir=/usr/local/zlib-1.1.4 --with-png-dir=/usr/local/libpng-1.2.5

The compilation works fine, and I've restarted the server etc. PHP reports that GD is linked in with freetype and WBMP support. No mention is made of PNG, but then I don't know if it would mention it.

When I try a script that uses the imagepng command I get the following error:

Call to undefined function: imagepng()

I've run the 'gddemo' program and that creates a Png without any problems.

Can anyone shed some light on the problem?

Thanks,

Tim

MarkE
10-22-2002, 07:59 AM
Tim,

this is my LOCAL "road map" to image creation. Please note that you will need to correct all paths etc to your situation! ive listed all the steps i took when compiling. i've discovered the order of steps taken is very important


[1] LIBPNG
cd libpng
cp scripts/makefile.linux ./Makefile
make
make install

[2] LIBJPEG
cd libjpeg
./configure
make
make test
make install
make install-lib
make install-headers

[3] ZLIB
cd zlib
./configure
make test
make install

[4] GD
cd gd
edit Makefile: CFLAGS=-O -DHAVE_LIBPNG -DHAVE_LIBJPEG
LIBS=-lgd -lpng -lz -ljpeg -lm
make distclean
make
make install

[6] APACHE
cd apache_1.3.26
./ configure

[7] PHP
make distclean
./configure
--with-apache=../apache_1.3.26
--with-mysql=/r/mysql
--with-config-file-path=/r/php
--prefix=/r/php
--with-gd
--with-jpeg-dir
--with-png-dir
--with-zlib-dir
--enable-gd-native-tt
// optional...
--enable-gd-imgstrttf
// optional...
--with-freetype-dir=/usr/local/include/freetype2
// optional...
--enable-tracking-vars
make
make install

[8] APACHE
cd apache_xxxx
./configure
--prefix=/r/apache
--activate-module=src/modules/php4/libphp4.a
make

/r/apache/bin/apachectl stop
cp src/httpd /r/apache/bin/httpd (overwrite: YES)
/r/apache/bin/apachectl start

tarmes
10-22-2002, 08:17 AM
Hi,

I've discovered that the problem was quite subtle. PHP was initially compliled with PNG support, and this fact gets remembered in a file called cache.conf. When reconfiguring, the check for gdCreateImageFromPng wasn't run, instead the previously cached result was used.

I removed this line from the cached results and all is well,

Thanks,

Tim