Re: 'application' variables not available? Alternatives?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks very much for that Vidyet. This is going to be a massive help.


"Vidyut Luther" <vidluther@xxxxxxxxx> wrote in message 
news:46E1F5B5.60102@xxxxxxxxxxxx
> Hi David,
> I'd say your best bet is to use memcached. This will allow the
> variables you specified to stay in memory, and be accessible to all
> other applications.
>
> http://www.danga.com/memcached/
>
> Keep in mind though, just because ASP does it in one way, you don't want
> to do a bit for bit copy. You could also look into options like the
> auto_prepend feature in php.ini, and the define() function.
>
> http://us2.php.net/define
>
> I personally don't like using the auto_prepend feature, but it's there
> and you could use it if you like, I'm a fan of implicitly requiring
> files if I need to.
>
> If your associative array, is really that large that it's going to slow
> things down, you may also want to consider whether all your scripts need
> all of the data, and then possibly define things that are only necessary
> for certain classes, in the file for that class.
>
> You can also serialize your associative array, and store it in the
> database.. but it's really all dependant on what you need, and what the
> app needs.
>
>
>
> david wrote:
>> Hi
>>
>> I am looking at converting a large project from ASP to PHP, and have read
>> that there is no equivalent of global.asa in PHP. It is probably easiest 
>> if
>> I describe the problem starting with how the ASP does it:
>>
>> Project uses global.asa to load a lot of 'global' constants and variables
>> into memory. This includes translations for the web site in a number of
>> different languages. These are loaded from text files so that changing 
>> them
>> is easy. These items when loaded in global.asa are as if they are in an
>> associative array which is available to the whole application - it is not
>> destroyed when the page is destroyed!
>>
>> Any ideas how I could handle this in PHP? The ASP method seems sensible, 
>> as
>> the data is much too big to load for every page, and too common to load 
>> only
>> when required. Holding it in memory and it having application wide scope
>> like this is fast. Loading only parts required at execution from, say, a
>> database would surely be too costly in db calls?
>>
>> Anyone have any ideas about what I could do?
>>
>> Many thanks, David
>>
>> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux