Ok i installed both now so here what i did
libpng 1.2.16
./configure --prefix=/usr/local/libpng
make
make install
for jpeg6b (libjpeg)
./configure (using default prefix /usr/local)
make
make install
i then used the following for the php5 configure after i've run make clean again
'./configure' '--with-mysql=/usr/local/mysql' '--without-sqlite' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-zlib' '--with-gd=/usr/local/gd' '--with-iconv-dir' '--with-png=/usr/local/libpng' '--with-jpeg=/usr/local'
this runs ok and thought it was there but now i get the following when i run make
ext/gd/.libs/gd.o: In function `zif_imagecreatefromstring':
/home/matt/php-5.2.0/ext/gd/gd.c:2300: undefined reference to `gdImageCreateFromPngCtx'
ext/gd/.libs/gd.o: In function `zif_imagecreatefrompng':
/home/matt/php-5.2.0/ext/gd/gd.c:2502: undefined reference to `gdImageCreateFromPngCtx'
/home/matt/php-5.2.0/ext/gd/gd.c:2502: undefined reference to `gdImageCreateFromPng'
ext/gd/.libs/gd.o: In function `zif_imagepng':
/home/matt/php-5.2.0/ext/gd/gd.c:2742: undefined reference to `gdImagePngCtxEx'
ext/gd/.libs/gd.o: In function `_php_image_convert':
/home/matt/php-5.2.0/ext/gd/gd.c:4751: undefined reference to `gdImageCreateFromPng'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
any ideas?