Hot to setup different phprcs for each domain/subdomain


I have been able to set up a phprc under the account root.
Note that I am using a php5.3 in a shared hosting account.

I would like to know if it is possible to setup different phprc for each domain or subdomain.

my setup is this:

/home/user/.php/5.3/phprc : for the user root

Is it possible to setup the following?

/home/user/sampledomain/.php/5.3/phprc :: different settings than root
/home/user/sampleSUBdomain/.php/5.3/phprc :: different settings than root

I have tried but did not work. I did kill the process to reset the settings but did not work.

Do I need to set up a separate php.ini for each domain/subdomain?

Any help would be great.


Are you looking to have different variables for each domain, or having the same for all the domains? If so, I’d recommend looking at this:

That will show you how to make a custom php.ini for a cgi-bin in your user’s home directory, which will affect everything under that user.

You can also look at setting up a custom php.ini for each domain, to have different variables here:

Hope that helps you out.


Thanks for the reply and links. I had followed them and could not get my setup to work right. I did run into issues with .htaccess and the php.ini file.

Initially, after following the wiki directions I noticed that my setup would revert back to php 5.2 as reported by phpinfo(). So I changed the script wrapper from this: exec /dh/cgi-system/php[color=#FF0000]5[/color].cgi $*
to this: exec /dh/cgi-system/php[color=#32CD32]53[/color].cgi $*

After this change I was able to see the right php version with phpinfo().

Also, I was able to make changes with the php.ini file I copied following the wiki instructions. However, some of the exetensions were not enabled, such as SOAP.

I was not able to get it to work right. therefore I’m reverting to the original configuration with a global phprc file for all sites until I figuire this out.



Move the (sub)domain you want to load over into it’s own userspace and use the default .phprc method.