[PHP-DOC] #17653 [Com]: FAQ: use same png libraries with PHP and GD. From: jean-christophe.aude <email protected>
Date: 01/30/03

 ID: 17653
 Comment by: jean-christophe.aude <email protected>
 Reported By: huberfelix <email protected>
 Status: Open
 Bug Type: Documentation problem
 Operating System: Linux
 PHP Version: 4.0CVS-2002-06-08
 New Comment:

Hi,
 
Sorry guys but i still have the same pb.
libpng1.2.5 + gd2.0.11 (no fix) + php4.3.0 (Stable).
everything is link with the same libraries :
 
% ldd /usr/lib/apache/libphp4.so
...
        libz.so.1 => /lib/libz.so.1 (0x40284000)
        libtiff.so.3 => /usr/lib/libtiff.so.3 (0x40293000)
        libpng12.so.0 => /usr/local/lib/libpng12.so.0
(0x402d9000)
        libgd.so.2 => /usr/local/lib/libgd.so.2
(0x40345000)
        libfreetype.so.6 => /usr/X11R6/lib/libfreetype.so.6
(0x4037d000)
        libX11.so.6 => /usr/X11R6/lib/libX11.so.6
(0x403c0000)
        libXpm.so.4 => /usr/X11R6/lib/libXpm.so.4
(0x40487000)
        libjpeg.so.62 => /usr/lib/libjpeg.so.62
(0x40497000)
...
and
 
$ ldd /usr/local/lib/libgd.so.2
...
libXpm.so.4 => /usr/X11R6/lib/libXpm.so.4 (0x4004f000)
        libX11.so.6 => /usr/X11R6/lib/libX11.so.6
(0x4005f000)
        libjpeg.so.62 => /usr/lib/libjpeg.so.62
(0x40126000)
        libfreetype.so.6 => /usr/lib/libfreetype.so.6
(0x40148000)
        libpng12.so.0 => /usr/local/lib/libpng12.so.0
(0x40190000)
        libz.so.1 => /lib/libz.so.1 (0x401c0000)
 
the back-trace gives..
 
#0 0x00000571 in ?? ()
#1 0x406be276 in png_create_info_struct () from
/usr/local/lib/libpng12.so.0
#2 0x4072f29d in gdImageCreateFromPngCtx
(infile=0x8103440) at gd_png.c:156
#3 0x4072f1cb in gdImageCreateFromPng (inFile=0x81031b0)
at gd_png.c:105
#4 0x4041e59b in _php_image_create_from (ht=1,
return_value=0x80fe9ac, this_ptr=0x0,
    return_value_used=1, image_type=2, tn=0x40564987 "PNG",
    func_p=0x4072f1a0 <gdImageCreateFromPng>,
    ioctx_func_p=0x4072f1e0 <gdImageCreateFromPngCtx>)
    at
/usr/local/src/Serveur-WEB/php-4.3.0/ext/gd/gd.c:1367
#5 0x4041e6bb in zif_imagecreatefrompng (ht=1,
return_value=0x80fe9ac, this_ptr=0x0,
    return_value_used=1) at
/usr/local/src/Serveur-WEB/php-4.3.0/ext/gd/gd.c:1413
#6 0x4055b00b in execute (op_array=0x80fe88c)
    at
/usr/local/src/Serveur-WEB/php-4.3.0/Zend/zend_execute.c:1596
#7 0x405487b0 in zend_execute_scripts (type=8, retval=0x0,
file_count=3)
    at /usr/local/src/Serveur-WEB/php-4.3.0/Zend/zend.c:864
#8 0x4050ed3b in php_execute_script
(primary_file=0xbffff3c0)
    at
/usr/local/src/Serveur-WEB/php-4.3.0/main/main.c:1573
#9 0x4056014e in apache_php_module_main (r=0x80f2b20,
display_source_mode=0)
    at
/usr/local/src/Serveur-WEB/php-4.3.0/sapi/apache/sapi_apache.c:55
#10 0x405610bc in send_php (r=0x80f2b20,
display_source_mode=0,
    filename=0x80f50c0
"/var/www/html/SadeLAB-WWW/Gel/TEST4.php")
    at
/usr/local/src/Serveur-WEB/php-4.3.0/sapi/apache/mod_php4.c:556
#11 0x40561135 in send_parsed_php (r=0x80f2b20)
    at
/usr/local/src/Serveur-WEB/php-4.3.0/sapi/apache/mod_php4.c:571
#12 0x080548a9 in ap_invoke_handler ()
#13 0x08067e30 in ap_die ()
#14 0x0806820f in ap_process_request ()
#15 0x0805ea47 in ap_update_child_status ()
#16 0x0805eca0 in ap_update_child_status ()
#17 0x0805f442 in ap_update_child_status ()
#18 0x0805fe09 in main ()
#19 0x4014c280 in __libc_start_main () from /lib/libc.so.6
 
The fact that both libraries are identical doesn't resolve
this bug..
Here is the buggy script.
 
<?php
header("Content-type: image/jpeg");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
 
 
$im = ImageCreateFromPNG("basn2c16.png");
ImageJPEG($im);
?>

Previous Comments:
------------------------------------------------------------------------

[2002-06-13 09:48:16] mfischer <email protected>

Yup, good idea, reclassifying.

------------------------------------------------------------------------

[2002-06-13 09:46:13] huberfelix <email protected>

Correct with libpng-1.0.8 as GD and PHP source it works fine...

an entry for the faq?

------------------------------------------------------------------------

[2002-06-09 10:41:18] sniper <email protected>

Forgot..make sure your GD library is linked with the SAME
libpng as PHP is.

--Jani

------------------------------------------------------------------------

[2002-06-09 10:40:32] sniper <email protected>

I just tried with libpng-1.2.0, latest PHP (4.3.0-dev) and gd 2.0.1
(the 'original' without our fixes) and could not
reproduce this segfault.

Please try the latest (non stable!) snapshot from
http://snaps.php.net/

--Jani

------------------------------------------------------------------------

[2002-06-09 07:27:27] huberfelix <email protected>

hmm i compiled cvs of today with --with-png-dir=/tmp/libpng-1.0.8

and still finds the newer libpng in /usr

0x00000049 in ?? ()
(gdb) bt
#0 0x00000049 in ?? ()
#1 0x00a33f49 in png_create_write_struct_2 () from
/usr/lib/libpng.so.3
#2 0x00a35371 in png_create_write_struct () from /usr/lib/libpng.so.3
#3 0x00aa6d59 in gdImagePngCtx (im=0x8172318, outfile=0x81722ec) at
gd_png.c:461
#4 0x0047ee80 in object.11 () from
/usr/local/apache/current/libexec/libphp4.so
#5 0x004838fa in object.11 () from
/usr/local/apache/current/libexec/libphp4.so
#6 0x005f8b07 in object.11 () from
/usr/local/apache/current/libexec/libphp4.so
#7 0x005e5dd4 in object.11 () from
/usr/local/apache/current/libexec/libphp4.so
#8 0x005aeca5 in object.11 () from
/usr/local/apache/current/libexec/libphp4.so
#9 0x005fde00 in object.11 () from
/usr/local/apache/current/libexec/libphp4.so
#10 0x005fed78 in object.11 () from
/usr/local/apache/current/libexec/libphp4.so
#11 0x005fee02 in object.11 () from
/usr/local/apache/current/libexec/libphp4.so
#12 0x08055fd9 in ap_invoke_handler ()
#13 0x0806bb4f in ap_some_auth_required ()
#14 0x0806bbba in ap_process_request ()
#15 0x08062756 in ap_child_terminate ()
#16 0x08062935 in ap_child_terminate ()
#17 0x08062ab6 in ap_child_terminate ()
#18 0x0806314d in ap_child_terminate ()
#19 0x080639cc in main ()
#20 0x0019b571 in __libc_start_main () from /lib/libc.so.6

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/17653

-- 
Edit this bug report at http://bugs.php.net/?id=17653&edit=1

-- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php