You are here: Re: Mantain a variable through several scripts like global.asa variables in asp « PHP Programming Language « IT news, forums, messages
Re: Mantain a variable through several scripts like global.asa variables in asp

Posted by Erwin Moller on 12/27/05 14:24

Zeppelin wrote:

> Hi,
>
> I have to port from asp a script that adds an ip to a list in plain
> text or an array. I need not using a database or filesystem, it has to
> be stored in memory in order that giving us best performance (it should
> be accessed continuously).

Hi,

The easiest way is just including a file at top of your scripts.
Into that file you define some constants or variables.


>
> I've tried defining $_ENV vars, using apache_setenv(..), creating a
> class with a static var... but nothing results.

Don't.
:-)

Just include a file.

>
> In asp the script writes an reads an Application variable defined in
> global.asa... is it impossible to port? isn't it a very big error of
> php?

No, this isn't a big error.

If you worry about performance, don't.
Files that are accessed a lot of time will be placed in cache (memory) if
possible by the OS.
Thus no performancepenalty.

On a sidenote: I don't understand why so many people worry about performance
when they do not have a performanceproblem.
My guess is that over 90% of all performanceproblems are databaserelated
(bad queries, no indexing, etc) and not scriptinglanguage related.

If you absolutely want to use shared memory in PHP, that is possible.
I do n't remember the name of the package, but if you look around I am sure
you will find it.
My advise is however: Just include a file.

Regards,
Erwin Moller

>
> thanks

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация