views:

31

answers:

1

Hi all, As the title explains, I want to maintain an information across requests from multiple clients. Let me put in a simple example to explain what I want. This example is just for illustration of my question and not the purpose of the post.

Example: I want to count the total number of requests that a server has had so far from all the clients for different php scripts. I mean the TOTAL number of requests that comes from MULTIPLE different clients for MULTIPLE DIFFERENT pages. I now will have an extension that reads that global count and returns it for the PHP programmer.

Super global variables that the zend provides are persistent just across multiple requests from same client. Does anyone know how and where to store the variable and the way to retrieve it as well??

+1  A: 

The only way is to use some form of Inter-process communication. For instance, you could use shared memory (but you'll have to synchronize the access to it).

Remember the most common way to run PHP is without thread support – multiple processes, one process serving only one client at a time. The reason is that PHP is substantially faster in this configuration.

Artefacto
But where and how are the configurations such as those in php-ini configuration file are loaded? Are you sure that there is no place where a global variable could persist across multiple requests from different clients?
Karthick
@Kar Lots of stuff is persisted across multiple requests, but it's not shared between the several PHP processes.
Artefacto
I see what you are saying. So those values in the Php-ini file are read by the processes when they are created. Meaning if there are three to five httpd processes are created, all the initialisation information are read while the process is being created is it?
Karthick
@Kar That's right.
Artefacto