ID:               36817
 User updated by:  noah at allresearch dot com
 Reported By:      noah at allresearch dot com
-Status:           Feedback
+Status:           Open
 Bug Type:         Reproducible crash
 Operating System: Linux 2.6.11.8
 PHP Version:      4.4.2
 New Comment:

#0  0x00000000 in ?? ()
#1  0xb7763cec in db_open () from /lib/libnss_db.so.2
#2  0xb7763dac in internal_setent () from /lib/libnss_db.so.
2
#3  0xb77633ed in _nss_db_endservent () from /lib/
libnss_db.so.2
#4  0xb77636f9 in _nss_db_getservbyname_r () from /lib/
libnss_db.so.2
#5  0xb7d00354 in __getservbyname_r (name=0xb7b9efc8 
"mysql", proto=0xb7b9efc4 "tcp", resbuf=0xb7d3bf7c, 
    buffer=0x820ceb0 "0j?0j?dbh = mysql_pconnect
('123.123.123.123','user','pass');\n\n$query = \"select 
id,name from account\";\n\nmysql_select_db('master5');\n
$result = mysql_query($query) or die(\"Query failed : \" . 
mysql_error"..., buflen=1024, result=0xbfffb638) at ../nss/
getXXbyYY_r.c:200
#6  0xb7d001f5 in getservbyname (name=0xb7b9efc8 "mysql", 
proto=0xb7b9efc4 "tcp") at ../nss/getXXbyYY.c:145
#7  0xb7a197fa in mysql_once_init () from /usr/local/
apache2.2/modules/libphp4.so
#8  0xb7a1971f in mysql_init () from /usr/local/apache2.2/
modules/libphp4.so
#9  0xb79677e2 in php_mysql_do_connect (ht=3, 
return_value=0x8211aac, this_ptr=0x0, return_value_used=1, 
    persistent=1) at /data/src/php-4.4.2/ext/mysql/
php_mysql.c:671
#10 0xb7967c78 in zif_mysql_pconnect (ht=3, 
return_value=0x8211aac, this_ptr=0x0, return_value_used=1)
    at /data/src/php-4.4.2/ext/mysql/php_mysql.c:840
#11 0xb7a0ff3a in execute (op_array=0x820cd14) at /data/src/
php-4.4.2/Zend/zend_execute.c:1677
#12 0xb79fe408 in zend_execute_scripts (type=8, retval=0x0, 
file_count=3)
    at /data/src/php-4.4.2/Zend/zend.c:934
#13 0xb79d8ff3 in php_execute_script 
(primary_file=0xbfffdde8) at /data/src/php-4.4.2/main/
main.c:1753
#14 0xb7a16a1f in php_handler (r=0x8201c98) at /data/src/
php-4.4.2/sapi/apache2handler/sapi_apache2.c:581
#15 0x08076799 in ap_run_handler (r=0x8201c98) at config.c:
157
#16 0x08076ce3 in ap_invoke_handler (r=0x8201c98) at 
config.c:371
#17 0x0809ad4a in ap_process_request (r=0x8201c98) at 
http_request.c:258
#18 0x08098c6b in ap_process_http_connection (c=0x81f9d68) 
at http_core.c:171
#19 0x0807be68 in ap_run_process_connection (c=0x81f9d68) at 
connection.c:43
#20 0x0807c15c in ap_process_connection (c=0x81f9d68, 
csd=0x81f9bd0) at connection.c:178
#21 0x080ae429 in child_main (child_num_arg=0) at prefork.c:
640
#22 0x080ae4f4 in make_child (s=0x80e8988, slot=0) at 
prefork.c:680
#23 0x080ae8df in ap_mpm_run (_pconf=0x80e30c8, 
plog=0x81211c0, s=0x80e8988) at prefork.c:956
#24 0x080674ca in main (argc=4, argv=0xbfffe1b4) at main.c:
712
#25 0xb7c3417d in __libc_start_main (main=0x8066bb0 <main>, 
argc=4, ubp_av=0xbfffe1b4, 
    init=0x8062f1c <_init>, fini=0x80b6130 <_fini>, 
rtld_fini=0xb7ff6534 <_dl_fini>, stack_end=0xbfffe1ac)
    at ../sysdeps/generic/libc-start.c:129


Previous Comments:
------------------------------------------------------------------------

[2006-03-22 08:36:45] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, 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 for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.



------------------------------------------------------------------------

[2006-03-22 02:22:40] noah at allresearch dot com

Description:
------------
The issue:
        when I load a php file in a browser that references 
mysql, it crashes the apache thread.

The clues:
        if I call the same php from the command line, it works 
perfectly!
        If I call a php file that doesn't use mysql, it works 
perfectly!
        The problem is only when calling a php file using mysql 
THROUGH A BROWSER.

The environment
        slackware with kernel 2.6.11.8
        php 5.1.2
        apache 2.2.0
        mysql 4.1.18 (pre-compiled downloaded from mysql.com)

apache config command:
./configure --with-apr=/usr/local/apr-httpd/ --with-apr-
util=/usr/local/apr-util-httpd/ --enable-so --enab
le-rewrite --disable-autoindex --enable-ssl --with-ssl=/usr/
local/ssl

php config command:

'./configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--
with-mysql=/usr/local/mysql' '--with-mysql-sock=/tmp/
mysql.sock' '--with-sqlite' '--enable-sqlite-utf8' '--with-
zlib' '--with-zlib-dir' '--with-bz2' '--with-gd' '--enable-
gd' '--enable-gd-native-ttf' '--with-jpeg-dir=/usr/local' 
'--with-png-dir=/usr/local' '--with-ttf' '--with-curl=/usr/
local' '--enable-track-vars' '--with-gettext' '--with-
config-file-path=/usr/local/apache2/conf' '--enable-trans-
id' '--enable-ftp' '--enable-mbstring' '--with-openssl=/usr/
local/ssl'




Reproduce code:
---------------
Any code tht calls a mysql connection.



Expected result:
----------------
The apache thread that handles this request dies with a 
segmentation fault

php filname.php - WORKS PERFECTLY

http://server.com/filename.php - CRASHES 

Actual result:
--------------
[{fd=4, events=POLLIN}, {fd=3, events=POLLIN, 
revents=POLLIN}], 2, -1) = 1
accept(3, {sin_family=AF_INET, sin_port=htons(53520), 
sin_addr=inet_addr("70.88.177.202")}}, [16]) = 44
semop(18448458, 0xb7db66ea, 1)          = 0
gettimeofday({1142990034, 232824}, NULL) = 0
getsockname(44, {sin_family=AF_INET, sin_port=htons(80), 
sin_addr=inet_addr("38.144.36.11")}}, [16]) = 0
fcntl64(44, F_GETFL)                    = 0x2 (flags O_RDWR)
fcntl64(44, F_SETFL, O_RDWR|O_NONBLOCK) = 0
gettimeofday({1142990034, 233450}, NULL) = 0
brk(0x8220000)                          = 0x8220000
read(44, "GET /noah.php HTTP/1.1\r\nAccept: "..., 8000) = 
287
gettimeofday({1142990034, 233919}, NULL) = 0
gettimeofday({1142990034, 234131}, NULL) = 0
gettimeofday({1142990034, 234261}, NULL) = 0
stat64("/usr/local/apache2/conf/hosts-deny.txt", 
{st_mode=S_IFREG|0644, st_size=12, ...}) = 0
open("/usr/local/apache2/conf/hosts-deny.txt", O_RDONLY|
O_LARGEFILE) = 45
brk(0x8223000)                          = 0x8223000
read(45, "24.81.2.240\n", 4096)         = 12
read(45, "", 4096)                      = 0
close(45)                               = 0
brk(0x8226000)                          = 0x8226000
gettimeofday({1142990034, 235119}, NULL) = 0
semop(18415689, 0xb7db66e4, 1)          = 0
write(43, "70.88.177.202 - - [21/Mar/2006:1"..., 130) = 130
semop(18415689, 0xb7db66ea, 1)          = 0
stat64("/data/allresearch/websites/webclipping/htdocs/
noah.php", {st_mode=S_IFREG|0644, st_size=297, ...}) = 0
getpid()                                = 1122
setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={60, 
0}}, NULL) = 0
rt_sigaction(SIGPROF, {0xb7d4a078, [PROF], SA_RESTART|
0x4000000}, {SIG_DFL}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [PROF], NULL, 8) = 0
brk(0x8227000)                          = 0x8227000
gettimeofday({1142990034, 236867}, NULL) = 0
getpid()                                = 1122
getcwd("/data/src/httpd-2.2.0", 4095)   = 22
chdir("/data/allresearch/websites/webclipping/htdocs") = 0
lstat64("/data", {st_mode=S_IFDIR|0755, st_size=856, ...}) = 
0
lstat64("/data/allresearch", {st_mode=S_IFDIR|0775, 
st_size=256, ...}) = 0
lstat64("/data/allresearch/websites", {st_mode=S_IFDIR|0775, 
st_size=688, ...}) = 0
lstat64("/data/allresearch/websites/webclipping", 
{st_mode=S_IFDIR|0775, st_size=192, ...}) = 0
lstat64("/data/allresearch/websites/webclipping/htdocs", 
{st_mode=S_IFDIR|0775, st_size=2512, ...}) = 0
lstat64("/data/allresearch/websites/webclipping/htdocs/
noah.php", {st_mode=S_IFREG|0644, st_size=297, ...}) = 0
setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={30, 
0}}, NULL) = 0
rt_sigaction(SIGPROF, {0xb7d4a078, [PROF], SA_RESTART|
0x4000000}, {0xb7d4a078, [PROF], SA_RESTART|0x4000000}, 8) = 
0
rt_sigprocmask(SIG_UNBLOCK, [PROF], NULL, 8) = 0
getcwd("/data/allresearch/websites/webclipping/htdocs", 
4096) = 46
brk(0x8228000)                          = 0x8228000
lstat64("/data", {st_mode=S_IFDIR|0755, st_size=856, ...}) = 
0
lstat64("/data/allresearch", {st_mode=S_IFDIR|0775, 
st_size=256, ...}) = 0
lstat64("/data/allresearch/websites", {st_mode=S_IFDIR|0775, 
st_size=688, ...}) = 0
lstat64("/data/allresearch/websites/webclipping", 
{st_mode=S_IFDIR|0775, st_size=192, ...}) = 0
lstat64("/data/allresearch/websites/webclipping/htdocs", 
{st_mode=S_IFDIR|0775, st_size=2512, ...}) = 0
lstat64("/data/allresearch/websites/webclipping/htdocs/
noah.php", {st_mode=S_IFREG|0644, st_size=297, ...}) = 0
open("/data/allresearch/websites/webclipping/htdocs/
noah.php", O_RDONLY) = 45
fstat64(45, {st_mode=S_IFREG|0644, st_size=297, ...}) = 0
fstat64(45, {st_mode=S_IFREG|0644, st_size=297, ...}) = 0
lseek(45, 0, SEEK_CUR)                  = 0
lseek(45, 0, SEEK_SET)                  = 0
brk(0x822d000)                          = 0x822d000
read(45, "<?php\n\n$dbh = mysql_pconnect(\'38"..., 8192) = 
297
read(45, "", 8192)                      = 0
close(45)                               = 0
open("/usr/local/apr-util-httpd//lib/libnss_db.so.2", 
O_RDONLY) = -1 ENOENT (No such file or directory)
PrivoxyWindowOpen("/usr/local/BerkeleyDB.4.2/lib/libnss_db.so.2", 
O_RDONLY) = -1 ENOENT (No such file or directory)
PrivoxyWindowOpen("/usr/local/apr-httpd/lib/libnss_db.so.2", O_RDONLY)
= 
-1 ENOENT (No such file or directory)
PrivoxyWindowOpen("/etc/ld.so.cache", O_RDONLY)      = 45
fstat64(45, {st_mode=S_IFREG|0644, st_size=28726, ...}) = 0
old_mmap(NULL, 28726, PROT_READ, MAP_PRIVATE, 45, 0) = 
0xb79ab000
close(45)                               = 0
open("/lib/libnss_db.so.2", O_RDONLY)   = 45
read(45, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0000
\23\0"..., 1024) = 1024
fstat64(45, {st_mode=S_IFREG|0755, st_size=18756, ...}) = 0
old_mmap(NULL, 21240, PROT_READ|PROT_EXEC, MAP_PRIVATE, 45, 
0) = 0xb79a5000
mprotect(0xb79aa000, 760, PROT_NONE)    = 0
old_mmap(0xb79aa000, 4096, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED, 45, 0x4000) = 0xb79aa000
close(45)                               = 0
open("/usr/local/apr-util-httpd//lib/libnss_files.so.2", 
O_RDONLY) = -1 ENOENT (No such file or directory)
PrivoxyWindowOpen("/usr/local/BerkeleyDB.4.2/lib/libnss_files.so.2", 
O_RDONLY) = -1 ENOENT (No such file or directory)
PrivoxyWindowOpen("/usr/local/apr-httpd/lib/libnss_files.so.2",
O_RDONLY) 
= -1 ENOENT (No such file or directory)
PrivoxyWindowOpen("/lib/libnss_files.so.2", O_RDONLY) = 45
read(45, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0
\320\34"..., 1024) = 1024
fstat64(45, {st_mode=S_IFREG|0755, st_size=233089, ...}) = 0
old_mmap(NULL, 33740, PROT_READ|PROT_EXEC, MAP_PRIVATE, 45, 
0) = 0xb799c000
mprotect(0xb79a4000, 972, PROT_NONE)    = 0
old_mmap(0xb79a4000, 4096, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED, 45, 0x8000) = 0xb79a4000
close(45)                               = 0
open("/usr/local/apr-util-httpd//lib/libdb-3.1.so", 
O_RDONLY) = -1 ENOENT (No such file or directory)
PrivoxyWindowOpen("/usr/local/BerkeleyDB.4.2/lib/libdb-3.1.so",
O_RDONLY) 
= -1 ENOENT (No such file or directory)
PrivoxyWindowOpen("/usr/local/apr-httpd/lib/libdb-3.1.so", O_RDONLY) =
-1 
ENOENT (No such file or directory)
PrivoxyWindowOpen("/lib/libdb-3.1.so", O_RDONLY)     = 45
read(45, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0
\200\361"..., 1024) = 1024
fstat64(45, {st_mode=S_IFREG|0755, st_size=494600, ...}) = 0
old_mmap(NULL, 489772, PROT_READ|PROT_EXEC, MAP_PRIVATE, 45, 
0) = 0xb7924000
mprotect(0xb799a000, 6444, PROT_NONE)   = 0
old_mmap(0xb799a000, 8192, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED, 45, 0x75000) = 0xb799a000
close(45)                               = 0
munmap(0xb79ab000, 28726)               = 0
open("/etc/mtab", O_RDONLY)             = 45
fstat64(45, {st_mode=S_IFREG|0644, st_size=185, ...}) = 0
old_mmap(NULL, 131072, PROT_READ|PROT_WRITE, MAP_PRIVATE|
MAP_ANONYMOUS, -1, 0) = 0xb7904000
read(45, "/dev/hda1 / reiserfs rw 0 0\n/dev"..., 131072) = 
185
close(45)                               = 0
munmap(0xb7904000, 131072)              = 0
open("/proc/cpuinfo", O_RDONLY)         = 45
fstat64(45, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|
MAP_ANONYMOUS, -1, 0) = 0xb7923000
read(45, "processor\t: 0\nvendor_id\t: Genuin"..., 1024) = 
924
read(45, "", 1024)                      = 0
close(45)                               = 0
munmap(0xb7923000, 4096)                = 0
--- SIGSEGV (Segmentation fault) ---
+++ killed by SIGSEGV +++


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=36817&edit=1

Reply via email to