I heard somewhere that, if you place a php.ini in a website root or subdirectory it will basically use default settings for everything that is not included in this php.ini file. So if you have changed any default in your main php.ini file (highly likely) then your changes will be ignored if you put a php.ini file in web root or below it. Can anyone confirm this?
Asked
Active
Viewed 1,784 times
2 Answers
0
If you put a php.ini file in your web directory it can override the default values set in your sever level php.ini but only the values that are set in the local php.ini. Not set them all to default and just change the ones listed.

Nate
- 196
- 2
-
That's what I thought but I thought I read somewhere that it acts differently. Perhaps it depends on whether it's an apache module or CGI? – Owen Sep 19 '12 at 16:04
-
Had not heard that, about resetting all the values and only overriding the one. Remember where you saw it? – Nate Sep 19 '12 at 16:10
-
It might just be on installations using suPHP. I found this http://www.webhostingtalk.com/archive/index.php/t-936622.html – Owen Sep 19 '12 at 17:14
-
1interesting. Apparently using suPHP it used the ini it finds as the ONLY php.ini file for the server. So since the custom one may only have 1 or 2 values in it, the rest get set to default! http://www.webhostingtalk.com/showthread.php?t=883152 So if you want to disallow it, you point it to your custom php.ini with all the values set, and it should be ok. A bit odd, but ok. – Nate Sep 19 '12 at 17:22
-
That's weird. Surely there's no way you'd want to allow custom ini files in a shared hosting setup. But I thought the purpose of suPHP was running PHP processes as individual user rather than nobody user - ie, a more secure shared environment. – Owen Sep 19 '12 at 18:50
-1
yes, It overrides the default functions of the site. we have to keep the php.ini file in the root of the site. With the
disable_functions=

Santosh Reddy
- 1
- 2