php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16906 Warning: MySQL: Unable to save result set in ...
Submitted: 2002-04-29 11:01 UTC Modified: 2003-01-02 19:54 UTC
Votes:5
Avg. Score:4.6 ± 0.5
Reproduced:5 of 5 (100.0%)
Same Version:3 (60.0%)
Same OS:2 (40.0%)
From: vermut at aija dot net Assigned: zak (profile)
Status: Closed Package: MySQL related
PHP Version: 4.1.2, 4.2.0 OS: FreeBSD
Private report: No CVE-ID: None
 [2002-04-29 11:01 UTC] vermut at aija dot net
This is a follow-up to bug 
http://bugs.php.net/bug.php?id=12029

The problem do exists. I've got plenty of them on my FreeBSD, and never got a clue how i fixed it.

Now i'm upgrading to php-4.1.2 (with apache 1.3.14), and problem arises again. Everything was compiled using standard FreeBSD ports Makefile. 

Summary:

Everything works as long as i not include any of mhash, mcrypt and gd2. Tested on 4.1.2 and 4.2.0.

Here are results of some tests:

1. Plugging in old already compiled libphp4.so (4.0.1 i suppose) works.

"./configure" \
"--with-apxs=/usr/local/sbin/apxs" \
"--with-config-file-path=/usr/local/etc" \
"--enable-versioning" \
"--with-system-regex" \
"--disable-debug" \
"--enable-track-vars" \
"--disable-pear" \
"--with-gd=/usr/local" \
"--with-zlib" \
"--with-mcrypt=/usr/local" \
"--with-mhash=/usr/local" \
"--with-imap=/usr/local" \
"--with-mysql=/usr/local" \
"--prefix=/usr/local" \
"i386--freebsd4.3" \
"$@"

libphp4.so		1271565

2. Compiling with mysql only:

CFLAGS='-O -pipe  -I/usr/local/include' \
CXXFLAGS=' -O -pipe  -I/usr/local/include' \
CC='cc' \                                         
CXX='c++' \    
'./configure' \
'--with-apxs=/usr/local/sbin/apxs' \
'--with-config-file-path=/usr/local/etc' \
'--enable-versioning' \
'--with-regex=system' \
'--without-gd' \
'--with-mysql=/usr/local' \
'--prefix=/usr/local' \
'i386-portbld-freebsd4.5' \
"$@"

works.

libphp4.so		1006173


3. The same, but manually running ./configure:

'./configure' \
'--with-apxs=/usr/local/sbin/apxs' \
'--with-config-file-path=/usr/local/etc' \
'--with-mysql=/usr/local' \
'--without-gd' \
"$@"

! libphp4.so		2598686	(very strange!!!)

works.

4. FreeBSD port make: zlib, mysql, mcrypt, mhash:

CFLAGS='-O -pipe  -I/usr/local/include' \
CXXFLAGS=' -O -pipe  -I/usr/local/include' \
CC='cc' \
CXX='c++' \
'./configure' \
'--with-apxs=/usr/local/sbin/apxs' \
'--with-config-file-path=/usr/local/etc' \
'--enable-versioning' \
'--with-regex=system' \
'--without-gd' \
'--without-mysql' \
'--with-zlib' \
'--with-mcrypt=/usr/local' \
'--with-mhash=/usr/local' \
'--with-mysql=/usr/local' \
'--prefix=/usr/local' \
'i386-portbld-freebsd4.5' \
"$@"

libphp4.so		1054805

DOESN'T WORK.

Let's try and remove some components. zlib, mcrypt, mhash seem to
cause an error. Start from mhash.

5. FreeBSD port make: zlib, mysql, mcrypt:

CFLAGS='-O -pipe  -I/usr/local/include' \
CXXFLAGS=' -O -pipe  -I/usr/local/include' \
CC='cc' \
CXX='c++' \
'./configure' \
'--with-apxs=/usr/local/sbin/apxs' \
'--with-config-file-path=/usr/local/etc' \
'--enable-versioning' \
'--with-regex=system' \
'--without-gd' \
'--without-mysql' \
'--with-zlib' \
'--with-mcrypt=/usr/local' \
'--with-mysql=/usr/local' \
'--prefix=/usr/local' \
'i386-portbld-freebsd4.5' \
"$@"

libphp4.so		1050061

DOESN'T WORK.

Ok, maybe it's mcrypt bug?

6. FreeBSD port make: zlib, mysql, mhash:

CFLAGS='-O -pipe  -I/usr/local/include' \
CXXFLAGS=' -O -pipe  -I/usr/local/include' \
CC='cc' \
CXX='c++' \
'./configure' \
'--with-apxs=/usr/local/sbin/apxs' \
'--with-config-file-path=/usr/local/etc' \
'--enable-versioning' \
'--with-regex=system' \
'--without-gd' \
'--without-mysql' \
'--with-zlib' \
'--with-mhash=/usr/local' \
'--with-mysql=/usr/local' \
'--prefix=/usr/local' \
'i386-portbld-freebsd4.5' \
"$@"

libphp4.so		1028045

DOESN'T WORK.

The only case left is zlib. Let's try:

6. FreeBSD port make: mysql, mhash, mcrypt:

CFLAGS='-O -pipe  -I/usr/local/include' \
CXXFLAGS=' -O -pipe  -I/usr/local/include' \
CC='cc' \
CXX='c++' \
'./configure' \
'--with-apxs=/usr/local/sbin/apxs' \
'--with-config-file-path=/usr/local/etc' \
'--enable-versioning' \
'--with-regex=system' \
'--without-gd' \
'--without-mysql' \
'--with-mcrypt=/usr/local' \
'--with-mhash=/usr/local' \
'--with-mysql=/usr/local' \
'--prefix=/usr/local' \
'i386-portbld-freebsd4.5' \
"$@"

libphp4.so		1036937

DOESN'T WORK.

So. Nothing. Let's try adding one-by-one to working configuration (mysql only)

7. FreeBSD port make: mysql, zlib (default)

CFLAGS='-O -pipe  -I/usr/local/include' \
CXXFLAGS=' -O -pipe  -I/usr/local/include' \
CC='cc' \
CXX='c++' \
'./configure' \
'--with-apxs=/usr/local/sbin/apxs' \
'--with-config-file-path=/usr/local/etc' \
'--enable-versioning' \
'--with-regex=system' \
'--without-gd' \
'--without-mysql' \
'--with-zlib' \
'--with-mysql=/usr/local' \
'--prefix=/usr/local' \
'i386-portbld-freebsd4.5' \
"$@"

libphp4.so		1024009

works!

So, problem is in mcrypt AND mhash. Very strange. Maybe there is something with linking in?

8. Just for fun. Manual zlib, mysql, mcrypt, mhash:

'./configure' \
'--with-apxs=/usr/local/sbin/apxs' \
'--with-config-file-path=/usr/local/etc' \
'--with-mysql=/usr/local' \
'--with-zlib' \
'--with-mcrypt=/usr/local' \
'--with-mhash=/usr/local' \
"$@"

libphp4.so		2702054	(much larger...)

still don't work.

9. Lets try working mysql, zlib with IMAP (cclient).

CFLAGS='-O -pipe  -I/usr/local/include' \
CXXFLAGS=' -O -pipe  -I/usr/local/include' \
CC='cc' \
CXX='c++' \
'./configure' \
'--with-apxs=/usr/local/sbin/apxs' \
'--with-config-file-path=/usr/local/etc' \
'--enable-versioning' \
'--with-regex=system' \
'--without-gd' \
'--without-mysql' \
'--with-zlib' \
'--with-imap=/usr/local' \
'--with-mysql=/usr/local' \
'--prefix=/usr/local' \
'i386-portbld-freebsd4.5' \
"$@"

libphp4.so		1097069

works. 

Looks like the problem really lies in mcrypt and mhash.

10. Lets try mysql + mhash?

CFLAGS='-O -pipe  -I/usr/local/include' \
CXXFLAGS=' -O -pipe  -I/usr/local/include' \
CC='cc' \
CXX='c++' \
'./configure' \
'--with-apxs=/usr/local/sbin/apxs' \
'--with-config-file-path=/usr/local/etc' \
'--enable-versioning' \
'--with-regex=system' \
'--without-gd' \
'--without-mysql' \
'--with-mhash=/usr/local' \
'--with-mysql=/usr/local' \
'--prefix=/usr/local' \
'i386-portbld-freebsd4.5' \
"$@"

libphp4.so		1010177

yep. doesn't work.

11. The same should be with mysql + mcrypt, right?

CFLAGS='-O -pipe  -I/usr/local/include' \
CXXFLAGS=' -O -pipe  -I/usr/local/include' \
CC='cc' \
CXX='c++' \
'./configure' \
'--with-apxs=/usr/local/sbin/apxs' \
'--with-config-file-path=/usr/local/etc' \
'--enable-versioning' \
'--with-regex=system' \
'--without-gd' \
'--without-mysql' \
'--with-mcrypt=/usr/local' \
'--with-mysql=/usr/local' \
'--prefix=/usr/local' \
'i386-portbld-freebsd4.5' \
"$@"

libphp4.so		1032193

doesn't work. 

So, maybe the problem is localized. Few more checks

12. FreeBSD port make - php 4.2.0, mysql, zlib, mhash, mcrypt, imap, gd2 to make sure
it's not a version problem.

CFLAGS='-O -pipe  -I/usr/local/include' \
CXXFLAGS=' -O -pipe  -I/usr/local/include' \
CC='cc' \
CXX='c++' \
'./configure' \
'--with-apxs=/usr/local/sbin/apxs' \
'--with-config-file-path=/usr/local/etc' \
'--enable-versioning' \
'--with-regex=system' \
'--without-gd' \
'--without-mysql' \
'--with-gd=/usr/local' \
'--enable-gd-native-ttf' \
'--with-freetype-dir=/usr/local' \
'--with-jpeg-dir=/usr/local' \
'--with-png-dir=/usr/local' \
'--with-zlib' \
'--with-mcrypt=/usr/local' \
'--with-mhash=/usr/local' \
'--with-imap=/usr/local' \
'--with-mysql=/usr/local' \
'--prefix=/usr/local' \
'i386-portbld-freebsd4.5' \
"$@"

libphp4.so		1203049

doesn't work.

13. FreeBSD port make - php 4.2.0, mysql, zlib, imap, gd2 to make sure
it's mhash AND mcrypt problem.

CFLAGS='-O -pipe  -I/usr/local/include' \
CXXFLAGS=' -O -pipe  -I/usr/local/include' \
CC='cc' \
CXX='c++' \
'./configure' \
'--with-apxs=/usr/local/sbin/apxs' \
'--with-config-file-path=/usr/local/etc' \
'--enable-versioning' \
'--with-regex=system' \
'--without-gd' \
'--without-mysql' \
'--with-gd=/usr/local' \
'--enable-gd-native-ttf' \
'--with-freetype-dir=/usr/local' \
'--with-jpeg-dir=/usr/local' \
'--with-png-dir=/usr/local' \
'--with-zlib' \
'--with-imap=/usr/local' \
'--with-mysql=/usr/local' \
'--prefix=/usr/local' \
'i386-portbld-freebsd4.5' \
"$@"
 
libphp4.so		1173789

cool. doesn't work. gosh, what's wrong? Continue investigations:

14. FreeBSD port make: working (php 4.1.2, mysql, zlib with IMAP (cclient)) + gd2.

CFLAGS='-O -pipe  -I/usr/local/include' \
CXXFLAGS=' -O -pipe  -I/usr/local/include' \
CC='cc' \
CXX='c++' \
'./configure' \
'--with-apxs=/usr/local/sbin/apxs' \
'--with-config-file-path=/usr/local/etc' \
'--enable-versioning' \
'--with-regex=system' \
'--without-gd' \
'--without-mysql' \
'--with-gd=/usr/local' \
'--enable-gd-native-ttf' \
'--with-freetype-dir=/usr/local' \
'--with-jpeg-dir=/usr/local' \
'--with-png-dir=/usr/local' \
'--with-zlib' \
'--with-imap=/usr/local' \
'--with-mysql=/usr/local' \
'--prefix=/usr/local' \
'i386-portbld-freebsd4.5' \
"$@"

libphp4.so		1164165

doesn't work. gosh, i'm tired. maybe problem lies in gd2 too? 

15. FreeBSD port make: PHP 4.1.2 mysql + gd2 + zlib.

CFLAGS='-O -pipe  -I/usr/local/include' \
CXXFLAGS=' -O -pipe  -I/usr/local/include' \
CC='cc' \
CXX='c++' \
'./configure' \
'--with-apxs=/usr/local/sbin/apxs' \
'--with-config-file-path=/usr/local/etc' \
'--enable-versioning' \
'--with-regex=system' \
'--without-gd' \
'--without-mysql' \
'--with-gd=/usr/local' \
'--enable-gd-native-ttf' \
'--with-freetype-dir=/usr/local' \
'--with-jpeg-dir=/usr/local' \
'--with-png-dir=/usr/local' \
'--with-zlib' \
'--with-mysql=/usr/local' \
'--prefix=/usr/local' \
'i386-portbld-freebsd4.5' \
"$@"

libphp4.so		1087009

doesn't work.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-29 11:28 UTC] msopacua at idg dot nl
Just for fun:
on the query that fails, run a CHECK TABLE on the tables involved.

See if you get a 'error 134' from table handler.

Are you by any chance running phpBB-1.4.x?

I've seen this error 'unable to save result set' a few times, while it is actually the above table handler error in mysql.
 [2002-04-29 11:35 UTC] vermut at aija dot net
mysql> CHECK TABLE wpm_tree_en;
+----------------------+-------+----------+----------+
| Table                | Op    | Msg_type | Msg_text |
+----------------------+-------+----------+----------+
| project3.wpm_tree_en | check | status   | OK       |
+----------------------+-------+----------+----------+
1 row in set (0.03 sec)

Everything fine, as i see. I do run phpBB, but i run a completely different and unrelated test script. I've done myisamchk -r on all tables.
 [2002-04-30 20:12 UTC] msopacua at idg dot nl
This error occured with me, when synching topics in phpBB admin. But my theory is, that for some MySQL errors, php is unable to get the right error string and defaults to 'unable to get result'.
The error does show, when you use the mysql client CLI.

Could you test that, by executing the exact query that fails, via the mysql client CLI?
 [2002-05-01 05:31 UTC] vermut at aija dot net
The problem is: _every_ UPDATE query executed from PHP reports this warning. Data become updated, but execution stops. The same query executed in plain mysql does the same, but does not report a warning.
 [2002-05-02 06:34 UTC] sniper@php.net
Please add SHORT but complete example script to this report
which can be used to reproduce this.

--Jani

 [2002-05-02 13:24 UTC] vermut at aija dot net
As I said - every update query fails. I use this example:

<?php

define ("DB_HOST","localhost");
define ("DB_LOGIN","root");
define ("DB_PSW","password");
define ("DB_NAME","mysql");

mysql_connect(DB_HOST,DB_LOGIN,DB_PSW); 
mysql_select_db(DB_NAME);

mysql_query("UPDATE user set user='root' where user='root'");

?>

Query, executed directly in mysql, works.
 [2002-07-02 14:32 UTC] cynic@php.net
this works with 4.3.0-dev, I'll have to try 4.2.1 tomorrow.

roman@freepuppy ~/install/php4 > cat ./config.nice.cli+apxs                192:0
#! /bin/sh
#
# Created by configure

'./configure' \
'--enable-cli' \
'--enable-inline-optimization' \
'--enable-ftp' \
'--enable-shmop' \
'--enable-sysvsem' \
'--enable-sysvshm' \
'--enable-sockets' \
'--enable-tokenizer' \
'--disable-session' \
'--disable-shared' \
'--with-apxs=/usr/local/sbin/apxs' \
'--with-openssl' \
'--with-zlib' \
'--with-bz2' \
'--with-curl' \
'--with-gettext' \
'--with-iconv' \
'--with-mcrypt=/usr/local' \
'--with-mhash=/usr/local' \
'--with-ncurses' \
'--with-readline' \
'--with-pear' \
'--with-config-file-path=/usr/local/etc' \
'--with-mysql=/usr/local' \
"$@"

<?

    mysql_connect('localhost', 'root', '');
    mysql_select_db('mysql');
    $rs = mysql_query("UPDATE user set user='root' where user='root'");

    if (!$rs)
        printf("%d: %s\n\n", mysql_errno(), mysql_error());
    else
        print("all clear\n\n");
 

output:

all clear
 [2002-07-02 14:53 UTC] cynic@php.net
umm, I should've added that I've encountered something like this just yesterday with 4.1.2/1.3.24, 4.2.1/1.3.24 and 4.2.1/1.3.26, but that was on RH 7.2. and the error mesage was different.

all updates from php were corrupting the tables. updates from mysql(1) were ok. eventually it got fixed by dumping, dropping, and recreating the table.

but that's probably completely unrelated.
 [2002-07-23 15:51 UTC] bugs dot php at computer dot NOSPAM dot creations dot nl
I've got the same error on the webserver of my hosting provider (Linux 2.4.13) using PHP 4.2.2 when updating/inserting records to MySQL (client 3.23.39). Also a simple select of all records (approx. 3750 records, 479Kb in total as line-delimited text)

Anyone got an idea how to solve this?

If you respond, please connect computer and creations in my emailaddress.
 [2002-09-17 01:38 UTC] zak@php.net
Assigning all open mysql bugs to myself for 4.3 release. 
 [2002-10-01 04:37 UTC] g at firebolt dot com
I was able to solve this bug by doing the following... granted, the bug only existed for me once I had a table with > 90000 rows.

Run a: 
SET SQL_BIG_TABLES=1;

And MySQL will utilize more memory and be able to save the result set.

Optionally, when done, do this:

SET SQL_BIG_TABLES=0;

(tip courtesy of: http://www.faqts.com/knowledge_base/view.phtml/aid/9824)
 [2002-11-25 08:41 UTC] duke at struktuur dot ee
I got the same error message and it disappeared after I did myisamchk -r /db/mydb/*.MYI

Therefore I doubt that this is a PHP bug at all.
 [2003-01-02 19:54 UTC] nicos@php.net
Right, this is not. It's fixed now.

Thank for your reports.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 08:01:27 2024 UTC