Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 am using the php config auto-append-file to append code that i need to be executed on all pages on a particular domain.

But my problem is that there are other domains that share the same php.ini file so i wanted to know if there is a way to specify that for a particular domain.

I have tried setting the config with ini_set() but the change was not made and phpinfo() confirmed that this failed.

I also tried doing that via php_value inside a .htaccess file but that returned a 505 internal server error and i have no clue why.

Any thoughts on how i could accomplish this ?

Thanks in advance

PS: I mainly want to append the file on all domains hosted, except one. So what i thought is set it via php.ini and then reset it for the domain where i don't want that since it will be a lot faster.

share|improve this question
up vote 2 down vote accepted

If you are using a loader other than an Apache DSO, then you cannot use .htaccess PHP directives as the server does not understand them, thus the 500 error. For most loaders (CGI, SuPHP, etc.) you are allowed to use a per-directory php.ini (or .user.ini in newer PHP versions). You can override any PHP setting inside of this file, including the value for auto-append-file.

share|improve this answer
i see, i am running a CGI loader.. and so an ini file in lets say the root of the folder of a domain would apply to all subfolders right? – Dany Khalife Aug 14 '12 at 4:39
Actually a php.ini file only applies to the directory in which it is contained. – Garrett Aug 14 '12 at 5:47
ok many thanks for your help ! – Dany Khalife Aug 14 '12 at 18:17

It would appear that .htaccess is on the right path. I found this article explaining how to do what you are looking for with RewriteRule. Link is here .

share|improve this answer

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.