I'm using the following construct in one of my sites extensively: All the pages are .shtml files using server-side includes (SSI) for various snippets like headers, footers and the like. One of those includes is a menu. This one is special as it is a PHP file which gets executed. This has worked fine for years now. On Nov 1st I updated PHP to 5.0.5-r2, since then, all the files that #include both a plain and a PHP snippet will result in a segfault of the corresponding Apache worker (I'm using mpm_prefork). Steps to reproduce: Configure Apache to allow SSI on files ending in .shtml. Create a test file with two statements like this: <!--#include file="test1.shtml" --> <!--#include file="test2.php" --> The shtml file can contain just about anything you like, just don't put any PHP code there. Then, create test.php with any PHP code (in <?php... ?>) you like, I suggest something that changes with every reload like printing date and time. Try to load the shtml file in your browser and closely watch the server-wide error logfile, you should see a message about an Apache process receiving a SegV and dying. I updated to -r3 today, that did not help. I've also run Apache in gdb and created a backtrace - I'll attach it. I don't know if this is an upstream bug, but I doubt it since I haven't found anyone with the same problem. Maybe one of the numerous PHP patches is the culprit, but my C-fu is too weak to find out. emerge info: Portage 2.0.53_rc7 (default-linux/x86/2005.0, gcc-3.4.4, glibc-2.3.5-r3, 2.6.13 i686) ================================================================= System uname: 2.6.13 i686 Pentium III (Katmai) Gentoo Base System version 1.12.0_pre9 distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled] dev-lang/python: 2.3.5, 2.4.2 sys-apps/sandbox: 1.2.13 sys-devel/autoconf: 2.13, 2.59-r7 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1 sys-devel/binutils: 2.16.1 sys-devel/libtool: 1.5.20 virtual/os-headers: 2.6.11-r2 ACCEPT_KEYWORDS="x86 ~x86" AUTOCLEAN="yes" CBUILD="i686-pc-linux-gnu" CFLAGS="-O3 -march=pentium3 -pipe" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/2/share/config /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=pentium3 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoconfig distlocks sandbox sfperms strict userpriv usersandbox" GENTOO_MIRRORS="http://ftp.freenet.de/pub/ftp.snt.utwente.nl/pub/os/linux/gentoo/ http://mirrors.sec.informatik.tu-darmstadt.de/gentoo/ ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ " LANG="en_US" LC_ALL="en_US" MAKEOPTS="-j5" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync5.de.gentoo.org/gentoo-portage" USE="x86 acpi alsa apache2 apm bash-completion bcmath berkdb bitmap-fonts bzlib crypt cscope curl eds emboss encode esd exif exiscan-acl flatfile fortran ftp gd gdbm gif gmp gpm gstreamer gtk gtk2 iconv idea imagemagick imap imlib imlib2 ipv6 jabber java jpeg kde libg++ libwww mad maildir mbox memlimit mhash mikmod mime mng motif moznocompose moznoirc moznomail mp3 mpeg mpeg4 mpi mpm-prefork msn mysql ncurses nls ogg oggvorbis openssh oscar pam parse-clocks pcap pcre pdflib pear-db perl php plotutils png posix python readline session sharedmem simplexml skey slang spell sqlite sse ssl sysvipc tcltk tcpd tidy tiff truetype truetype-fonts type1 type1-fonts udev vorbis xchatnogtk xchattext xml xml2 xpm xsl yahoo zlib userland_GNU kernel_linux elibc_glibc" Unset: ASFLAGS, CTARGET, LDFLAGS, LINGUAS
Created attachment 72089 [details] gdb backtrace
To clarify: with "Try to load the shtml file in your browser" I mean loading the first file you created (the one with the include directives).
Hmm 5.0.5-r3 added a patch to prevent crashes with Apache2, but a part of that patch was faulty, so I fixed that and added 5.0.5-r4 to the tree, please test with that one and, if the problem persists, reopen the bug, thanks! Best regards, CHTEKK.
And if you reopen or anyways in the future, please provide useful GDB backtraces: you must compile with the USE flag "debug" enabled and add "-g -ggdb3" to your C[XX]FLAGS, as well as "nostrip" to your FEATURES. Also, a strace of what happens is useful to complement the GDB backtrace, for more informations on this please take a look at [1], thanks. Best regards, CHTEKK. [1] http://www.gentoo.org/doc/en/bugzilla-howto.xml#doc_chap2
Emerging -r4 did not help. I'll recompile with the proper debugging flags and provide a backtrace and an strace, but it will be a while until then since the machine isn't all that fast.
Another thing I noticed: it only happens if the included files are in a subdirectory. Sorry I forgot to mention that.
Created attachment 72096 [details] GDB log with proper debugging
Created attachment 72098 [details] strace log strace cmdline: strace -Ff -o strace.log /usr/sbin/apache2 -X -D PHP5 -D USERDIR -d /usr/lib/apache2 -f /etc/apache2/httpd.conf -k start
The PHP Manual has a note that including PHP sourcefiles via SSI is not supported, and was never intended to work.
So this means I've been using something that wasn't supposed to work for about three years? Strange. But well, that's how it is. Thanks and sorry for wasting your time.