At work we use a .ini file to set variables prior to calling the rest of the framework (I think it goes
function getConfigVars(){
//read my_config.ini file
....
//call framework
}
and I have always wondered if there was a benefit to doing it that way.
It seems to me that you then have to write access rules to stop people from looking at it from the web and php has to parse it and understand it.
So, why use my_config.ini rather than my_config.php? It is not like anyone should be touching it after it is set up and it seems more convenient to just call the variables and be able to have your IDE auto complete the text wherever you are using the ini variables / parse it for errors.
The Zend Framework contains a config parses that parses files that are written in the ini format (Zend_Config_Ini), it sounds like this is what you are using.
The config file should not be located in your document root, and if it is not in your document root then no re-write rules are required since no-one can access it anyway.
From Zend_Config_Ini page.
The Zend Framework uses it to allow you to have multiple configuration parameters, one for staging, one for development and one for production. This also allows for easy setting database settings for production, and for development and having two very different settings. Different paths set up in the ini file to where includes are located. This makes it much easier to move code from development to production knowing that immediately everything that is development will be turned off.
Sure, this would be possible with a PHP script, but it would require more parsing of the various configuration variables as well as doing if/then checks, whereas using the parse_ini_file() does all of this for you automatically.
The other answers also already pointed out that non-programmers may need to change variables and or something on the website that is set as a configuration variable (for example, site title that is used in the sites layout). INI files are easy to understand and read even for someone that has never programmed before.
Example from a website I am currently working on:
It makes it extremely easy to have multiple data sets for the various environments in which the code can be run.