[thelist] Improving my PHP: autoread config files?

Brady Mitchell mydarb at gmail.com
Tue Jun 30 09:50:28 CDT 2009


Barney Carroll wrote:
> Hi list,
>
> I'm embarking on a new PHP project and wanted to sound people out for
> something I am certain exists but have difficulty defining or searching for.
> Essentially I am looking for a method to apply PHP instructions based on
> directory in much the same way .htaccess applies to all descendants. I know
> it is possible to define core values read out by PHP globals using plain old
> .htaccess, but I would like to define custom variables, prepend PHP includes
> to files depending on various factors, etc — without having to make explicit
> reference to this configuration file in the files I wish to be affected, or
> vice-versa.
>
> Can anybody give me some pointers on how to go about this?
>    

Take a look at:

http://us.php.net/manual/en/ini.core.php#ini.auto-prepend-file

" Specifies the name of a file that is automatically parsed before the 
main file. The file is included as if it was called with the require() 
function, so include_path is used.

The special value none disables auto-prepending."

This can be set in php.ini or .htaccess.

Brady



More information about the thelist mailing list