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

This is a question about PHP configuration on a LAMP server.

I want to turn off allow_url_fopen on one virtual host but not the other (i.e. can't turn it off globally in php.ini). The other day I had the same requirement but with register_globals and it was easy, I just added the following to the .htaccess file in the DOCUMENT_ROOT of the virtual host:

php_flag register_globals 0

But the same doesn't seem to work for allow_url_fopen. If I add

php_flag allow_url_fopen 0

to my .htaccess nothing happens phpinfo() shows local value On, global value On.

What am I doing wrong?

PS: I restarted Apache after modifying the .htaccess file.

share|improve this question
up vote 1 down vote accepted

There are flags that are PHP_INI_SYSTEM. That means you can change their value only in php.ini.

Hope that helps you.


share|improve this answer
Thank you - You're right. Looking at I can see the allow_url_fopen option is marked as "PHP_INI_SYSTEM" for my version of PHP which means I can't change it in a .htaccess file, only the php.ini. – Tom Oct 27 '09 at 12:16

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.