Re: ini files as config - hidden
| From: | Sancar Saran | Date: | Sat, 15 Aug 2009 18:39:30 +0000 |
| Subject: | Re: ini files as config - hidden | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-296819@lists.php.net to get a copy of this message | ||
On Friday 14 August 2009 08:31:46 pm דניאל דנון wrote:
> I'm building a little framework for my self,
>
> The configuration of the framework is done in an ini file,
>
> How do you suggest to hide its contents?
>
> .htaccess wont be good (or atleast only htaccess) since if its turned
> off....
>
> The file contains mysql password and important data.
>
>
> How should I make sure the file stays hidden from someone who might tries
> to access it?
Hello there,
1-) You have to parse ini file in each execution. It was negative for
performance. I suggest use plain php array
2-) To hide your config put it in out of html document root.
define('ROOTDIR', dirname(__FILE__).'/');
define("CONFDIR",ROOTDIR.'../config/');
require(CONFDIR.'config.php');
Regards