session_register() Killing MySQL Connection
| From: | Brian T. Allen | Date: | Wed, 22 Jan 2003 00:40:26 +0000 |
| Subject: | session_register() Killing MySQL Connection | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-132530@lists.php.net to get a copy of this message | ||
Hi,
Friday night I upgrade my server with the following:
Apache 1.3.27
PHP 4.3.0
MySQL 3.23.54a
Mod_SSL 2.8.12
OpenSSL 0.9.7
ZendOptimizer 2.1.0
Immediately I started having really weird problems that proved almost
impossible to debug.
I finally narrowed it down to a few lines of code that get included at
the top of all the pages:
<?php
if(!$REFER_SITE){
$REFER_SITE = $HTTP_REFERER;
session_register("REFER_SITE");
}
?>
(I already know about the register_globals thing and I'm working on
getting rid of it, but that will be a long road)...
If both $REFER_SITE and $HTTP_REFERER are uninitialized ($HTTP_REFERER
may only be empty) then session_register() kills the database connection
on the page and none of my queries work...
mysql_error() simply shows "Query was empty".
I created an otherwise empty page that had only the code above, a
database connection, and a query and confirmed that this is the case.
I bring this to the list only to help others avoid the same 3 days of
nightmarish hell I've just enjoyed on a large production site with
goblins... And to confirm that the above is correct and seek possible
long term solutions.
Adding this line above session_register() is a temporary solution:
if(!$REFER_SITE){
$REFER_SITE = "";
}
Thanks all!
Brian Allen
brian@gzmarketing.com