ini files & application scope variables

General discussions related to php

Moderators: macek, egami, gesf

mjr
New php-forum User
New php-forum User
Posts: 18
Joined: Fri Sep 27, 2002 6:35 am
Contact:

Re: ini files & application scope variables

Postby mjr » Fri Oct 18, 2002 10:37 am

chill wrote: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: Select all

<?
$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

User avatar
WiZARD
Moderator
Moderator
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Re: ini files & application scope variables

Postby WiZARD » Sat Oct 19, 2002 12:28 am

chill wrote: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


Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 0 guests