开发者

Zend Global Variable in an Extension Persisting Across Multiple Requests

As the title explains, I want to maintain an information across req开发者_运维知识库uests 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜