|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-04-25 21:23 UTC] daniel at pressure dot net dot nz
<?php
header ("Content-type: image/png");
$im = @imagecreate (50, 100)
or die ("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate ($im, 255, 255, 255);
$text_color = imagecolorallocate ($im, 233, 14, 91);
imagestring ($im, 1, 5, 5, "A Simple Text String", $text_color);
imagepng ($im);
?>
generates a reproducable segfault in DSO, CGI and CLI versions. GD is version 1.8.4, although segfaults also occurred with 2.0.1. Libpng is 1.2.1, zlib is 1.1.4.
Compiling PHP 4.1.2 identically does not produce the segfault.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 12:00:02 2025 UTC |
backtrace follows: #0 0xa81 in ?? () #1 0x400d1468 in png_create_write_struct_2 () from /usr/lib/libpng.so.3 #2 0x400d12c9 in png_create_write_struct () from /usr/lib/libpng.so.3 #3 0x8169099 in gdImagePngCtx () #4 0x80ef360 in _php_image_output_ctx (ht=1, return_value=0x8210fe4, this_ptr=0x0, return_value_used=0, image_type=2, tn=0x8187b4b "PNG", func_p=0x8169030 <gdImagePngCtx>) at gd_ctx.c:94 #5 0x80f14be in zif_imagepng (ht=1, return_value=0x8210fe4, this_ptr=0x0, return_value_used=0) at gd.c:1479 #6 0x815436a in execute (op_array=0x82111ac) at ./zend_execute.c:1598 #7 0x80cf919 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at zend.c:810 #8 0x806b3f1 in php_execute_script (primary_file=0xbffff9c4) at main.c:1381 #9 0x8065821 in main (argc=2, argv=0xbffffa54) at cgi_main.c:785 #10 0x4019774f in __libc_start_main () from /lib/libc.so.6I experienced a similar thing with PHP-4.2.1 + pdflib-4.0.2 on Linux (glibc-2.2.3). However, recompiling pdflib with: "--with-pnglib --with-zlib" (and then rebuilding PHP) solved the problem. My backtrace from before recompiling pdflib was a bit different, I'm including it here in case it might be of interest: Program received signal SIGSEGV, Segmentation fault. 0x251 in ?? () (gdb) bt #0 0x251 in ?? () #1 0x80f0010 in _php_image_output_ctx (ht=1, return_value=0x82fc314, this_ptr=0x0, return_value_used=0, image_type=2, tn=0x818c38b "PNG", func_p=0x816c010 <gdImagePngCtx>) at gd_ctx.c:94 #2 0x80f21d2 in zif_imagepng (ht=1, return_value=0x82fc314, this_ptr=0x0, return_value_used=0) at gd.c:1479 #3 0x8155bba in execute (op_array=0x82fc524) at ./zend_execute.c:1598 #4 0x80d0659 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at zend.c:810 #5 0x806c081 in php_execute_script (primary_file=0xbffff9b4) at main.c:1381 #6 0x80664b1 in main (argc=2, argv=0xbffffa44) at cgi_main.c:778 #7 0x3232eb in __libc_start_main () from /lib/libc.so.6 (gdb) frame 3 #3 0x8155bba in execute (op_array=0x82fc524) at ./zend_execute.c:1598 1598 ((zend_internal_function *) EX(function_state).function)->handle r(EX(opline)->extended_value, EX(Ts)[EX(opline)->result.u.var].var.ptr, EX(object).ptr, return_value_used TSRMLS_CC); (gdb) print (char *)(executor_globals.function_state_ptr->function)->common.function_name $1 = 0x818bd55 "imagepng"Hi .. I installed APACHE 1.3.27, GD 2.0.11 and PHP 4.3.1 on solaris 2.6 , but I got a fatal error on function imagepng(). Fatal error: Call to undefined function: imagepng() in /www/htdocs/png.php on line 8 How do i get imagepng() to work properly? You can see the details below: Install Apache 1.3.27 ************************* ./configure --prefix=/www --enable-module=so --with-port=82 make make install install GD 2.0.11 ******************* ./configure make make install Install PHP 4.3.1 ******************** ./configure --disable-all --with-gd=shared --with-apxs=/www/bin/apxs --enable-ftp --with-gd-dir=/usr/local/lib --with-jpeg-dir=/usr/lib --with-png-dir=/usr/local/lib --with-xpm-dir=/usr/X11R6 --with-ttf --with-zlib --with-oci8=$ORACLE_HOME --with-oracle=$ORACLE_HOME make make install file png.php *********************** <?php header ("Content-type: image/png"); $im = @imagecreate (50, 100) or die ("Cannot Initialize new GD image stream"); $background_color = imagecolorallocate ($im, 255, 255, 255); $text_color = imagecolorallocate ($im, 233, 14, 91); imagestring ($im, 1, 5, 5, "A Simple Text String", $text_color); imagepng ($im); ?> ****************** Fatal error: Call to undefined function: imagepng() in /www/htdocs/png.php on line 8