Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 5444 - apache segfaults when executing php script that uses gd
Summary: apache segfaults when executing php script that uses gd
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Donny Davies (RETIRED)
URL:
Whiteboard:
Keywords:
: 5216 11625 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-07-23 03:21 UTC by Vitaly Kushneriuk (RETIRED)
Modified: 2003-02-04 19:42 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
patch to make libgd.so (gentoo.patch,2.20 KB, patch)
2002-07-23 17:50 UTC, Vitaly Kushneriuk (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vitaly Kushneriuk (RETIRED) gentoo-dev 2002-07-23 03:21:21 UTC
The following php script causes apache to segfault when accessed through the
web, i.e. wget http://localhost/~user/test.php :
----------
<?php
$im = ImageCreateFromPng("test.png");
?>
----------
This happens with any png file. 


Some system info:

i686
php-mod-4.2.2  (That happened also with 4.2.1-r?)
net-www/apache-1.3.26-r3

# cat /var/db/pkg/dev-php/mod_php-4.2.2/USE 
3dnow apm avi crypt encode ipv6 jpeg kde libg++ mikmod mmx mpeg ncurses pdflib
qtmt quicktime spell truetype xml2 xmms xv gd gnome-libs alsa arts berkdb bonobo
cups esd gdbm gif gnome gpm gtk gtkhtml guile imlib java libwww motif mozilla
mysql nls oggvorbis opengl pam perl png postgres python qt readline sdl slang
ssl svga tcltk tcpd tiff X dga dvd evo maildir oss

# grep ^CFLAGS /etc/make.conf
CFLAGS="-march=i686 -O3 -pipe"
Comment 1 Donny Davies (RETIRED) gentoo-dev 2002-07-23 09:27:23 UTC
this has nothing to do with apache.  the problem is php with gd.

whomever is interested in fixing this, should first fix the libgd
ebuild to create/install a shared library.  currently i think it
only installs a static library, and i've seen reports about php
segfaulting when trying to open a gd .so library.  i guess it
dlopens it directly, which means its never going to find it
because it doesnt exist.

again, this is not an apache problem per se, its a problem with
php and libgd.  ie: there is nothing to 'fix' in the apache .ebuild
instead the fix is in either the php ebuild or the libgd ebuild
or both.

on another note, i've seen plenty projects that *require* a
libgd shared lib, and seeing as how we dont have one (last
time i checked anyway, this whole report i'm typing is from
memory) then we can't build them on gentoo until libgd gets
a shared library.

hth.
Comment 2 Vitaly Kushneriuk (RETIRED) gentoo-dev 2002-07-23 17:50:16 UTC
Created attachment 2512 [details, diff]
patch to make libgd.so

This patch for the libgd's Makefile to create and install libgd.so
Comment 3 Vitaly Kushneriuk (RETIRED) gentoo-dev 2002-07-23 17:52:38 UTC
I just submitted a patch for the libgd to compile and install  a shared library.
I recompiled dev-php/php and ldd shows that it actualy uses the libgd.so:
# ldd /usr/bin/php | grep libgd.so
	libgd.so => /usr/lib/libgd.so (0x40294000)

It didn't solve the ImageCreateFromPng problem tho. It still segfaults.
Comment 4 Donny Davies (RETIRED) gentoo-dev 2002-07-23 21:24:24 UTC
Hrmph; sorry it didnt work out!

I'm curious however; in your first post, you
mention the dev-php/mod_php package.  Then in
your last, you show ldd /usr/bin/php output,
and talk about the dev-php/php package.

I thought we were talking about dev-php/mod_php?
Comment 5 Vitaly Kushneriuk (RETIRED) gentoo-dev 2002-07-24 02:30:12 UTC
The original problem araised in the apache+mod_php, but then I
emerged dev-php/php to be able to strace the execution and check
if it's realy tries to load libgd.so. It didn't. I looked at the
php configure script and it looked like it can use both .a and .so,
but I proceeded to creating .so patch just to check it out.
The php still crashes, but at least we have libgd.so now.
[well, after you get it into the portage, as I don't have cvs access ;-]
I have enought kernel debugging at work lately, so spending the weekend
debugging php/gd doesn't look too appeling to me. Any more ideas of what can
be a problem?
Comment 6 Edward Roper 2002-08-06 02:55:30 UTC
php.net indicates it's a conflict of pdflib's png support and libpng... if
pdflib is compiled to use system libpng and not internal libpng it will
supposedly work... I'll verify in about 15, at least on pdflib being the culprit.
Comment 7 Edward Roper 2002-08-06 03:02:22 UTC
tada it is indeed a conflict of libpdf and libpng =P have fun fixing it... since
technically libpdf doesn't NEED libpng because of it's internal support yet if
libpdf is linked to php you can't use it's internal support but must instead
make libpdf use libpng. lol. Hope that makes sense.
Comment 8 Ryan Phillips (RETIRED) gentoo-dev 2002-08-07 03:48:13 UTC
*** Bug 5216 has been marked as a duplicate of this bug. ***
Comment 9 Ryan Phillips (RETIRED) gentoo-dev 2002-08-07 03:49:14 UTC
 I've tweaked the pdflib ebuild to use the system libpng library... Hopefully that fixes the problem 
Comment 10 SpanKY gentoo-dev 2002-12-05 09:33:53 UTC
*** Bug 11625 has been marked as a duplicate of this bug. ***
Comment 11 Ryan Phillips (RETIRED) gentoo-dev 2002-12-05 15:07:11 UTC
disabled libpng if libpdf is included 
Comment 12 Andrei Ivanov 2002-12-05 15:33:03 UTC
I've compiled my own apache and php, without libpdf, and apache still 
crashes... are you really sure that's the real problem ?

./configure --with-apxs=../../bin/apxs --prefix=/opt/php --with-config-file-
path=/opt/php --with-openssl=/usr \
--enable-sigchild --enable-magic-quotes --enable-ftp \
--with-gd=/usr --enable-gd-native-ttf --with-jpeg-dir=/usr --with-png-dir=/usr -
-with-zlib-dir=/usr \
--with-xpm-dir=/usr/X11R6 --with-freetype-dir=/usr --with-ttf=/usr --with-
t1lib=/usr \
--with-mysql=/usr --with-pgsql=/usr \
--with-mm=/usr --enable-sockets --enable-sysvsem --enable-sysvshm --enable-
inline-optimization