Search code examples
phpvariablesscopeinstanceapc

in PHP 5.3.3 how can a "per server" or "per instance" or "per website" variable be defined and used?


for what I've tried "static" variables and apc_add or apc_store are "per session", and I'm looking for a "sitewide" variable in memory. Of course it can be handled in a database or in a file, but if possible I'd like to avoid those options.


Solution

  • For sitewide variables, I have done a few things.

    1. Use apache environment variables in httpd.conf
    2. Use memcachedand the PHP memcache libraries