php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53925 Segmentation Fault while useing mysql.so
Submitted: 2011-02-04 14:21 UTC Modified: 2011-08-21 12:57 UTC
From: stadnicki at gmail dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.3.5 OS: FreeBSD 7.3 amd64
Private report: No CVE-ID: None
 [2011-02-04 14:21 UTC] stadnicki at gmail dot com
Description:
------------
PHP was configured with:
--prefix=/usr/local/"$DNAME" \
--target=i686-pc-freebsd \
--disable-debug \
--enable-exif \
--enable-libxml \
--enable-soap \
--with-iconv \
--with-zlib \
--enable-cli \
--with-curl \
--enable-mbstring=all \
--with-gettext \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-gd \
--with-openssl \
--with-jpeg-dir \
--with-pear=/usr/local/php/lib/php \
--with-freetype-dir=/home/www/ \
--with-mssql \
--disable-phar \
--with-mcrypt

then compiled and installed to:
/usr/local/php-5.3.5

After that I needed to compile mysql.so from PHP extensions sources. We need to test basic mysql module before we will write our own (mysql is installed into /usr/local/mysql). So in directory of PHP sources (/home/soft/php-5.3.5/ext/mysql) :
machine1# /usr/local/php-5.3.5/bin/phpize
machine1# ./configure --with-php-config=/usr/local/php-5.3.5/bin/php-config --with-mysql=/usr/local/mysql
machine1# make

Here is everything OK, but after:
machine1# /usr/local/php-5.3.5/bin/php -m -d extension=/home/php-5.3.5/ext/mysql/modules/mysql.so

I recieve a Segmentation fault: 11 (core dumped)

Test script:
---------------
Just run php:
/usr/local/php-5.3.5/bin/php -m -d extension=/home/php-5.3.5/ext/mysql/modules/mysql.so

Expected result:
----------------
machine1# /usr/local/php-5.3.5/bin/php -m -d extension=/home/php-5.3.5/ext/mysql/modules/mysql.so
[PHP Modules]
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
gd
gettext
hash
iconv
json
libxml
mbstring
mcrypt
mssql
mysql
openssl
pcre
PDO
pdo_sqlite
posix
Reflection
session
SimpleXML
soap
SPL
SQLite
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zlib

[Zend Modules]

machine1# 

Actual result:
--------------
machine1# /usr/local/php-5.3.5/bin/php -m -d extension=/home/php-5.3.5/ext/mysql/modules/mysql.so
[PHP Modules]
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
gd
gettext
hash
iconv
json
libxml
mbstring
mcrypt
mssql
mysql
openssl
pcre
PDO
pdo_sqlite
posix
Reflection
session
SimpleXML
soap
SPL
SQLite
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zlib

[Zend Modules]

Segmentation fault: 11 (core dumped)
machine1# 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-02-04 14:22 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2011-02-04 14:22 UTC] pajoye@php.net
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.


 [2011-08-21 12:18 UTC] tester123 at mail dot ru
Hi. Here is my gdb output:

gdb php /root/php.core
...
This GDB was configured as "amd64-marcel-freebsd"...(no debugging symbols found)...
Core was generated by `php'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libcrypt.so.4...(no debugging symbols found)...done.
Loaded symbols for /lib/libcrypt.so.4
Reading symbols from /usr/lib/librt.so.1...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/librt.so.1
Reading symbols from /lib/libm.so.5...(no debugging symbols found)...done.
Loaded symbols for /lib/libm.so.5
Reading symbols from /usr/local/lib/libxml2.so.5...(no debugging symbols found)...done.
Loaded symbols for /usr/local/lib/libxml2.so.5
Reading symbols from /lib/libz.so.4...(no debugging symbols found)...done.
Loaded symbols for /lib/libz.so.4
Reading symbols from /usr/local/lib/libiconv.so.3...(no debugging symbols found)...done.
Loaded symbols for /usr/local/lib/libiconv.so.3
Reading symbols from /lib/libc.so.7...(no debugging symbols found)...done.
Loaded symbols for /lib/libc.so.7
Reading symbols from /libexec/ld-elf.so.1...(no debugging symbols found)...done.
Loaded symbols for /libexec/ld-elf.so.1
#0  0x00000008055e27b0 in ?? ()
(gdb) bt
#0  0x00000008055e27b0 in ?? ()
Cannot access memory at address 0x7fffffffea48
(gdb) quit

When i disable the mysql.so extension, all working. Please, solve the problem.
 [2011-08-21 12:20 UTC] tester123 at mail dot ru
UPD

i have the php 5.2 branch
 [2011-08-21 12:25 UTC] tester123 at mail dot ru
UPD

gdb -c php.core /usr/local/bin/php
...
This GDB was configured as "amd64-marcel-freebsd"...(no debugging symbols found)...
Core was generated by `php'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libcrypt.so.4...(no debugging symbols found)...done.
Loaded symbols for /lib/libcrypt.so.4
Reading symbols from /usr/lib/librt.so.1...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/librt.so.1
Reading symbols from /lib/libm.so.5...(no debugging symbols found)...done.
Loaded symbols for /lib/libm.so.5
Reading symbols from /usr/local/lib/libxml2.so.5...(no debugging symbols found)...done.
Loaded symbols for /usr/local/lib/libxml2.so.5
Reading symbols from /lib/libz.so.4...(no debugging symbols found)...done.
Loaded symbols for /lib/libz.so.4
Reading symbols from /usr/local/lib/libiconv.so.3...(no debugging symbols found)...done.
Loaded symbols for /usr/local/lib/libiconv.so.3
Reading symbols from /lib/libc.so.7...(no debugging symbols found)...done.
Loaded symbols for /lib/libc.so.7
Reading symbols from /libexec/ld-elf.so.1...(no debugging symbols found)...done.
Loaded symbols for /libexec/ld-elf.so.1
#0  0x00000008055e27b0 in ?? ()
(gdb) bt
#0  0x00000008055e27b0 in ?? ()
#1  0x0000000800c2d9c5 in xmlFreeMutex () from /usr/local/lib/libxml2.so.5
#2  0x0000000800c2d405 in xmlCleanupGlobals () from /usr/local/lib/libxml2.so.5
#3  0x0000000800bc5e8a in xmlCleanupParser () from /usr/local/lib/libxml2.so.5
#4  0x0000000000442dc8 in php_libxml_shutdown ()
#5  0x0000000000442df9 in zm_shutdown_libxml ()
#6  0x00000000005051d1 in module_destructor ()
#7  0x000000000050ba4b in zend_hash_apply_deleter ()
#8  0x000000000050bcb8 in zend_hash_graceful_reverse_destroy ()
#9  0x0000000000501788 in zend_shutdown ()
#10 0x00000000004c12ef in php_module_shutdown ()
#11 0x00000000005814f2 in main ()
 [2011-08-21 12:34 UTC] pajoye@php.net
Please add the debug symbols, without them the backtrace is useless.

Do you mean you use php 5.2? If yes, please try using 5.3.
 [2011-08-21 12:49 UTC] tester123 at mail dot ru
The problem solved :)

look http://groups.google.com/group/mailing.freebsd.ports/browse_thread/thread/8b0c80f86204226a

You need to add LINKTHR option in make config and recompile php and it's modules to be safe.
 [2011-08-21 12:54 UTC] tester123 at mail dot ru
and about which debug symbols do you talk? please explain
 [2011-08-21 12:57 UTC] pajoye@php.net
-Status: Feedback +Status: Bogus
 [2011-08-21 12:57 UTC] pajoye@php.net
.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri May 27 18:06:15 2022 UTC