Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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.

share|improve this answer
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 – Owen Sep 19 '12 at 17:14
interesting. 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! 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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.