Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 103811 - Apache segfaults with php script as ErrorDocument
Summary: Apache segfaults with php script as ErrorDocument
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-26 03:03 UTC by Markus Tacker
Modified: 2005-11-01 06:05 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Tacker 2005-08-26 03:03:59 UTC
I am using mod_php 5.1 from the PHP Overlay and Apache/2.0.54.

Setting a HTML file as ErrorDocument works.
I can reproduce this bug on another machine with the same setup.

+++ .htaccess
ErrorDocument 404 /phprewrite/404.php

+++ /phprewrite/404.php
<?php

    echo '<pre>';
    print_r($_REQUEST);
    echo '</pre>';

?>
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2005-08-26 04:18:49 UTC
Cannot reproduce this, please post your emerge --info. Some strace will be
needed as well. See Bug 99086, comment #13 if unsure how to do this.
Comment 2 Markus Tacker 2005-08-26 05:29:53 UTC
(In reply to comment #1)
> Cannot reproduce this, please post your emerge --info. Some strace will be
> needed as well. See Bug 99086, comment #13 if unsure how to do this.

# strace /usr/sbin/apache2 -X -k start -D PHP5
[{fd=9, events=POLLIN}], 1, 15000) = 0
gettimeofday({1125059366, 771724}, NULL) = 0
shutdown(9, 1 /* send */)               = 0
poll([{fd=9, events=POLLIN}], 1, 2000)  = 0
close(9)                                = 0
read(4, 0xbfae42e7, 1)                  = -1 EAGAIN (Resource temporarily
unavailable)
accept(3, {sa_family=AF_INET, sin_port=htons(49598),
sin_addr=inet_addr("127.0.0.1")}, [16]) = 9
getsockname(9, {sa_family=AF_INET, sin_port=htons(80),
sin_addr=inet_addr("127.0.0.1")}, [16]) = 0
fcntl64(9, F_GETFL)                     = 0x2 (flags O_RDWR)
fcntl64(9, F_SETFL, O_RDWR|O_NONBLOCK)  = 0
read(9, "GET /rewrite/asdljk HTTP/1.1\r\nHo"..., 8000) = 404
gettimeofday({1125059371, 929322}, NULL) = 0
stat64("/var/www/localhost/htdoc/rewrite/asdljk", 0xbfae402c) = -1 ENOENT (No
such file or directory)
lstat64("/var", {st_mode=S_IFDIR|0755, st_size=360, ...}) = 0
lstat64("/var/www", {st_mode=S_IFDIR|0755, st_size=552, ...}) = 0
open("/var/www/.htaccess", O_RDONLY)    = -1 ENOENT (No such file or directory)
lstat64("/var/www/localhost", {st_mode=S_IFDIR|0755, st_size=192, ...}) = 0
open("/var/www/localhost/.htaccess", O_RDONLY) = -1 ENOENT (No such file or
directory)
lstat64("/var/www/localhost/htdoc", {st_mode=S_IFLNK|0777, st_size=25, ...}) = 0
stat64("/var/www/localhost/htdoc", {st_mode=S_IFDIR|0755, st_size=232, ...}) = 0
open("/var/www/localhost/htdoc/.htaccess", O_RDONLY) = -1 ENOENT (No such file
or directory)
lstat64("/var/www/localhost/htdoc/rewrite", {st_mode=S_IFDIR|0755, st_size=128,
...}) = 0
open("/var/www/localhost/htdoc/rewrite/.htaccess", O_RDONLY) = 10
fstat64(10, {st_mode=S_IFREG|0644, st_size=73, ...}) = 0
read(10, "ErrorDocument 404 /rewrite/404.p"..., 4096) = 73
read(10, "", 4096)                      = 0
close(10)                               = 0
lstat64("/var/www/localhost/htdoc/rewrite/asdljk", 0xbfae400c) = -1 ENOENT (No
such file or directory)
getpid()                                = 20530
gettimeofday({1125059372, 6337}, NULL)  = 0
write(6, "[Fri Aug 26 14:29:32 2005] [erro"..., 115) = 115
stat64("/var/www/localhost/htdoc/rewrite/404.php", {st_mode=S_IFREG|0644,
st_size=72, ...}) = 0
getpid()                                = 20530
getcwd("/root", 4096)                   = 6
time(NULL)                              = 1125059372
lstat64("/var", {st_mode=S_IFDIR|0755, st_size=360, ...}) = 0
lstat64("/var/www", {st_mode=S_IFDIR|0755, st_size=552, ...}) = 0
lstat64("/var/www/localhost", {st_mode=S_IFDIR|0755, st_size=192, ...}) = 0
lstat64("/var/www/localhost/htdoc", {st_mode=S_IFLNK|0777, st_size=25, ...}) = 0
readlink("/var/www/localhost/htdoc", "/var/www/localhost/htdocs", 4096) = 25
lstat64("/var", {st_mode=S_IFDIR|0755, st_size=360, ...}) = 0
lstat64("/var/www", {st_mode=S_IFDIR|0755, st_size=552, ...}) = 0
lstat64("/var/www/localhost", {st_mode=S_IFDIR|0755, st_size=192, ...}) = 0
lstat64("/var/www/localhost/htdocs", {st_mode=S_IFDIR|0755, st_size=232, ...}) = 0
lstat64("/var/www/localhost/htdocs/rewrite", {st_mode=S_IFDIR|0755, st_size=128,
...}) = 0
lstat64("/var/www/localhost/htdocs/rewrite/404.php", {st_mode=S_IFREG|0644,
st_size=72, ...}) = 0
open("/var/www/localhost/htdocs/rewrite/404.php", O_RDONLY) = 10
fstat64(10, {st_mode=S_IFREG|0644, st_size=72, ...}) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++

# emerge --info
Portage 2.0.51.22-r2 (default-linux/x86/2005.0, gcc-3.3.5-20050130,
glibc-2.3.5-r1, 2.6.12-gentoo-r9 i686)
=================================================================
System uname: 2.6.12-gentoo-r9 i686 AMD Athlon(tm) Processor
Gentoo Base System version 1.6.13
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled]
ccache version 2.3 [disabled]
dev-lang/python:     2.3.5
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6
sys-devel/binutils:  2.15.92.0.2-r10
sys-devel/libtool:   1.5.18-r1
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O3 -march=athlon -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env
/usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O3 -march=athlon -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig buildpkg distcc distlocks fixpackages sandbox sfperms strict"
GENTOO_MIRRORS="ftp://ftp.tu-clausthal.de/pub/linux/gentoo/
ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo
http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/
ftp://linux.rz.ruhr-uni-bochum.de/gentoo-mirror/
rsync://linux.rz.ruhr-uni-bochum.de/gentoo/
http://mirrors.sec.informatik.tu-darmstadt.de/gentoo
rsync://mirrors.sec.informatik.tu-darmstadt.de/gentoo
http://ftp.uni-erlangen.de/pub/mirrors/gentoo
ftp://ftp.uni-erlangen.de/pub/mirrors/gentoo
ftp://ftp.join.uni-muenster.de/pub/linux/distributions/gentoo
rsync://ftp.join.uni-muenster.de/gentoo/"
LINGUAS="de"
MAKEOPTS="-j19"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 3dnow 3dnowex 3dnowext X aac acl alsa apache2 apm arts avi berkdb
bitmap-fonts crypt cups curl emboss encode esd fam foomaticdb fortran gd gdbm
gif gpm gstreamer gtk gtk2 gtkhtml hal imagemagick imap imlib ipv6 java jpeg
junit kde ldap libg++ libwww mad mikmod mmext mmx motif mozilla mp3 mysql
ncurses network nls ogg opengl pam pdflib pic png python qt quicktime readline
real samba sdl slang spell sqlite sse ssl svga tcltk tcpd tiff truetype
truetype-fonts type1-fonts vhosts win32codecs xml2 xv xvid zlib
video_cards_radeon linguas_de userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS
Comment 3 Jakub Moc (RETIRED) gentoo-dev 2005-08-26 13:16:03 UTC
You need to reopen the bug, otherwise noone will probably notice again.
Comment 4 Luca Longinotti (RETIRED) gentoo-dev 2005-09-17 15:49:03 UTC
fstat64(10, {st_mode=S_IFREG|0644, st_size=72, ...}) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---

This seems to be an LFS (LargeFilesSupport) problem.
Please recompile your apr/apr-util/apache/php like outlined in [1].
Best regards, CHTEKK.

[1] http://www.gentoo.org/doc/en/apache-troubleshooting.xml#doc_chap3
Comment 5 Jakub Moc (RETIRED) gentoo-dev 2005-09-17 15:49:54 UTC
See above and report back, please. Thanks.
Comment 6 Markus Tacker 2005-10-27 12:13:46 UTC
I remerge all according to [1].
The problem still exists.

[{fd=9, events=POLLIN}], 1, 15000) = 0
gettimeofday({1130440263, 962105}, NULL) = 0
shutdown(9, 1 /* send */)               = 0
poll([{fd=9, events=POLLIN}], 1, 2000)  = 0
close(9)                                = 0
read(4, 0xbff95167, 1)                  = -1 EAGAIN (Resource temporarily
unavailable)
accept(3, {sa_family=AF_INET, sin_port=htons(37283),
sin_addr=inet_addr("192.168.0.210")}, [16]) = 9
getsockname(9, {sa_family=AF_INET, sin_port=htons(80),
sin_addr=inet_addr("192.168.0.202")}, [16]) = 0
fcntl64(9, F_GETFL)                     = 0x2 (flags O_RDWR)
fcntl64(9, F_SETFL, O_RDWR|O_NONBLOCK)  = 0
read(9, "GET /phprewrite/404ps.php HTTP/1"..., 8000) = 475
gettimeofday({1130440266, 371267}, NULL) = 0
stat64("/var/www/www.tacker.org/htdoc/phprewrite/404ps.php", 0xbff94eac) = -1
ENOENT (No such file or directory)
lstat64("/var", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/var/www", {st_mode=S_IFLNK|0777, st_size=22, ...}) = 0
stat64("/var/www", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/var/www/.htaccess", O_RDONLY)    = -1 ENOENT (No such file or directory)
lstat64("/var/www/www.tacker.org", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/var/www/www.tacker.org/.htaccess", O_RDONLY) = -1 ENOENT (No such file or
directory)
lstat64("/var/www/www.tacker.org/htdoc", {st_mode=S_IFDIR|0755, st_size=4096,
...}) = 0
open("/var/www/www.tacker.org/htdoc/.htaccess", O_RDONLY) = 10
fstat64(10, {st_mode=S_IFREG|0644, st_size=171, ...}) = 0
read(10, "RewriteEngine On\nRewriteRule   ^"..., 4096) = 171
read(10, "", 4096)                      = 0
close(10)                               = 0
lstat64("/var/www/www.tacker.org/htdoc/phprewrite", {st_mode=S_IFDIR|0755,
st_size=4096, ...}) = 0
open("/var/www/www.tacker.org/htdoc/phprewrite/.htaccess", O_RDONLY) = 10
fstat64(10, {st_mode=S_IFREG|0644, st_size=79, ...}) = 0
read(10, "ErrorDocument 404 /phprewrite/40"..., 4096) = 79
read(10, "", 4096)                      = 0
close(10)                               = 0
lstat64("/var/www/www.tacker.org/htdoc/phprewrite/404ps.php", 0xbff94e8c) = -1
ENOENT (No such file or directory)
gettimeofday({1130440266, 377922}, NULL) = 0
write(6, "[Thu Oct 27 21:11:06 2005] [erro"..., 146) = 146
stat64("/var/www/www.tacker.org/htdoc/phprewrite/404.php",
{st_mode=S_IFREG|0644, st_size=72, ...}) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++

[1] http://www.gentoo.org/doc/en/apache-troubleshooting.xml#doc_chap3
Comment 7 Luca Longinotti (RETIRED) gentoo-dev 2005-10-27 13:25:30 UTC
Thanks for the backtrace, anyway this problem is known with PHP it seems,
especially with 5.1 releases so far.
See http://bugs.php.net/bug.php?id=33987 and
http://bugs.php.net/bug.php?id=34249 for that, the bugs were fixed in CVS it
seems. Now, the PHP Overlays [1] dev-lang/php releases 5.0.4-r2 and 5.0.5-r2
include the latest fixes to that file, please try using those, wich should fix
your problem. For PHP 5.1, as there are only RC's out yet and especially the
actual RC3 is a little buggy, there is no support from us, the PHP Overlay's 5.1
ebuilds are only there for testing and should not be used on real systems, also
nothing will be fixed in them before a 5.1.0 final release comes out.
Best regards, CHTEKK.1

[1] http://svn.gnqs.org/projects/gentoo-php-overlay/
Comment 8 Markus Tacker 2005-11-01 06:05:36 UTC
The problems are gone now with PHP 5.1.0RC4.
Thanks alot.