php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3672 httpd crashes if MySQL-support is enabled
Submitted: 2000-02-29 19:03 UTC Modified: 2001-02-10 15:28 UTC
From: troels at arvin dot dk Assigned:
Status: Closed Package: Reproducible Crash
PHP Version: 3.0.15 OS: Linux Red Hat 6.1 i686/SMP
Private report: No CVE-ID: None
 [2000-02-29 19:03 UTC] troels at arvin dot dk
Problem summary: Apache instantly crashes.

Note: No problem with PHP 3.0.13 (everything else being equal).

Base system: Red Hat 6.1.
Kernel upgraded to Red Hat Rawhide's 2.2.14-1.1.0

glibc, gd, egcs as Red Hat 6.1 default

Hardware:
i686SMP (two equally clocked CPUs)

MySQL versions tried:
3.22.30
3.22.32
(both gave segfault)

Apache-version:
apache-mod_ssl (Apache 1.3.12, modssl 2.6.0.)
openssl version 0.9.5
Ordinary (non-modssl) Apache not tried.

Starting Apache with either ("httpd" or "httpd -DSSL" makes no difference).

PHP configure options:
        --with-apxs \
        --prefix=/usr \
        --with-config-file-path=/etc/httpd/conf \
        --with-mysql \
        --with-system-regex \
        --with-memory-limit \
        --with-gd \
        --enable-url-includes \
        --with-xml

Removing "--with-mysql" cures the problem.

Compiler optimization flags tried (trouble with both sets of options):

-O3 -march=pentiumpro -mcpu=pentiumpro -malign-loops=2 -malign-jumps=2 -malign-functions=2

-O2 -m486


Backtrace:
[root@developer SPECS]# httpd -X
Segmentation fault (core dumped)
[root@developer SPECS]# gdb /usr/sbin/httpd core 
GNU gdb 4.18
Copyright 1998 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-redhat-linux"...(no debugging symbols found)...
Core was generated by `httpd -X'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libm.so.6...done.
Reading symbols from /lib/libcrypt.so.1...done.
Reading symbols from /lib/libdb.so.3...done.
Reading symbols from /lib/libdl.so.2...done.
Reading symbols from /lib/libc.so.6...done.
Reading symbols from /lib/ld-linux.so.2...done.
Reading symbols from /lib/libnss_files.so.2...done.
Reading symbols from /usr/lib/apache/mod_mmap_static.so...done.
Reading symbols from /usr/lib/apache/mod_vhost_alias.so...done.
Reading symbols from /usr/lib/apache/mod_env.so...done.
Reading symbols from /usr/lib/apache/mod_define.so...done.
Reading symbols from /usr/lib/apache/mod_log_config.so...done.
Reading symbols from /usr/lib/apache/mod_mime_magic.so...done.
Reading symbols from /usr/lib/apache/mod_mime.so...done.
Reading symbols from /usr/lib/apache/mod_negotiation.so...done.
Reading symbols from /usr/lib/apache/mod_status.so...done.
Reading symbols from /usr/lib/apache/mod_info.so...done.
Reading symbols from /usr/lib/apache/mod_include.so...done.
Reading symbols from /usr/lib/apache/mod_autoindex.so...done.
Reading symbols from /usr/lib/apache/mod_dir.so...done.
Reading symbols from /usr/lib/apache/mod_cgi.so...done.
Reading symbols from /usr/lib/apache/mod_asis.so...done.
Reading symbols from /usr/lib/apache/mod_imap.so...done.
Reading symbols from /usr/lib/apache/mod_actions.so...done.
Reading symbols from /usr/lib/apache/mod_userdir.so...done.
Reading symbols from /usr/lib/apache/mod_alias.so...done.
Reading symbols from /usr/lib/apache/mod_rewrite.so...done.
Reading symbols from /usr/lib/apache/mod_access.so...done.
Reading symbols from /usr/lib/apache/mod_auth.so...done.
Reading symbols from /usr/lib/apache/mod_digest.so...done.
Reading symbols from /usr/lib/apache/mod_cern_meta.so...done.
Reading symbols from /usr/lib/apache/mod_expires.so...done.
Reading symbols from /usr/lib/apache/mod_headers.so...done.
Reading symbols from /usr/lib/apache/mod_setenvif.so...done.
Reading symbols from /usr/lib/apache/libphp3.so...done.
Reading symbols from /usr/lib/libgd.so.1...done.
Reading symbols from /usr/lib/libttf.so.2...done.
Reading symbols from /usr/lib/libmysqlclient.so.6...done.
Reading symbols from /usr/lib/libgdbm.so.2...done.
Reading symbols from /lib/libpam.so.0...done.
Reading symbols from /lib/libresolv.so.2...done.
Reading symbols from /lib/libnsl.so.1...done.
Reading symbols from /usr/lib/libz.so.1...done.
Reading symbols from /lib/libpthread.so.0...done.
#0  0x40457f05 in php3_constants () from /usr/lib/apache/libphp3.so
(gdb) bt
#0  0x40457f05 in php3_constants () from /usr/lib/apache/libphp3.so
#1  0x4046ba96 in _nss_files_getservbyname_r (name=0x4042db96 "mysql", proto=0x4042de30 "tcp", result=0x4019115c, 
    buffer=0x80bb458 "mysql", buflen=1024, errnop=0x4018efe0) at nss_files/files-service.c:43
#2  0x40165fa8 in __getservbyname_r (name=0x4042db96 "mysql", proto=0x4042de30 "tcp", resbuf=0x4019115c, buffer=0x80bb458 "mysql", 
    buflen=1024, result=0xbfffb92c) at ../nss/getXXbyYY_r.c:182
#3  0x40165e24 in getservbyname (name=0x4042db96 "mysql", proto=0x4042de30 "tcp") at ../nss/getXXbyYY.c:123
#4  0x403f2935 in php3_minit_mysql () from /usr/lib/apache/libphp3.so
#5  0x403d34ae in module_startup_modules () from /usr/lib/apache/libphp3.so
#6  0x403cb9ff in php3_module_startup () from /usr/lib/apache/libphp3.so
#7  0x403c9f35 in php3_create_dir () from /usr/lib/apache/libphp3.so
#8  0x8056518 in ap_single_module_configure ()
#9  0x8050259 in ap_get_server_built ()
#10 0x8054eaa in ap_add_named_module ()
#11 0x8055520 in ap_handle_command ()
#12 0x80556f2 in ap_process_resource_config ()
#13 0x8055fc8 in ap_read_config ()
#14 0x805d866 in ap_update_child_status ()
#15 0x805e38b in main ()
#16 0x400b81eb in __libc_start_main (main=0x805df7c <main>, argc=2, argv=0xbffffc74, init=0x804f734 <_init>, fini=0x808231c <_fini>, 
    rtld_fini=0x4000a610 <_dl_fini>, stack_end=0xbffffc6c) at ../sysdeps/generic/libc-start.c:90
(gdb) 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-02-29 20:34 UTC] troels at arvin dot dk
Compiling MySQL from a source tarball (mysql-3.22.32.tar.gz) cures 
the problem.

I haven't changed status to "closed" because I think that the situation 
needs to be solved somehow:
Package based system administration is _very_ important in some 
organizations (preventing massive confusion if sysadm gets a new 
job...).

I wonder why is this only a problem with PHP 3.0.15 and not 3.0.13?
 [2001-02-10 15:28 UTC] jimw@php.net
closing. broken packages aren't our problem.
 [2002-12-04 10:26 UTC] no-spam at x dot y dot z dot ad
bug occurs with and without mysql support, reason is somewhere in getservbyname (try to compile use php's getservbyname, it crashes too!) which is a libc item. seems to be a libc bug or something, nothing special about php.

if you need fast help with this: go to /ext/mysql, edit php_mysql.c, search for OnMySQLPort, and comment out 3 lines starting with the lines "if ((serv_ptr = getservbyname..."

moritz
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 23:01:28 2024 UTC