Re: global variable and pconnect trouble in extension
| From: | Andreas Karajannis | Date: | Fri, 23 Jun 2000 12:55:06 +0000 |
| Subject: | Re: global variable and pconnect trouble in extension | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-22052@lists.php.net to get a copy of this message | ||
Chesneau Serge wrote:
>
> Hi,
>
> Some trouble with global.
> I wrote a test module called ats. In this module, i need a mechanism
> like persistent database connexion witch use a global variable
> (num_persistent) that count the number of new permanent connexion. It
> seem that this counter (num_persistent) is not refreshing (or storing)
> correctly. My extension has two fonction. One for register user in the
> hash list (ats_register), the second for showing num_persistent and the
> hash content. When i call two php script (ats2.php and ats3.php) with
> two browser window and refreshing (5/6 time), the result is strange.
> I think that a correctly write my module but, if the global variable
> (num_persistent) can't correctly be set, i think that allocation storing
> in the hash table can be wrong, ... but i'am a newbie.
>
Your global variable is only a per-process global variable.
Since apache is a multi-process server, each of the child processes that
respond to requests have their own instance of this variable.
See the discussion on persistent connections in the manual for more
information.
-Andreas
--
Andreas Karajannis
GMD National Research Center for Information Technology
Schloss Birlinghoven, D-53754 Sankt Augustin
Phone +49 2241 142948