Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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 webhostingtalk.com/archive/index.php/t-936622.html –  Owen Sep 19 '12 at 17:14
1  
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! 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

Your Answer

 
discard

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.