#32675 [Opn]: mysql_fetch_field() causes segmentation fault
| From: | michael at cosby dot dhs dot org | Date: | Mon, 11 Apr 2005 20:24:52 +0000 |
| Subject: | #32675 [Opn]: mysql_fetch_field() causes segmentation fault | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-76658@lists.php.net to get a copy of this message | ||
ID: 32675
User updated by: michael at cosby dot dhs dot org
Reported By: michael at cosby dot dhs dot org
Status: Open
Bug Type: MySQL related
Operating System: Linux 2.6
PHP Version: 5.0.4
New Comment:
It appears that I'm already using the external mysql client library, or
I'm reading phpinfo() wrong:
MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 4.0.21
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /tmp/mysql.sock
MYSQL_INCLUDE -I/usr/include/mysql
MYSQL_LIBS -L/usr/lib -lmysqlclient
Previous Comments:
------------------------------------------------------------------------
[2005-04-11 20:04:08] michael at cosby dot dhs dot org
For the libraries, it appears that my PHP is *not* compiling with the
4.1.11 client library, but with a 4.0.21 client library. I'm trying to
get it to compile with with the 4.1.11 library to see what happens, but
I doubt that will fix it since this same 4.0.21 client library works
fine with PHP 5.0.2.
------------------------------------------------------------------------
[2005-04-11 20:01:16] michael at cosby dot dhs dot org
It looks like my query cache is already disabled:
mysql> show variables;
+---------------------------------+----------------------------+
| Variable_name | Value |
+---------------------------------+----------------------------+
...
| query_cache_limit | 1048576 |
| query_cache_min_res_unit | 4096 |
| query_cache_size | 0 |
| query_cache_type | ON |
| query_cache_wlock_invalidate | OFF |
...
From the mysql manual at
http://dev.mysql.com/doc/mysql/en/query-cache.html:
"
To disable the query cache at server startup, set the query_cache_size
system variable to 0. By disabling the query cache code, there is no
noticeable overhead.
"
(I'm not real familiar with the query cache, so I wanted to be 100%
sure it was disabled).
------------------------------------------------------------------------
[2005-04-11 19:54:43] georg@php.net
Does the problem still exist if you disable MySQL's query cache?
------------------------------------------------------------------------
[2005-04-11 17:56:45] sniper@php.net
Try configure PHP using the external mysql client libraries:
1. delete config.cache file
2 run your configure with this change:
--with-mysql=/usr (or whatever the install PREFIX is)
Also note: /usr/local/lib or /usr/lib are NOT correct values for any
PHP configure option!! They're /usr/local and /usr
------------------------------------------------------------------------
[2005-04-11 17:51:40] michael at cosby dot dhs dot org
Description:
------------
environment:
apache 2.0.52 in multi-threaded mode
mysql 4.1.11 (and 4.1.6-gamma)
PHP 5.0.4
php configuration:
./configure --with-apxs2=/usr/sbin/apxs \
--with-zlib --enable-calendar \
--with-gd --with-mhash \
--with-xsl --enable-memory-limit \
--prefix=/home/php --with-mysql \
--with-openssl --with-jpeg-dir=/usr/lib \
--with-gettext \
--with-curl=/usr/local/lib
Notes:
* This bug does not occur if I use PHP 5.0.2 in the same environment
instead of PHP 5.0.4.
* It's possible that the fix for bug #31288 is related to this issue.
This code does *not* call the (deprecated) function mysql_list_fields()
at all.
Reproduce code:
---------------
The following code snippet (taken from WordPress wp-includes/wp-db.php,
a blogging program):
while ($i < mysql_num_fields($this->result)) {
$this->col_info[$i] = mysql_fetch_field($this->result);
$i++;
}
Even a single invocation of mysql_fetch_field() will cause the seg.
fault. Nothing is written to the server's error log from PHP itself.
Expected result:
----------------
Code inside a script should not cause a seg. fault.
Actual result:
--------------
When using the code snippet specified, the apache child running the
request seg. faults.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32675&edit=1