php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16475 segfault at startup with Apache 2.0.35
Submitted: 2002-04-07 10:36 UTC Modified: 2002-05-05 12:05 UTC
Votes:21
Avg. Score:4.9 ± 0.5
Reproduced:16 of 18 (88.9%)
Same Version:13 (81.2%)
Same OS:13 (81.2%)
From: sebastian dot wolfgarten at gmx dot net Assigned:
Status: Closed Package: Apache2 related
PHP Version: 4.2.0RC2-4 OS: Linux 2.4.x
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sebastian dot wolfgarten at gmx dot net
New email:
PHP Version: OS:

 

 [2002-04-07 10:36 UTC] sebastian dot wolfgarten at gmx dot net
Hi,

after a couple of days I successfully compiled php 4.2.0RC2 and RC3 on apache 2.0.35 and .36-dev. Unfortunately apache crashes immediately after being started without any message in any logfile. When I take the LoadModule directive out of the configfile apache runs fine. I spoke already to several other people and they just had the same problems. Also I tried to latest cvs snapshots of both of them but the result is still the same. I configured apache like this:

./configure --enable-layout=Apache --with-port=80 --enable-auth --enable-access --enable-charset-lite --enable-cache --enable-disk-cache --enable-mem-cache --enable-example --enable-mime-magic --enable-cern-meta --enable-expires --enable-headers --enable-usertrack --enable-unique-id --enable-setenvif --with-mpm=worker --enable-http --enable-vhost-alias --enable-rewrite --enable-so --enable-userdir

And my ./configure for php was:
./configure --with-png-dir --with-tiff-dir=/usr/local/lib --with-ttf --enable-bcmath --enable-url-includes --with-gd=/usr/local --with-jpeg-dir --with-zlib --with-mysql --enable-memory-limit --enable-sysvsem --enable-sysvshm --enable-trans-sid --with-pdflib --enable-ftp --enable-sockets --enable-magic-quotes --enable-track-vars --with-apxs2=/usr/local/apache2/bin/apxs --enable-versioning --with-xml --enable-calendar --with-inline-optimization --with-mcrypt --with-mhash=/usr/local/lib

"ldd libphp4.so":
diebels:/usr/local/apache2/modules# ldd libphp4.so
        libpdf.so.1 => /usr/local/lib/libpdf.so.1 (0x401ac000)
        libtiff.so.3 => /usr/local/lib/libtiff.so.3 (0x4023b000)
        libpng.so.3 => /usr/local/lib/libpng.so.3 (0x4027b000)
        libmhash.so.2 => /usr/local/lib/libmhash.so.2 (0x402b1000)
        libmcrypt.so.4 => /usr/local/lib/libmcrypt.so.4 (0x402d5000)
        libltdl.so.3 => /usr/local/lib/libltdl.so.3 (0x402db000)
        libttf.so.2 => /usr/local/lib/libttf.so.2 (0x402e2000)
        libjpeg.so.62 => /usr/local/lib/libjpeg.so.62 (0x40308000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x40326000)
        libresolv.so.2 => /lib/libresolv.so.2 (0x40353000)
        libm.so.6 => /lib/libm.so.6 (0x40364000)
        libdl.so.2 => /lib/libdl.so.2 (0x40386000)
        libc.so.6 => /lib/libc.so.6 (0x4038a000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
diebels:/usr/local/apache2/modules#

The tools like autoconf,libtool and so on are the recent ones:
libtool: ltmain.sh (GNU libtool) 1.4.2 (1.922.2.53 2001/09/11 03:18:52)

autoconf: autoconf (GNU Autoconf) 2.53

automake: automake (GNU automake) 1.4-p4

Any ideas?

Bye, Sebastian

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-07 10:45 UTC] sander@php.net
To properly diagnose this bug, we need a backtrace to see what is
happening behind the scenes. To find out how to generate a backtrace,
please read http://bugs.php.net/bugs-generating-backtrace.php

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open".
 [2002-04-07 11:21 UTC] sebastian dot wolfgarten at gmx dot net
Okay, here is my backtrace:

warning: Unable to set global thread event mask: generic error
[New Thread 1024 (LWP 30801)]
Error while reading shared library symbols:
Cannot enable thread event reporting for Thread 1024 (LWP 30801): generic error
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /usr/local/apache2/modules/libphp4.so...done.
Loaded symbols for /usr/local/apache2/modules/libphp4.so
Reading symbols from /usr/local/lib/libpdf.so.1...done.
Loaded symbols for /usr/local/lib/libpdf.so.1
Reading symbols from /usr/local/lib/libtiff.so.3...done.
Loaded symbols for /usr/local/lib/libtiff.so.3
Reading symbols from /usr/local/lib/libpng.so.3...done.
Loaded symbols for /usr/local/lib/libpng.so.3
Reading symbols from /usr/local/lib/libmhash.so.2...done.
Loaded symbols for /usr/local/lib/libmhash.so.2
Reading symbols from /usr/local/lib/libmcrypt.so.4...done.
Loaded symbols for /usr/local/lib/libmcrypt.so.4
Reading symbols from /usr/local/lib/libltdl.so.3...done.
Loaded symbols for /usr/local/lib/libltdl.so.3
Reading symbols from /usr/local/lib/libttf.so.2...done.
Loaded symbols for /usr/local/lib/libttf.so.2
Reading symbols from /usr/local/lib/libjpeg.so.62...done.
Loaded symbols for /usr/local/lib/libjpeg.so.62
Reading symbols from /lib/libresolv.so.2...done.
Loaded symbols for /lib/libresolv.so.2
Reading symbols from /lib/libnss_compat.so.2...done.
Loaded symbols for /lib/libnss_compat.so.2
Reading symbols from /lib/libnss_files.so.2...done.
Loaded symbols for /lib/libnss_files.so.2
#0  0x40391679 in sapi_initialize_empty_request (tsrm_ls=0x8166f68) at /home/sebastian/cvs/php4-200204070300/main/SAPI.c:366
366             SG(server_context) = NULL;
(gdb) bt
#0  0x40391679 in sapi_initialize_empty_request (tsrm_ls=0x8166f68) at /home/sebastian/cvs/php4-200204070300/main/SAPI.c:366
#1  0x4038d4e9 in php_module_startup (sf=0x404224c0) at /home/sebastian/cvs/php4-200204070300/main/main.c:907
#2  0x403d1257 in php_apache_server_startup (pconf=0x80c5a80, plog=0x8107b88, ptemp=0x8162ec0, s=0x81669a8)
    at /home/sebastian/cvs/php4-200204070300/sapi/apache2filter/sapi_apache2.c:432
#3  0x08088f51 in ap_run_post_config (pconf=0x80c5a80, plog=0x8107b88, ptemp=0x8162ec0, s=0x81669a8) at config.c:129
#4  0x0808d131 in main (argc=2, argv=0xbffffde4) at main.c:611
#5  0x401896cf in __libc_start_main () from /lib/libc.so.6

As I already mentioned apache crashes immediatelly after being started. Do you need other or additional information?

Bye, Sebastian
 [2002-04-07 12:32 UTC] sniper@php.net
Please reduce the PHP configure options to minimum.
ie. only --with-apxs2

--Jani

 [2002-04-07 12:33 UTC] sniper@php.net
And please classify these apache2 related bugs under the 
correct category.

 [2002-04-07 12:57 UTC] sebastian dot wolfgarten at gmx dot net
Well,

it's me again :-)
I just compiled php with --with-apxs2 option. The result is just the same, apache crashes after being started. See my new backtrace:

warning: Unable to set global thread event mask: generic error
[New Thread 1024 (LWP 28095)]
Error while reading shared library symbols:
Cannot enable thread event reporting for Thread 1024 (LWP 28095): generic error
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /lib/libnss_compat.so.2...done.
Loaded symbols for /lib/libnss_compat.so.2
Reading symbols from /lib/libnss_files.so.2...done.
Loaded symbols for /lib/libnss_files.so.2
Reading symbols from /usr/local/apache2/modules/libphp4.so...done.
Loaded symbols for /usr/local/apache2/modules/libphp4.so
Reading symbols from /lib/libresolv.so.2...done.
Loaded symbols for /lib/libresolv.so.2
#0  0x401de657 in malloc () from /lib/libc.so.6
(gdb) bt
#0  0x401de657 in malloc () from /lib/libc.so.6
#1  0x401de1e4 in malloc () from /lib/libc.so.6
#2  0x4036eb15 in zend_hash_add_or_update (ht=0x8165a18, arKey=0x403a54e1 "stdclass", nKeyLength=9, pData=0x403c5da0,
    nDataSize=120, pDest=0x0, flag=2) at /home/sebastian/cvs/php4-200204070300/Zend/zend_hash.c:266
#3  0x4036a0cd in register_standard_class () at /home/sebastian/cvs/php4-200204070300/Zend/zend.c:257
#4  0x4036a643 in zend_startup (utility_functions=0xbffffc88, extensions=0x0, start_builtin_functions=1)
    at /home/sebastian/cvs/php4-200204070300/Zend/zend.c:429
#5  0x40342a65 in php_module_startup (sf=0x403b33e0) at /home/sebastian/cvs/php4-200204070300/main/main.c:928
#6  0x40380477 in php_apache_server_startup (pconf=0x80c5a80, plog=0x8107b88, ptemp=0x81619d0, s=0x81654b8)
    at /home/sebastian/cvs/php4-200204070300/sapi/apache2filter/sapi_apache2.c:432
#7  0x08088f51 in ap_run_post_config (pconf=0x80c5a80, plog=0x8107b88, ptemp=0x81619d0, s=0x81654b8) at config.c:129
#8  0x0808d131 in main (argc=2, argv=0xbffffde4) at main.c:611
#9  0x401896cf in __libc_start_main () from /lib/libc.so.6

Bye,
Sebastian
 [2002-04-12 20:25 UTC] sniper@php.net
There have been some fixes. Please try PHP 4.2.0RC3
from http://www.php.net/~derick/ or latest CVS snapshot
from http://snaps.php.net/

 [2002-04-13 07:11 UTC] sebastian dot wolfgarten at gmx dot net
Hi,

well as sniper@php.net said I tried php 4.2.0RC3 and
latest cvs snapshot from snaps.php.net, but unfortunately the result is still the same. Maybe some things where fixed but apache still crashes after being started...see my backtraces:

diebels:/usr/local/apache2/bin# gdb /usr/local/apache2/bin/httpd /usr/local/apache2/bin/core
GNU gdb 5.1.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-linux"...
Core was generated by `./httpd -X'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/local/apache2/lib/libaprutil.so.0...done.
Loaded symbols for /usr/local/apache2/lib/libaprutil.so.0
Reading symbols from /usr/local/apache2/lib/libapr.so.0...done.
Loaded symbols for /usr/local/apache2/lib/libapr.so.0
Reading symbols from /lib/libm.so.6...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libcrypt.so.1...done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /lib/libnsl.so.1...done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /usr/lib/libdb-4.0.so...done.
Loaded symbols for /usr/lib/libdb-4.0.so
Reading symbols from /usr/local/lib/libexpat.so.0...done.
Loaded symbols for /usr/local/lib/libexpat.so.0
Reading symbols from /lib/libpthread.so.0...done.

warning: Unable to set global thread event mask: generic error
[New Thread 1024 (LWP 23812)]
Error while reading shared library symbols:
Cannot enable thread event reporting for Thread 1024 (LWP 23812): generic error
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /lib/libnss_compat.so.2...done.
Loaded symbols for /lib/libnss_compat.so.2
Reading symbols from /lib/libnss_files.so.2...done.
Loaded symbols for /lib/libnss_files.so.2
Reading symbols from /usr/local/apache2/modules/libphp4.so...done.
Loaded symbols for /usr/local/apache2/modules/libphp4.so
Reading symbols from /lib/libresolv.so.2...done.
Loaded symbols for /lib/libresolv.so.2
#0  0x401de657 in malloc () from /lib/libc.so.6
(gdb)bt
#0  0x401de657 in malloc () from /lib/libc.so.6
#1  0x401dfa93 in calloc () from /lib/libc.so.6
#2  0x4037efb9 in zend_hash_init (ht=0x403dec64, nSize=0, pHashFunction=0, pDestructor=0x40379b04 <_zval_ptr_dtor_wrapper>,
    persistent=1) at /home/sebastian/php_cvs/php4-200204130300/Zend/zend_hash.c:176
#3  0x4037f060 in zend_hash_init_ex (ht=0x403dec64, nSize=0, pHashFunction=0,
    pDestructor=0x40379b04 <_zval_ptr_dtor_wrapper>, persistent=1, bApplyProtection=0)
    at /home/sebastian/php_cvs/php4-200204130300/Zend/zend_hash.c:197
#4  0x4037a169 in register_standard_class () at /home/sebastian/php_cvs/php4-200204130300/Zend/zend.c:250
#5  0x4037a74f in zend_startup (utility_functions=0xbffffc78, extensions=0x0, start_builtin_functions=1)
    at /home/sebastian/php_cvs/php4-200204130300/Zend/zend.c:429
#6  0x4034dbbd in php_module_startup (sf=0x403cc440) at /home/sebastian/php_cvs/php4-200204130300/main/main.c:924
#7  0x40392713 in php_apache_server_startup (pconf=0x80ad520, plog=0x80e5600, ptemp=0x812f3e0, s=0x8131a48)
    at /home/sebastian/php_cvs/php4-200204130300/sapi/apache2filter/sapi_apache2.c:435
#8  0x08076e51 in ap_run_post_config (pconf=0x80ad520, plog=0x80e5600, ptemp=0x812f3e0, s=0x8131a48) at config.c:129
#9  0x0807b031 in main (argc=2, argv=0xbffffdd4) at main.c:611
#10 0x401896cf in __libc_start_main () from /lib/libc.so.6

I will try it again in a couple of days...

Bye,
Sebastian
 [2002-04-13 14:15 UTC] sniper@php.net
Is the libpthread in your system a static library or why
isn't it shown in that ldd list?

Which Debian distro is this anyway? Stable or unstable?

 [2002-04-13 15:03 UTC] sebastian dot wolfgarten at gmx dot net
Hi,

well when I do a "ldd /usr/local/bin/httpd" the following list is shown:

libaprutil.so.0 => /usr/local/apache2/lib/libaprutil.so.0 (0x40016000)
libapr.so.0 => /usr/local/apache2/lib/libapr.so.0 (0x40026000)
libm.so.6 => /lib/libm.so.6 (0x40047000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x40069000)
libnsl.so.1 => /lib/libnsl.so.1 (0x40096000)
libdl.so.2 => /lib/libdl.so.2 (0x400ab000)
libdb-4.0.so => /usr/lib/libdb-4.0.so (0x400af000)
libexpat.so.0 => /usr/local/lib/libexpat.so.0 (0x40135000)
libpthread.so.0 => /lib/libpthread.so.0 (0x40156000)
libc.so.6 => /lib/libc.so.6 (0x4016c000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

So there is libpthread included but why not in ldd of libphp4.so (as seen in my previous postings)? I'm using Debian Woody 3.0 with kernel 2.4.16 and I have installed all recent updates.

Bye,
Sebastian
 [2002-04-13 17:08 UTC] sniper@php.net
reclassified. (please don't change the category anymore!)

 [2002-04-15 00:12 UTC] bfoddy at yuck dot net
I too have been seeing this same error.
Using RC3 and now RC4, httpd -X cores immediately.

My php config:
./configure --with-apxs2=/home/brian/apache2/bin/apxs --enable-debug --prefix=/home/brian/apache2

Coredump bt:
(gdb) bt
#0  0x4034958e in ts_resource_ex (id=1, th_id=0x0) at TSRM.c:310
#1  0x402a1fda in php_module_startup (sf=0x4036fb00) at main.c:856
#2  0x4029f9bc in php_apache_server_startup (pconf=0x80b7e20, plog=0x80eff00, ptemp=0x8137a38, s=0x813a0a0)
    at sapi_apache2.c:435
#3  0x0807c972 in ap_run_post_config (pconf=0x80b7e20, plog=0x80eff00, ptemp=0x8137a38, s=0x813a0a0)
    at config.c:127
#4  0x08081595 in main (argc=2, argv=0xbffff7e4) at main.c:611
#5  0x40119280 in __libc_start_main () from /lib/libc.so.6

Apache 2.0.35, Mandrake 8.2

Changes made to httpd.conf as per instructions on 
web page:
LoadModule php4_module        modules/libphp4.so

<Files *.php>
SetOutputFilter PHP
SetInputFilter PHP
</Files>
 [2002-04-21 18:48 UTC] jwoolley@php.net
This appears to be heap corruption of some sort.  I can
reproduce the problem and am working on tracking it down.
 [2002-04-22 00:04 UTC] jwoolley@php.net
AHA!  I think I'm onto something.  The DSO is segfaulting in the second initialization round when php_apache_server_startup().  That function calls php_apache_startup() which uses pthread_getspecific.  It ends up looking up a structure which contains pointers that point to from the FIRST round, dereferences them, and poof, it dies.  I'm working on a patch.
 [2002-04-23 14:55 UTC] mclinden at informed dot net
Well, this is probably not much help, but with gcc-2.95.3, linux-2.4.18, apache 2.0.35 and PHP 4.2.0 I see the same behavior, namely, httpd -X crashes with a segmentation fault whenever I access ANY page on the server, PHP or not. This only happens AFTER the PHP module is loaded. With the vanilla apache (no php) I have no problems, whatsoever.

Also, configuration of both apache and php is minimal.
 [2002-04-23 16:12 UTC] sebastian dot wolfgarten at gmx dot net
Hi,

try submitting a backtrace. See http://bugs.php.net/bugs-generating-backtrace.php to create it - it's quite simple
but helps the developers a lot. Did you compile apache with the option "--with-apxs2"?

Just gimme a hint when I should try to compile apache with php on my system again...

Bye,
Sebastian
 [2002-04-23 20:59 UTC] aaron@php.net
This bug has been fixed in CVS.

I just committed a fix for this in
sapi/apache2filter/sapi_apache2.c version 1.74
(from CVS HEAD). If you are still seeing the
problem after trying this version please reopen
this bug. Thank you for using Apache/PHP!
 [2002-04-24 16:00 UTC] sebastian dot wolfgarten at gmx dot net
Hi folks,

great work :-)
Apache 2.0.35 works now fine for me even with php4.3-dev
(I took it from snaps.php.net). Again let me know when I should retry any other version of php...

Thanks + bye,
Sebastian
 [2002-05-04 16:51 UTC] japs at adm dot ku dot dk
The version 1.74 enables the Apache 2.0.35 server to start with PHP 4.2.0

However after a "bin/apachectl restart" all http calls will fail: child pid 31308 exit signal Segmentation fault (11)

A full stop and startssl of Apache is needed.

Jan P. Sorensen
 [2002-05-05 12:05 UTC] aaron@php.net
This is a new bug. Please resubmit (and please report if it
happens if you don't use SSL). Thanks for using Apache
and PHP (and glad the original bug seems to have been fixed)!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 01:01:28 2024 UTC