How secure is storing DB variables with SetEnv or in php.ini? -


i don't storing sitewide crypto keys , db access information under document_root, using apache's setenv , php.ini files under conf.d separate these codebase. big question is, 1 better? inside environment variables under apache vhost files (setenv sitekey 'oinkoink!') or inside conf.d/xxx.ini files (db_pass="oink?")? maybe else?

pros n cons:

setenv:

+stored outside document_root
+only given vhost has access
-visible phpinfo() - hacker needs direct access/upload exploit files

get_cfg_var:

+stored outside document_root
+not visible phpinfo()
-(very bad) defined ini variables included, each vhost can query them via (ini_get_all), not usable in shared vhost environment

as long *.ini , setenv outside of web root (document root) doesn't matter either way. choose whichever prefer. setenv, it's personal preference. makes more sense me use setenv since variables put _server. .ini, think makes more sense leave initialization settings specific how code works.

not storing under document root idea prevent access possibly secure data.

note phpinfo() list server variables set, careful that.

finally, if including files, make sure don't allow gratuitous ../../ set user somehow or have access potentially secure files (even including /etc/passwd!)

i think main question "how secure." well, secure can without causing major headaches. php code has access these variables, if print them out visible, depends on how secure code base is. might possible use ldap mysql, sounds huge pain.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -