News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Brian Moon's Blog:
Using ini files for PHP application settings
January 20, 2010 @ 10:40:39

In a new post to his blog Brian Moon looks at a handy piece of functionality that comes with the default PHP installations (and is used by several major frameworks like this one) - using INI files to store settings for an application.

One of the challenges of this [three tier server setup] is where and how to store the connection information for all these services. We have done several things in the past. The most common thing is to store this information in a PHP file. [...] We have taken [it] one step further using some PHP ini trickeration. We use ini files that are loaded at PHP's startup and therefore the information is kept in PHP's memory at all times.

They use the get_cfg_var function and the "--with-config-file-scan-dir" option to tell PHP to automatically load in the ini files it finds in the named directory. He gives an example of both a simple configuration and a more complex situation where a MySQL instance can read from the ini file containing the username/password/host information.

0 comments voice your opinion now!
ini file setting getcfgvar tutorial


blog comments powered by Disqus

Similar Posts

PHPMaster.com: Packaging Your Apps with Phar

Zend Developer Zone: Why Should I Care What Server My Application is Running On?

PHPMaster.com: An Introduction to Dependency Injection, Service Locators & Factories (Part 1)

RandomBugs.com: Apache Dynamic Virtual Hosting and PHP security

Carson McDonald's Blog: PHP MySQLi and Multiple Prepared Statements


Community Events





Don't see your event here?
Let us know!


development release deployment language framework list tips series code laravel developer threedevsandamaybe podcast application community interview api conference zendserver introduction

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework