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"
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.
Created attachment 2512 [details, diff] patch to make libgd.so This patch for the libgd's Makefile to create and install libgd.so
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.
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?
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?
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.
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.
*** Bug 5216 has been marked as a duplicate of this bug. ***
I've tweaked the pdflib ebuild to use the system libpng library... Hopefully that fixes the problem
*** Bug 11625 has been marked as a duplicate of this bug. ***
disabled libpng if libpdf is included
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