configuration
| From: | (Stig Sæther Bakken) | Date: | Tue, 22 May 2001 08:45:59 +0000 |
| Subject: | configuration | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-434@lists.php.net to get a copy of this message | ||
Hi,
Different code bases have different ways of configuring their
classes/applications/whatever. PHPDoc has hardcoded path names in its
index.php file for example, while others have a ascii text config
file, some have a PHP script setting global variables, constants or
whatever.
I think it's time to find a standard way of giving applications
parameters without having to modify library code. To start with, I
suggest having a "pear_config = /path/to/pear.ini" directive in php.ini
(that can also be set in .htaccess files) that points people to a
configuration file, and partition this file with the same name space
as we use in PEAR itself. Example pear.ini file:
[PEAR_Installer]
docdir = "/usr/share/doc/pear"
extdir = "/usr/lib/php/20001222"
phpdir = "/usr/share/php/pear"
[XML_RPC]
http_proxy = "http://mydomain.com:3128/"
...and so on.
To access the configuration we can either use ini_get() or make a new
set of pear_ini_* functions.
(I don't remember if PHP's ini parser can use the sections for
namespacing, if not it'll be "Net_Socket.http_proxy" etc.) Cascading
configuration like this would be very useful too, but it should be
optional for high-traffic sites.
Opinions?
- Stig
--
Stig Sæther Bakken <ssb@fast.no>
Fast Search & Transfer ASA, Trondheim, Norway