Per-server PHP config override

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I'm using Apache webserver 1.3.27 and PHP 4.3.0. On my development machine,  
I have created several virtual hosts. AFAIK PHP configuration is stored in  
php.ini. I want some of the virtual hosts override some of PHP  
configuration, while the rest retain the configuration in the php.ini. How  
can I achieve this? I'm thinking a similar approach like Apache's  
httpd.conf and .htaccess, but how to do it with PHP.

Furthermore, one of my project involves multiple subdomains, each  
implemented by way of virtual hosts. Say a domain have several  
subdomains (,, etc), and I have other  
domains configured in my machine, like and Also  
say that default php.ini is the default config for all domains in my  
machine. How can I make a configuration override applicable only from and it's subdomains, but not applicable to other domains  
( and uses the default php.ini entirely).

Oh, BTW, the machine is running on WinXP sp1a.


Re: Per-server PHP config override

Ricky Romaya wrote:
Quoted text here. Click to load it

You can put PHP settings in the .htaccess, depending on your Apache  
configuration, example:

php_flag allow_call_time_pass_reference off

PHP: How to change configuration settings - Manual

Take care,


Re: Per-server PHP config override

Jonathan N. Little wrote:
Quoted text here. Click to load it

You can also use the php_* directives in the virtual host config
(<VirtualHost> tags), though this requires a restart of apache for the
changes to take effect, unlike .htaccess

Re: Per-server PHP config override

Quoted text here. Click to load it
Yes, I have read about it also, but I want to keep PHP configs seperated  
with Apache (.htaccess).

On at least one hosting I have used before, they have an option to "Create  
your own PHP.ini", which indicates a capability of having a php.ini per  
domain basis. Sadly, they won't tell me how it could be done. This is what  
I'm aimimg for.


Site Timeline