For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > August 2004 > Can someone please point me to a valid example of how to use the Config pkg?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Can someone please point me to a valid example of how to use the Config pkg?
Kushmit Indurain

2004-08-24, 11:04 pm

Hi-

I would like to leverage the capabilities of the
Config package to edit some config.inc.php file
programmatically. I would like to use the Config
package rather than PHPs parse_ini_file because I want
to be able to insert, update, and delete
configuration data. This is a standard type of PHP
config file that is very widely used. Format is
straightforward ike this:

// comment comment
$var1 = "blah";
$var2 = "blahblah";
$var3 = "blahblahblah";

All of us have seen this type of file before.

But I have hit a roadblock because the documentation
on the PEAR site for the Config package is very
unclear. Many of the examples seem not to be up to
date and are inconsistent with one another. The
tutorial on devshed that is suggested as a good
starting point seems to be several years old and the
examples there no longer match what is on the PEAR
site (in terms of objects, methods, etc.)

I have tried to implement just a rudimentary example
using parseConfig, and I am getting the following
error:

"File 'config.inc.php' does not contain a required
'conf' array"

Yet nowhere (that I could see) is it explained what a
"conf array" is. In fact, there is no explanation for
what types of parameters are even acceptable to pass
to parseConfig. You can see what I mean here
(http://pear.php.net/manual/en/packa...parseconfig.php)

Is there a practical example anywhere or an up-to-date
tutorial that someone could point me toward?

Any assistance appreciated. Thanks.

-Kush

P.S.- I searched through the mail archives and found
quite a few people asking this same question, but I
didn't see any definitive explanation, although one
person (I think on the PEAR dev team) suggested
hacking out a solution in PHP instead of using the
Config package, so I would really appreciate it if
someone could let me know if the Config package is
simply buggy and should be avoided so I do not keep
beating my head against a wall here :)
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com