As long as * .ini and SetEnv are outside the root of the website (document root), this does not matter in any case. Just choose what you prefer. I like SetEnv, but it's really a personal preference. It makes sense to me to use SetEnv, since variables are placed in _SERVER . With .ini, I think it makes sense to leave it to the initialization settings specific to the code.
Not storing the document at the root is a good idea to prevent access to possibly protected data.
Note that phpinfo() will display all set server variables, so be very careful.
Finally, if you include files, make sure that you do not allow the free ../../ installed by the user, or that they will have access to potentially protected files (even including /etc/passwd !)
I think your main question is "How safe." Well, it is probably as safe as you, without serious headaches. PHP code has access to these variables, so if you print them, they are easily visible, so it depends on how secure your code base is. You might be able to use LDAP with MySQL, but that sounds like a huge pain.
Explosion pills
source share