php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27734 Segmentation fault (11)
Submitted: 2004-03-27 13:11 UTC Modified: 2010-12-20 10:24 UTC
From: kevenden at peak dot org Assigned:
Status: No Feedback Package: MySQL related
PHP Version: 5.0.0RC1 OS: Slackware (modified)
Private report: No CVE-ID: None
 [2004-03-27 13:11 UTC] kevenden at peak dot org
Description:
------------
When runing the sample PHP/MySQL connection script from the documentation the error.log file displays :

[Sat Mar 27 10:11:47 2004] [notice] child pid 17417 exit signal Segmentation fault (11)

The same script run from the command line produces a simple:

Segmentation fault

I upgraded my MySQL database to 4.0.18 from a 3.0 release.

My configure options for php:

'./configure' \
'--with-mysql=/usr/local/mysql/' \
'--with-apxs2=/var/lib/apache/sbin/apxs' \
'--disable-debug' \
'--enable-pic' \
'--enable-inline-optimization' \
'--with-zlib=shared' \
'--with-zlib-dir=/usr' \
'--enable-magic-quotes' \
'--enable-track-vars' \
'--with-regex=system' \
'--with-mod_charset' \
'--enable-force-cgi-redirect' \
'--with-openssl=/usr/local/ssl/' \
'--with-bz2=/usr' \
'--with-jpeg-dir=/usr' \
'--with-inifile' \
'--with-tidy' \
'--with-curl=/usr/local' \
'--with-flatfile' \
'--with-png-dir=/usr' \
'--with-gd' \
'--with-ttf' \
'--enable-gd-native-ttf' \
'--with-freetype-dir=/usr' \
'--with-gmp' \
'--with-mhash' \
'--enable-dba' \
'--with-db4=/usr/local/BerkeleyDB.4.2/' \
'--with-mcrypt'

My MySQL configure options:

CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \
-fno-exceptions -fno-rtti" ./configure \
--prefix=/usr/local/mysql --enable-assembler \
--with-mysqld-ldflags=-all-static


Reproduce code:
---------------
<?php
        $link = mysql_connect("localhost", "kevenden", "some_password")
            or die("Could not connect: " . mysql_error());
        echo "Connected successfully";
mysql_close($link);
?>


Expected result:
----------------
Connected successfully

Actual result:
--------------
Segmentation fault (11)

Core was generated by `php mysqltest.php'.
Program terminated with signal 11, Segmentation fault.
Cannot access memory at address 0x40059dd8.
#0  0x0 in ?? ()
(gdb) bt
#0  0x0 in ?? ()
#1  0x4078e1fc in ?? () from /lib/libnss_db.so.2
#2  0x4078e2bc in ?? () from /lib/libnss_db.so.2
#3  0x4078d8fd in ?? () from /lib/libnss_db.so.2
#4  0x4078dc09 in ?? () from /lib/libnss_db.so.2
#5  0x406f4bb0 in ?? () from /lib/libc.so.6
#6  0x406f49f5 in ?? () from /lib/libc.so.6
#7  0x40061d40 in ?? () from /usr/local/mysql/lib/mysql/libmysqlclient.so.12
#8  0x40061be2 in ?? () from /usr/local/mysql/lib/mysql/libmysqlclient.so.12
#9  0x80d9421 in ?? ()
#10 0x80da5cc in ?? ()
#11 0x82129bb in ?? ()
#12 0x8212b4e in ?? ()
#13 0x820ede8 in ?? ()
#14 0x81f0b7f in ?? ()
#15 0x81b770f in ?? ()
#16 0x821a5ae in ?? ()
#17 0x406199b3 in ?? () from /lib/libc.so.6


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-28 01:49 UTC] magnus@php.net
Remove --with-regex=system and add --enable-debug and regenerate the backtrace.

 [2004-03-28 13:16 UTC] kevenden at peak dot org
Recompiled with suggested configure changes.  Running gdb on the core produced by the php binary produced:

<---------------------------------------------------->

K9:~/public_html/php_test$ gdb /usr/local/bin/php /home/kevenden/public_html/php_test/core
This GDB was configured as "i686-pc-linux-gnu"...
Core was generated by `php mysqltest.php'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libcrypt.so.1...done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /usr/local/mysql/lib/mysql/libmysqlclient.so.12...done.
Loaded symbols for /usr/local/mysql/lib/mysql/libmysqlclient.so.12
Reading symbols from /usr/lib/libz.so.1...done.
Loaded symbols for /usr/lib/libz.so.1
Reading symbols from /lib/libm.so.6...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /usr/local/lib/libmhash.so.2...done.
Loaded symbols for /usr/local/lib/libmhash.so.2
Reading symbols from /usr/local/lib/libmcrypt.so.4...done.
Loaded symbols for /usr/local/lib/libmcrypt.so.4
Reading symbols from /usr/lib/libltdl.so.0...done.
Loaded symbols for /usr/lib/libltdl.so.0
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /usr/local/lib/libgmp.so.3...done.
Loaded symbols for /usr/local/lib/libgmp.so.3
Reading symbols from /usr/local/lib/libfreetype.so.6...done.
Loaded symbols for /usr/local/lib/libfreetype.so.6
Reading symbols from /usr/lib/libpng.so.3...done.
Loaded symbols for /usr/lib/libpng.so.3
Reading symbols from /usr/lib/libjpeg.so.62...done.
Loaded symbols for /usr/lib/libjpeg.so.62
Reading symbols from /usr/local/BerkeleyDB.4.2/lib/libdb-4.2.so...done.
Loaded symbols for /usr/local/BerkeleyDB.4.2/lib/libdb-4.2.so
Reading symbols from /usr/local/ssl//lib/libssl.so.0.9.7...done.
Loaded symbols for /usr/local/ssl//lib/libssl.so.0.9.7
---Type <return> to continue, or q <return> to quit---
Reading symbols from /usr/local/ssl//lib/libcrypto.so.0.9.7...done.
Loaded symbols for /usr/local/ssl//lib/libcrypto.so.0.9.7
Reading symbols from /lib/libresolv.so.2...done.
Loaded symbols for /lib/libresolv.so.2
Reading symbols from /lib/libnsl.so.1...done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /usr/local/lib/libcurl.so.2...done.
Loaded symbols for /usr/local/lib/libcurl.so.2
Reading symbols from /usr/local/lib/libxml2.so.2...done.
Loaded symbols for /usr/local/lib/libxml2.so.2
Reading symbols from /lib/libpthread.so.0...done.
Loaded symbols for /lib/libpthread.so.0
Reading symbols from /usr/local/lib/libiconv.so.2...done.
Loaded symbols for /usr/local/lib/libiconv.so.2
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /lib/libnss_db.so.2...done.
Loaded symbols for /lib/libnss_db.so.2
Reading symbols from /lib/libnss_files.so.2...done.
Loaded symbols for /lib/libnss_files.so.2
Reading symbols from /lib/libdb-3.1.so...done.
Loaded symbols for /lib/libdb-3.1.so
0x00000000 in ?? ()
(gdb) bt
#0  0x00000000 in ?? ()
(gdb) 

<------------------------------------------------------->

Running gdb on the core produced by running httpd -X :

K9:~# gdb /var/lib/apache/sbin/httpd  /root/core      
GNU gdb 6.0
This GDB was configured as "i686-pc-linux-gnu"...

warning: core file may not match specified executable file.
Core was generated by `gdb /var/lib/apache/sbin/httpd'.
Program terminated with signal 11, Segmentation fault.
#0  0x080d094b in posix_class_maps ()
(gdb) bt
#0  0x080d094b in posix_class_maps ()
#1  0x401bd1c8 in ?? ()
#2  0xbffff3ec in ?? ()
#3  0xbffff32c in ?? ()
#4  0x0807cbd9 in translate_userdir (r=0xffffffff) at mod_userdir.c:314
Previous frame identical to this frame (corrupt stack?)
(gdb) frame 4
#4  0x0807cbd9 in translate_userdir (r=0xffffffff) at mod_userdir.c:314
314     mod_userdir.c: No such file or directory.
        in mod_userdir.c
(gdb)
 [2004-03-28 18:50 UTC] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

The crash occurs outside of PHP. 
 [2004-03-28 18:53 UTC] iliaa@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

should be bogus. 
 [2010-12-20 10:24 UTC] jani@php.net
-Package: Tidy +Package: MySQL related
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Nov 10 17:01:28 2024 UTC