#26929 [Bgs]: mysql_connect() segfaults php/apache

2004-02-20 Thread aguilr at alum dot rpi dot edu
 ID:   26929
 User updated by:  aguilr at alum dot rpi dot edu
 Reported By:  aguilr at alum dot rpi dot edu
 Status:   Bogus
 Bug Type: MySQL related
 Operating System: Debian GNU/Linux 3.0r2
 PHP Version:  4.3.4
 New Comment:

Looks like this is, indeed, a debian issue.  I was able to work around
the problem by modifying my /etc/nsswitch.conf file so that bdb isn't
accessed when looking for whatever was being queried on the machine. 
For example, the line:



hosts:  db files dns



was changed to:



hosts:  files dns



That fixed the problem.  



Thanks for the help!


Previous Comments:


[2004-01-22 22:17:34] aguilr at alum dot rpi dot edu

I added a comment to the mysql bug database a few days ago, but have
not heard back.  As a suggestion from that bug report, I upgraded to
Debian/Sarge, which still exhibits the same segfault.



From the strace and the gdb backtrace, I'm guessing it has something to
do with:



/usr/lib/libdb3.so.3 



or 



/lib/libnss_db.so.2



Or, more likely, a db conflict since it seems that db2 and db3 are
being used.



Any clues would be great!



Thanks.



[2004-01-16 06:07:48] [EMAIL PROTECTED]

It's not a php (and probably not a mysql) bug. Please read 

http://bugs.mysql.com/bug.php?id=1338 and test it with 

official mysql binaries (if the problem still exists 

reopen #1338 on bugs.mysql.com) 



[2004-01-16 04:23:14] aguilr at alum dot rpi dot edu

Description:

Hello,



I've been working on this problem for about four days and haven't been
able to find a bug report or newsgroup post describing how to fix it.



Basically, things compile and install fine, but as soon as
mysql_connect() is run, PHP segfaults.



I also had to add --disable-pear in my configure line because make
install would segfault when running install-pear-installer.



Here's my configure line:



APP_LOCATION=/opt/apps

APP_PATH=${APP_LOCATION}/php/4.3.4

HTTPD_LOCATION=${APP_LOCATION}/httpd/2.0.48



./configure --prefix=${APP_PATH} --disable-static
--with-mysql=${APP_LOCATION}/mysql/4.0.17
--with-mysql-sock=/var/run/mysqld/mysqld.sock
--with-apxs2=${HTTPD_LOCATION}/bin/apxs --with-gd --with-jpeg-dir
--with-png-dir --with-freetype-dir --with-tiff-dir --with-zlib-dir
--with-expat-dir=${APP_LOCATION}/expat/1.95.7
--with-xslt-sablot=${APP_LOCATION}/sablotron/1.0.1 --enable-xslt=shared
--enable-track-vars --with-gettext
--with-curl=${APP_LOCATION}/curl/7.10.8 --with-xml --with-dom
--with-iconv-dir=${APP_LOCATION}/libiconv/1.9.1
--with-iconv=${APP_LOCATION}/libiconv/1.9.1
--with-db4=${APP_LOCATION}/db/4.0.14 --disable-pear --enable-debug



Apache2 works great on its own and MySQL is accepting connections from
another PHP installation jsut fine.  Any help would be *much*
appreciated!



Reproduce code:
---
?php



$conn = mysql_connect(localhost, username, password);



print I will not reach this line br /;



mysql_select_db(nh, $conn);



$res = mysql_query(SELECT username FROM depalma_user);



while($row = mysql_fetch_array($res)) {

  print row['username'] . br /;

}



?

Expected result:

user1

user2

user3

[...]

Actual result:
--
Here's a gdb backtrace:



#0  0x in ?? ()

#1  0x40553928 in _nss_db_getspnam_r () from /lib/libnss_db.so.2

#2  0x405539e0 in _nss_db_getspnam_r () from /lib/libnss_db.so.2

#3  0x4055311e in _nss_db_endservent () from /lib/libnss_db.so.2

#4  0x405533b3 in _nss_db_getservbyname_r () from /lib/libnss_db.so.2

#5  0x40513a83 in getservbyname_r () from /lib/libc.so.6

#6  0x40513931 in getservbyname () from /lib/libc.so.6

#7  0x4007426d in mysql_once_init ()   from
/opt/apps/mysql/4.0.17/lib/mysql/libmysqlclient.so.12

#8  0x40076a80 in mysql_init ()   from
/opt/apps/mysql/4.0.17/lib/mysql/libmysqlclient.so.12

#9  0x080b4d36 in ?? ()

#10 0x080b5055 in ?? ()

#11 0x081a3bb2 in ?? ()

#12 0x08190834 in ?? ()

#13 0x08154e3c in ?? ()

#14 0x081aa977 in ?? ()

#15 0x4044c14f in __libc_start_main () from /lib/libc.so.6



An strace reveals:



# strace -p 16389

[...]

close(9)=
0open(/opt/apps/httpd/2.0.48/lib/libdb3.so.3, O_RDONLY) = -1 ENOENT
(No such file or directory)open(/opt/apps/db/4.0.14/lib/libdb3.so.3,
O_RDONLY) = -1 ENOENT (No such file or
directory)open(/opt/apps/httpd/2.0.48/lib/libdb3.so.3, O_RDONLY) = -1
ENOENT (No such file or directory)open(i686/mmx/libdb3.so.3,
O_RDONLY)  = -1 ENOENT (No such file or
directory)open(i686/libdb3.so.3, O_RDONLY)  = -1 ENOENT (No such
file or directory)open(mmx/libdb3.so.3, O_RDONLY)   = -1 ENOENT
(No such file or directory)open(libdb3.so.3, O_RDONLY)   = -1
ENOENT (No such file or directory)open(/usr/lib/libdb3.so.3,
O_RDONLY)  = 9read(9

#26929 [Bgs]: mysql_connect() segfaults php/apache

2004-01-22 Thread aguilr at alum dot rpi dot edu
 ID:   26929
 User updated by:  aguilr at alum dot rpi dot edu
 Reported By:  aguilr at alum dot rpi dot edu
 Status:   Bogus
 Bug Type: MySQL related
 Operating System: Debian GNU/Linux 3.0r2
 PHP Version:  4.3.4
 New Comment:

I added a comment to the mysql bug database a few days ago, but have
not heard back.  As a suggestion from that bug report, I upgraded to
Debian/Sarge, which still exhibits the same segfault.

From the strace and the gdb backtrace, I'm guessing it has something to
do with:

/usr/lib/libdb3.so.3 

or 

/lib/libnss_db.so.2

Or, more likely, a db conflict since it seems that db2 and db3 are
being used.

Any clues would be great!

Thanks.


Previous Comments:


[2004-01-16 06:07:48] [EMAIL PROTECTED]

It's not a php (and probably not a mysql) bug. Please read 
http://bugs.mysql.com/bug.php?id=1338 and test it with 
official mysql binaries (if the problem still exists 
reopen #1338 on bugs.mysql.com) 



[2004-01-16 04:23:14] aguilr at alum dot rpi dot edu

Description:

Hello,

I've been working on this problem for about four days and haven't been
able to find a bug report or newsgroup post describing how to fix it.

Basically, things compile and install fine, but as soon as
mysql_connect() is run, PHP segfaults.

I also had to add --disable-pear in my configure line because make
install would segfault when running install-pear-installer.

Here's my configure line:

APP_LOCATION=/opt/apps
APP_PATH=${APP_LOCATION}/php/4.3.4
HTTPD_LOCATION=${APP_LOCATION}/httpd/2.0.48

./configure --prefix=${APP_PATH} --disable-static
--with-mysql=${APP_LOCATION}/mysql/4.0.17
--with-mysql-sock=/var/run/mysqld/mysqld.sock
--with-apxs2=${HTTPD_LOCATION}/bin/apxs --with-gd --with-jpeg-dir
--with-png-dir --with-freetype-dir --with-tiff-dir --with-zlib-dir
--with-expat-dir=${APP_LOCATION}/expat/1.95.7
--with-xslt-sablot=${APP_LOCATION}/sablotron/1.0.1 --enable-xslt=shared
--enable-track-vars --with-gettext
--with-curl=${APP_LOCATION}/curl/7.10.8 --with-xml --with-dom
--with-iconv-dir=${APP_LOCATION}/libiconv/1.9.1
--with-iconv=${APP_LOCATION}/libiconv/1.9.1
--with-db4=${APP_LOCATION}/db/4.0.14 --disable-pear --enable-debug

Apache2 works great on its own and MySQL is accepting connections from
another PHP installation jsut fine.  Any help would be *much*
appreciated!


Reproduce code:
---
?php

$conn = mysql_connect(localhost, username, password);

print I will not reach this line br /;

mysql_select_db(nh, $conn);

$res = mysql_query(SELECT username FROM depalma_user);

while($row = mysql_fetch_array($res)) {
  print row['username'] . br /;
}

?

Expected result:

user1
user2
user3
[...]

Actual result:
--
Here's a gdb backtrace:

#0  0x in ?? ()
#1  0x40553928 in _nss_db_getspnam_r () from /lib/libnss_db.so.2
#2  0x405539e0 in _nss_db_getspnam_r () from /lib/libnss_db.so.2
#3  0x4055311e in _nss_db_endservent () from /lib/libnss_db.so.2
#4  0x405533b3 in _nss_db_getservbyname_r () from /lib/libnss_db.so.2
#5  0x40513a83 in getservbyname_r () from /lib/libc.so.6
#6  0x40513931 in getservbyname () from /lib/libc.so.6
#7  0x4007426d in mysql_once_init ()   from
/opt/apps/mysql/4.0.17/lib/mysql/libmysqlclient.so.12
#8  0x40076a80 in mysql_init ()   from
/opt/apps/mysql/4.0.17/lib/mysql/libmysqlclient.so.12
#9  0x080b4d36 in ?? ()
#10 0x080b5055 in ?? ()
#11 0x081a3bb2 in ?? ()
#12 0x08190834 in ?? ()
#13 0x08154e3c in ?? ()
#14 0x081aa977 in ?? ()
#15 0x4044c14f in __libc_start_main () from /lib/libc.so.6

An strace reveals:

# strace -p 16389
[...]
close(9)=
0open(/opt/apps/httpd/2.0.48/lib/libdb3.so.3, O_RDONLY) = -1 ENOENT
(No such file or directory)open(/opt/apps/db/4.0.14/lib/libdb3.so.3,
O_RDONLY) = -1 ENOENT (No such file or
directory)open(/opt/apps/httpd/2.0.48/lib/libdb3.so.3, O_RDONLY) = -1
ENOENT (No such file or directory)open(i686/mmx/libdb3.so.3,
O_RDONLY)  = -1 ENOENT (No such file or
directory)open(i686/libdb3.so.3, O_RDONLY)  = -1 ENOENT (No such
file or directory)open(mmx/libdb3.so.3, O_RDONLY)   = -1 ENOENT
(No such file or directory)open(libdb3.so.3, O_RDONLY)   = -1
ENOENT (No such file or directory)open(/usr/lib/libdb3.so.3,
O_RDONLY)  = 9read(9,
\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0p\311\0..., 1024) =
1024fstat64(9, {st_mode=S_IFREG|0644, st_size=684092, ...}) =
0old_mmap(NULL, 687628, PROT_READ|PROT_EXEC, MAP_PRIVATE, 9, 0) =
0x40832000mprotect(0x408d9000, 3596, PROT_NONE)   =
0old_mmap(0x408d9000, 4096, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED, 9, 0xa6000) = 0x408d9000close(9)
   = 0munmap(0x40651000, 32390)   = 0---
SIGSEGV (Segmentation fault) ---







-- 
Edit this bug report

#26929 [NEW]: mysql_connect() segfaults php/apache

2004-01-16 Thread aguilr at alum dot rpi dot edu
From: aguilr at alum dot rpi dot edu
Operating system: Debian GNU/Linux 3.0r2
PHP version:  4.3.4
PHP Bug Type: MySQL related
Bug description:  mysql_connect() segfaults php/apache

Description:

Hello,

I've been working on this problem for about four days and haven't been
able to find a bug report or newsgroup post describing how to fix it.

Basically, things compile and install fine, but as soon as mysql_connect()
is run, PHP segfaults.

I also had to add --disable-pear in my configure line because make
install would segfault when running install-pear-installer.

Here's my configure line:

APP_LOCATION=/opt/apps
APP_PATH=${APP_LOCATION}/php/4.3.4
HTTPD_LOCATION=${APP_LOCATION}/httpd/2.0.48

./configure --prefix=${APP_PATH} --disable-static
--with-mysql=${APP_LOCATION}/mysql/4.0.17
--with-mysql-sock=/var/run/mysqld/mysqld.sock
--with-apxs2=${HTTPD_LOCATION}/bin/apxs --with-gd --with-jpeg-dir
--with-png-dir --with-freetype-dir --with-tiff-dir --with-zlib-dir
--with-expat-dir=${APP_LOCATION}/expat/1.95.7
--with-xslt-sablot=${APP_LOCATION}/sablotron/1.0.1 --enable-xslt=shared
--enable-track-vars --with-gettext --with-curl=${APP_LOCATION}/curl/7.10.8
--with-xml --with-dom --with-iconv-dir=${APP_LOCATION}/libiconv/1.9.1
--with-iconv=${APP_LOCATION}/libiconv/1.9.1
--with-db4=${APP_LOCATION}/db/4.0.14 --disable-pear --enable-debug

Apache2 works great on its own and MySQL is accepting connections from
another PHP installation jsut fine.  Any help would be *much*
appreciated!


Reproduce code:
---
?php

$conn = mysql_connect(localhost, username, password);

print I will not reach this line br /;

mysql_select_db(nh, $conn);

$res = mysql_query(SELECT username FROM depalma_user);

while($row = mysql_fetch_array($res)) {
  print row['username'] . br /;
}

?

Expected result:

user1
user2
user3
[...]

Actual result:
--
Here's a gdb backtrace:

#0  0x in ?? ()
#1  0x40553928 in _nss_db_getspnam_r () from /lib/libnss_db.so.2
#2  0x405539e0 in _nss_db_getspnam_r () from /lib/libnss_db.so.2
#3  0x4055311e in _nss_db_endservent () from /lib/libnss_db.so.2
#4  0x405533b3 in _nss_db_getservbyname_r () from /lib/libnss_db.so.2
#5  0x40513a83 in getservbyname_r () from /lib/libc.so.6
#6  0x40513931 in getservbyname () from /lib/libc.so.6
#7  0x4007426d in mysql_once_init ()   from
/opt/apps/mysql/4.0.17/lib/mysql/libmysqlclient.so.12
#8  0x40076a80 in mysql_init ()   from
/opt/apps/mysql/4.0.17/lib/mysql/libmysqlclient.so.12
#9  0x080b4d36 in ?? ()
#10 0x080b5055 in ?? ()
#11 0x081a3bb2 in ?? ()
#12 0x08190834 in ?? ()
#13 0x08154e3c in ?? ()
#14 0x081aa977 in ?? ()
#15 0x4044c14f in __libc_start_main () from /lib/libc.so.6

An strace reveals:

# strace -p 16389
[...]
close(9)=
0open(/opt/apps/httpd/2.0.48/lib/libdb3.so.3, O_RDONLY) = -1 ENOENT (No
such file or directory)open(/opt/apps/db/4.0.14/lib/libdb3.so.3,
O_RDONLY) = -1 ENOENT (No such file or
directory)open(/opt/apps/httpd/2.0.48/lib/libdb3.so.3, O_RDONLY) = -1
ENOENT (No such file or directory)open(i686/mmx/libdb3.so.3, O_RDONLY) 
= -1 ENOENT (No such file or directory)open(i686/libdb3.so.3, O_RDONLY) 
= -1 ENOENT (No such file or directory)open(mmx/libdb3.so.3,
O_RDONLY)   = -1 ENOENT (No such file or directory)open(libdb3.so.3,
O_RDONLY)   = -1 ENOENT (No such file or
directory)open(/usr/lib/libdb3.so.3, O_RDONLY)  = 9read(9,
\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0p\311\0..., 1024) =
1024fstat64(9, {st_mode=S_IFREG|0644, st_size=684092, ...}) =
0old_mmap(NULL, 687628, PROT_READ|PROT_EXEC, MAP_PRIVATE, 9, 0) =
0x40832000mprotect(0x408d9000, 3596, PROT_NONE)   = 0old_mmap(0x408d9000,
4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 9, 0xa6000) =
0x408d9000close(9)= 0munmap(0x40651000,
32390)   = 0--- SIGSEGV (Segmentation fault) ---



-- 
Edit bug report at http://bugs.php.net/?id=26929edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=26929r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=26929r=trysnapshot5
Fixed in CVS:   http://bugs.php.net/fix.php?id=26929r=fixedcvs
Fixed in release:   http://bugs.php.net/fix.php?id=26929r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26929r=needtrace
Need Reproduce Script:  http://bugs.php.net/fix.php?id=26929r=needscript
Try newer version:  http://bugs.php.net/fix.php?id=26929r=oldversion
Not developer issue:http://bugs.php.net/fix.php?id=26929r=support
Expected behavior:  http://bugs.php.net/fix.php?id=26929r=notwrong
Not enough info:http://bugs.php.net/fix.php?id=26929r=notenoughinfo
Submitted twice:http://bugs.php.net/fix.php?id=26929r=submittedtwice
register_globals:   http://bugs.php.net/fix.php?id=26929r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26929r=php3
Daylight