[PHP-DEV] Best/Proper way to process an extension-specific configuration (ini) file.

2009-02-13 Thread David M. Patterson
I am writing an extension that requires its own configuration file.

I would prefer to not re-invent the parse a config file wheel and so, have
been trying to use zend_parse_ini_file() function. Unfortunately, I have
been unable to make this work, so far.

If someone would either provide a code snippet for this or point me to one,
I'd really appreciate it.

 

Thanks,

 

Dave

 



Re: [PHP-DEV] Best/Proper way to process an extension-specific configuration (ini) file.

2009-02-13 Thread Mikko Koppanen
On Fri, Feb 13, 2009 at 7:31 PM, David M. Patterson 
dpatter...@dplhenterprises.com wrote:

 I am writing an extension that requires its own configuration file.

 I would prefer to not re-invent the parse a config file wheel and so, have
 been trying to use zend_parse_ini_file() function. Unfortunately, I have
 been unable to make this work, so far.

 If someone would either provide a code snippet for this or point me to one,
 I'd really appreciate it.


The normal way is to use PHP ini-entries. You can find examples in just
about every extension out there. Are you sure you need a separate
configuration file for your extension?


-- 
Mikko Koppanen


RE: [PHP-DEV] Best/Proper way to process an extension-specific configuration (ini) file.

2009-02-13 Thread David M. Patterson

On Fri, Feb 13, 2009 at 7:31 PM, David M. Patterson 
dpatter...@dplhenterprises.com wrote:


 The normal way is to use PHP ini-entries. You can find examples in just
 about every extension out there. Are you sure you need a separate
 configuration file for your extension?

Unfortunately, standard php.ini entries won't suffice in this case.
The extension's config file will contain indeterminate keys and the normal
php.ini processing requires that all keys be known at compile time (as far
as I can tell).




-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Best/Proper way to process an extension-specific configuration (ini) file.

2009-02-13 Thread Pierre Joye
hi,

On Fri, Feb 13, 2009 at 11:01 PM, David M. Patterson
dpatter...@dplhenterprises.com wrote:

 On Fri, Feb 13, 2009 at 7:31 PM, David M. Patterson 
 Unfortunately, standard php.ini entries won't suffice in this case.
 The extension's config file will contain indeterminate keys and the normal
 php.ini processing requires that all keys be known at compile time (as far
 as I can tell).

You can use the ini parser function or its internal equivalent. An
example can be found in pecl/hidef
(http://cvs.php.net/viewvc.cgi/pecl/hidef/), it is an extension
defining custom constants at init time, like core constants.

Cheers,
-- 
Pierre

http://blog.thepimp.net | http://www.libgd.org

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php