Persistant connections...
| From: | Thomas Wentzel | Date: | Tue, 27 Mar 2001 08:59:18 +0000 |
| Subject: | Persistant connections... | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-50024@lists.php.net to get a copy of this message | ||
Hi,
I'm hacking on a module that is communicating with an old
flatfile db. When a connection to the db is made, all necessary
information (such as record and field sizes/types)from the db are
read.
If php-script A opens a connection to the db, and then loads a
new php-script B - then the connection is automagically shut down.
I believe this is due to the fact, that I do the following:
PHP_MINIT_FUNCTION(raima)
{
// _d_closeall simply closes all open connections
le_raima=register_list_destructors(_d_closeall,NULL);
return SUCCESS;
}
But how are these list destructors used? How should I avoid that my
connection is closed _every_ time I load a new page? Is it simply a
matter of placing some logic in _d_closeall, that only does the actual
db-closing if appropriate? AND can I somehow differentiate between
a page load and a browser termination? When to use zend_register_\
list_destructors_ex???
How and where should I place my data - for them to be shared across
the entrire session. At the moment I have declared some static variables
in the beginning of the source file - is this OK or am I supposed to do
it in a special PHP-style?
TIA
Thomas