ini files & application scope variables

G

Guest

Guest
Hi,

I'd like to know what is the best/good way to deal with custom ini files? So far I used parse_ini_file() but the problem is the data in the ini file is always the same – there is no point of reading it again and again.

For example - I have my custom error handler that has such ini configuration file. Do I have to read this ini file always when error occurs?

Or let me put it in other words... is there a global.asa analogue in PHP? or application scope variables?

Or consider this: I have a translation file for my website. I don’t want to read the translation all the time (with every request). I'd like to read them once.

How should I do this?

Many thanks,
 
chill said:
Hi,

I'd like to know what is the best/good way to deal with custom ini files? So far I used parse_ini_file() but the problem is the data in the ini file is always the same – there is no point of reading it again and again.

For example - I have my custom error handler that has such ini configuration file. Do I have to read this ini file always when error occurs?

Or let me put it in other words... is there a global.asa analogue in PHP? or application scope variables?

Or consider this: I have a translation file for my website. I don’t want to read the translation all the time (with every request). I'd like to read them once.

How should I do this?

Many thanks,


frankly speaking, as far as i work with php, ithe best way to create php ini files is creating php inlude files like
Code:
<?
$dbHost='localhost';
$dbName='db_my_db';
$dbUserName='user;
$dbPasswd='asdjhsdlf';
?>
this fales are easily edited by users and do not cost much processor time to your scripts
 
chill said:
Or consider this: I have a translation file for my website. I don’t want to read the translation all the time (with every request). I'd like to read them once.

How should I do this?

Many thanks,

You can read about include_once and require_once in manual of PHP
 
Back
Top