From:             stephan at wiedner dot cc
Operating system: Debian Woody Kernel:2.4.22
PHP version:      5CVS-2003-09-06 (dev)
PHP Bug Type:     MySQL related
Bug description:  mysql_connect -> Segmentation Fault

Description:
------------
Every try to connect to the MySQL Server ends up in a segmentation fault.
When using the Apache2 Module I get the following log-output:
[notice] child pid 25103 exit signal Segmentation fault (11)

Using cli/php i just get "Segmentation fault" - without being any more
specific...

This problem occours with:
php-5.0.0b1
php-cvs2003-08-31
php-cvs2003-09-06

Apache 2.0.47
MySQL 4.0.14

PHP Configure Options:
./configure 
  --prefix=/usr/local  \
  --exec-prefix=/usr/local  \
  --bindir=/usr/local/bin  \
  --sbindir=/usr/local/sbin  \
  --libexecdir=/usr/local/libexec  \
  --datadir=/usr/local/share  \
  --sysconfdir=/usr/local/etc  \
  --sharedstatedir=/usr/local/com  \
  --localstatedir=/usr/local/var  \
  --libdir=/usr/local/lib  \
  --includedir=/usr/local/include  \
  --infodir=/usr/local/info  \
  --mandir=/usr/local/man  \
  --with-apxs2=/usr/sbin/apxs  \
  --enable-debug  \
  --with-config-file-path=/usr/local/lib  \
  --enable-safe-mode  \
  --disable-ipv6  \
  --disable-short-tags  \
  --with-dom=/usr/local  \
  --with-xsl=/usr/local   \
  --with-pspell  \
  --enable-dbx  \
  --with-db4=/usr/local/BerkeleyDB.4.1  \
  --with-gd=/usr/local  \
  --with-mysql=/usr/local \
  --with-mysql-sock=/tmp/mysql.sock  \
  --with-pgsql  \
  --with-gettext  \
  --with-layout=GNU

MySQL Configure Options:
./configure \
  --prefix=/usr/local \
  --enable-dependency-tracking \
  --localstatedir=/home/mysql \
  --enable-assembler \
  --with-unix-socket-path=/tmp/mysql.sock \
  --with-mysqld-user=mysql \
  --with-mysqld-ldflags=-all-static



I hope I provided all necessary information and that this isn't a bug but
my fault... :)


Reproduce code:
---------------
<?php
echo 'Trying to connect ... ';
$con = mysql_connect('localhost','user','pass') or die ("Unable to connect
...");
echo "super!";
mysql_close($con);
?>


Expected result:
----------------
super!

Actual result:
--------------
---- cli backtrace: ----

server:/# gdb ./php
GNU gdb 2002-04-01-cvs
Copyright 2002 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-linux"...
(gdb) run test2.php
Starting program: /usr/src/WebServer/php-src/sapi/cli/php test2.php
[New Thread 1024 (LWP 784)]
Trying to connect ...
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 784)]
0x08319af0 in ?? ()
(gdb) bt
#0  0x08319af0 in ?? ()
#1  0x405f79e0 in _nss_db_getspnam_r () from /lib/libnss_db.so.2
#2  0x405f711e in _nss_db_endservent () from /lib/libnss_db.so.2
#3  0x405f73b3 in _nss_db_getservbyname_r () from /lib/libnss_db.so.2
#4  0x40571a83 in getservbyname_r () from /lib/libc.so.6
#5  0x40571931 in getservbyname () from /lib/libc.so.6
#6  0x401991af in mysql_once_init () from
/usr/local/lib/mysql/libmysqlclient.so.12
#7  0x4019b9d8 in mysql_init () from
/usr/local/lib/mysql/libmysqlclient.so.12
#8  0x080ad624 in php_mysql_do_connect (ht=3, return_value=0x405b94b8,
this_ptr=0x0, return_value_used=1, persistent=0)
    at /usr/src/WebServer/php-src/ext/mysql/php_mysql.c:773
#9  0x080ad955 in zif_mysql_connect (ht=3, return_value=0x405b94b8,
this_ptr=0x0, return_value_used=1)
    at /usr/src/WebServer/php-src/ext/mysql/php_mysql.c:829
#10 0x08238f70 in zend_do_fcall_common_helper (execute_data=0xbfffd760,
op_array=0x405b8b7c)
    at /usr/src/WebServer/php-src/Zend/zend_execute.c:2541
#11 0x08239797 in zend_do_fcall_handler (execute_data=0xbfffd760,
op_array=0x405b8b7c)
    at /usr/src/WebServer/php-src/Zend/zend_execute.c:2687
#12 0x08234ba7 in execute (op_array=0x405b8b7c) at
/usr/src/WebServer/php-src/Zend/zend_execute.c:1267
#13 0x082127a4 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
at /usr/src/WebServer/php-src/Zend/zend.c:1018
#14 0x081cc44b in php_execute_script (primary_file=0xbffffaf4) at
/usr/src/WebServer/php-src/main/main.c:1625
#15 0x0824313f in main (argc=2, argv=0xbffffb84) at
/usr/src/WebServer/php-src/sapi/cli/php_cli.c:910
(gdb)

---- apache2 backtrace: ----
Starting program: /usr/sbin/httpd -X
[New Thread 1024 (LWP 853)]
 
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 853)]
0x082b06c8 in ?? ()
(gdb) bt
#0  0x082b06c8 in ?? ()
#1  0x408ee9e0 in _nss_db_getspnam_r () from /lib/libnss_db.so.2
#2  0x408ee11e in _nss_db_endservent () from /lib/libnss_db.so.2
#3  0x408ee3b3 in _nss_db_getservbyname_r () from /lib/libnss_db.so.2
#4  0x4026ea83 in getservbyname_r () from /lib/libc.so.6
#5  0x4026e931 in getservbyname () from /lib/libc.so.6
#6  0x406331af in mysql_once_init () from
/usr/local/lib/mysql/libmysqlclient.so.12
#7  0x406359d8 in mysql_init () from
/usr/local/lib/mysql/libmysqlclient.so.12
#8  0x40328ac4 in php_mysql_do_connect (ht=3, return_value=0x408a6240,
this_ptr=0x0, return_value_used=1, persistent=0)
    at /usr/src/WebServer/php-src/ext/mysql/php_mysql.c:773
#9  0x40328df5 in zif_mysql_connect (ht=3, return_value=0x408a6240,
this_ptr=0x0, return_value_used=1)
    at /usr/src/WebServer/php-src/ext/mysql/php_mysql.c:829
#10 0x404b4410 in zend_do_fcall_common_helper (execute_data=0xbfffd600,
op_array=0x408a57e0)
    at /usr/src/WebServer/php-src/Zend/zend_execute.c:2541
#11 0x404b4c37 in zend_do_fcall_handler (execute_data=0xbfffd600,
op_array=0x408a57e0)
    at /usr/src/WebServer/php-src/Zend/zend_execute.c:2687
#12 0x404b0047 in execute (op_array=0x408a57e0) at
/usr/src/WebServer/php-src/Zend/zend_execute.c:1267
#13 0x4048dc44 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
at /usr/src/WebServer/php-src/Zend/zend.c:1018
#14 0x404478eb in php_execute_script (primary_file=0xbffff870) at
/usr/src/WebServer/php-src/main/main.c:1625
#15 0x404bdbe3 in php_handler (r=0x82aba28) at
/usr/src/WebServer/php-src/sapi/apache2handler/sapi_apache2.c:529
#16 0x080aded9 in ap_run_handler (r=0x82aba28) at config.c:194
#17 0x080ae423 in ap_invoke_handler (r=0x82aba28) at config.c:401
#18 0x08097d16 in ap_process_request (r=0x82aba28) at http_request.c:288
#19 0x08093dea in ap_process_http_connection (c=0x82a59f0) at
http_core.c:293
#20 0x080b7078 in ap_run_process_connection (c=0x82a59f0) at
connection.c:85
#21 0x080b731c in ap_process_connection (c=0x82a59f0, csd=0x82a5918) at
connection.c:211
#22 0x080acbc0 in child_main (child_num_arg=0) at prefork.c:694
#23 0x080acc7c in make_child (s=0x818cb18, slot=0) at prefork.c:734
#24 0x080acd71 in startup_children (number_to_start=5) at prefork.c:806
#25 0x080ad06c in ap_mpm_run (_pconf=0x8189a58, plog=0x81c1b38,
s=0x818cb18) at prefork.c:1022
#26 0x080b25ae in main (argc=2, argv=0xbffffbc4) at main.c:660
(gdb)


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

Reply via email to