Bug #5986 Updated: Combination of msql() and msql_connect() causes lost connections.
| From: | pete at byways dot org | Date: | Thu, 29 Nov 2001 20:54:42 +0000 |
| Subject: | Bug #5986 Updated: Combination of msql() and msql_connect() causes lost connections. | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-72071@lists.php.net to get a copy of this message | ||
ID: 5986
User updated by: pete@byways.org
Reported By: pete@byways.org
Old Status: Feedback
Status: Open
Bug Type: mSQL related
Operating System: RedHat Linux 6.2
PHP Version: 4.0.1
New Comment:
I've confirmed this to be fixed as of PHP 4.0.6, Apache 1.3.20, mSQL 2.0.11. The script
provided also works in PHP 4.1.0RC3.
Previous Comments:
------------------------------------------------------------------------
[2001-11-25 07:41:14] mfischer@php.net
Can you test if this has changed with the latest RC?
http://www.php.net/~zeev/php-4.1.0RC3.tar.gz
Feedback.
------------------------------------------------------------------------
[2000-08-11 04:49:33] pete@byways.org
I believe that the problem is caused by the msql_globals.default_link value being set to an mSQL
database link that has been closed by _close_msql_link in php_msql.c. Ideally, when a database link
is closed, if it's the default link, then reset the default link to -1. I'm not sure how
to do that in the code. I can get the script to work if I add this line to the _close_msql_link
function:
msql_globals.default_link = -1;
However, I'm sure this is a less than adequate method, since we don't want to reset it all
the time.
------------------------------------------------------------------------
[2000-08-10 04:25:01] pete@byways.org
I get the same errors after patching php_msql.c and re-running the script I provided.
------------------------------------------------------------------------
[2000-08-10 02:02:24] thies@php.net
fixed in CVS (patch by nick@loman.net)
------------------------------------------------------------------------
[2000-08-05 19:04:54] pete@byways.org
The following script causes unexpected errors:
Function test ()
{
$conn1 = msql_connect();
msql_select_db("nsbo", $conn1);
$Res = msql_query("SELECT * FROM State", $conn1);
echo msql_NumRows($Res)." rows in State<br>";
msql_close($conn1);
}
test();
$Res = msql("nsbo", "SELECT * FROM Member");
echo msql_NumRows($Res)." rows in Member<br>";
$Res = msql("library", "SELECT * FROM Publication");
echo msql_NumRows($Res)." rows in Publication<br>";
The output from PHP is this:
60 rows in State
713 rows in Member
Warning: 1 is not a valid mSQL-Link resource in /disk2/websites/NSBO/test/test_db.html on line 18
Warning: Supplied argument is not a valid mSQL result resource in
/disk2/websites/NSBO/test/test_db.html on line 19
rows in Publication
I am using mSQL 2.0.11, PHP 4.0.1, and Apache 3.0.12. My PHP configuration is:
./configure --with-apxs=/usr/sbin/apxs --with-gettext=no --with-msql --with-pgsql --without-mysql
--enable-track-vars=yes --with-pdflib=/usr/local --with-zlib --with-jpeg-dir=/usr
--with-tiff-dir=/usr --with-session=/tmp --enable-trans-sid
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=5986&edit=1