php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3315 PHP w/ MySQL crashes apache - Same bug as in #2187 & #3168
Submitted: 2000-01-25 20:50 UTC Modified: 2000-03-20 02:06 UTC
From: john at mehringer dot com Assigned:
Status: Closed Package: MySQL related
PHP Version: 3.0.14 OS: RedHat 6.1
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: john at mehringer dot com
New email:
PHP Version: OS:

 

 [2000-01-25 20:50 UTC] john at mehringer dot com

Using RPMS:
apache-devel-1.3.9-8
apache-1.3.9-8
    
MySQL-client-3.22.29-1
MySQL-devel-3.22.29-1
MySQL-shared-3.22.29-1
MySQL-3.22.29-1

Compiled PHP-3.0.14 using:

./configure --with-apxs=/usr/sbin/apxs --with-mysql
make
make install


Starting apache with the php module causes a segfault. It has something to do with the MySQL switch because if I don't configure --with-mysql the module loads fine.

I ran apache in single process mode and saved the core dump.
/usr/sbin/httpd -X

using GDB and looking at the stack trace I get.

(gdb) where
#0  0x40371954 in ?? () from /usr/lib/libz.so.1
#1  0x40165fa8 in __getservbyname_r (name=0x4030ba76 "mysql", 
    proto=0x4030bd10 "tcp", resbuf=0x4019115c, buffer=0x80aba00 "mysql", 
    buflen=1024, result=0xbfffd9fc) at ../nss/getXXbyYY_r.c:182
#2  0x40165e24 in getservbyname (name=0x4030ba76 "mysql", 
    proto=0x4030bd10 "tcp") at ../nss/getXXbyYY.c:123
#3  0x402dba8a in php3_minit_mysql (type=1, module_number=9)
    at functions/mysql.c:258
#4  0x402c0367 in module_startup_modules () at internal_functions.c:533
#5  0x402b9b0a in php3_module_startup () at main.c:1237
#6  0x402b779e in php3_create_dir () from /etc/httpd/modules/libphp3.so
#7  0x8053fd4 in ap_single_module_configure ()
#8  0x804f14d in ap_get_server_built ()
#9  0x8052f44 in ap_clear_module_list ()
#10 0x805350c in ap_handle_command ()
#11 0x8053558 in ap_srm_command_loop ()
#12 0x80538c7 in ap_process_resource_config ()
#13 0x8053f44 in ap_read_config ()
#14 0x805ae47 in ap_child_terminate ()
#15 0x805b4fb in main ()
#16 0x400b81eb in __libc_start_main (main=0x805b290 <main>, argc=2, 
    argv=0xbffffce4, init=0x804e684 <_init>, fini=0x80794ec <_fini>, 
    rtld_fini=0x4000a610 <_dl_fini>, stack_end=0xbffffcdc)
    at ../sysdeps/generic/libc-start.c:90


So it looks like the problem comes from "functions/mysql.c" line 258

if ((serv_ptr = getservbyname("mysql", "tcp")))

Let me know if there is anything I can do to help further.

- John



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-03-20 02:06 UTC] rasmus at cvs dot php dot net
This problem goes away if you compile PHP against the non-threaded MySQL client libs.
Either compile MySQL from source, or link against the libmysqlclient.a instead of the
libmysqlclient.so lib.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 15 02:01:33 2025 UTC