#36817 [NEW]: Mysql access crashes through apache but not command line

From: Date: Wed, 22 Mar 2006 01:22:46 +0000
Subject: #36817 [NEW]: Mysql access crashes through apache but not command line
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-94740@lists.php.net to get a copy of this message
From: noah at allresearch dot com Operating system: Linux 2.6.11.8 PHP version: 4.4.2 PHP Bug Type: Reproducible crash Bug description: Mysql access crashes through apache but not command line 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 bug report at http://bugs.php.net/?id=36817&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36817&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36817&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36817&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36817&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36817&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36817&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=36817&r=needscript Try newer version: http://bugs.php.net/fix.php?id=36817&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36817&r=support Expected behavior: http://bugs.php.net/fix.php?id=36817&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36817&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36817&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36817&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36817&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36817&r=dst IIS Stability: http://bugs.php.net/fix.php?id=36817&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36817&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36817&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36817&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=36817&r=mysqlcfg

« previous php.bugs (#94740) next »