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 want a single specific vhost in my Apache configuration to override auto_prepend PHP configuration directive and always include a PHP file, without other sites including it.

One option is to use SetEnv in Apache and getenv in PHP with auto_prepend set in php.ini

share|improve this question

migrated from Oct 20 '12 at 1:11

This question came from our site for professional and enthusiast programmers.

depending on your config. u should be able to put a php.ini file in your vhost directory? – j_mcnally Oct 19 '12 at 16:48
up vote 1 down vote accepted

Untested, but I'd try adding

php_value auto_prepend_file /your/path/here.php

to your vhost config. According to the PHP docs, this method only works if PHP is run as an Apache module.

share|improve this answer
Accepted because it just worked! Thanks – usr-local-ΕΨΗΕΛΩΝ Oct 19 '12 at 18:26

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.