different php.ini same server

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
bluesman333
Forum Commoner
Posts: 52
Joined: Wed Dec 31, 2003 9:47 am

different php.ini same server

Post by bluesman333 »

Does anyone know how I can have a different php.ini file for different sites on the same server? I know it is possible but I can't find the right documentation on it.

I tried adding PHPIniDir to the VirtualHost directive but when I restarted Apache I got an error that the ini file was already loaded.

phpinfo suggests that the ini file is in C:\WINDOWS but it is not there.

I've removed the PHPRC Environment Variable and do not see any Registry Entries.
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Does adding PHPIniDir to htaccess work ?
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

moved to installation/configuration
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

When run as a module, there is only one php.ini used. If you run it as (Fast)CGI you can choose different php.ini files.
mentor
Forum Contributor
Posts: 100
Joined: Sun Mar 11, 2007 11:10 am
Location: Pakistan

Re: different php.ini same server

Post by mentor »

bluesman333 wrote:Does anyone know how I can have a different php.ini file for different sites on the same server?
If you need different .ini values for different sites then you can use .htacces for this. e.g. for one site you want to set upload file size limt 5 MB and for others 10MB. create a file with name ".htaccess" and put the below code for 5MB limit

php_value upload_max_filesize 5M
php_value post_max_size 5M

Similarly you can change other settings too.
User avatar
bluesman333
Forum Commoner
Posts: 52
Joined: Wed Dec 31, 2003 9:47 am

Re: different php.ini same server

Post by bluesman333 »

mentor wrote:
If you need different .ini values for different sites then you can use .htacces for this. e.g. for one site you want to set upload file size limt 5 MB and for others 10MB. create a file with name ".htaccess" and put the below code for 5MB limit

php_value upload_max_filesize 5M
php_value post_max_size 5M

Similarly you can change other settings too.
Thanks, I'll use that method.
Post Reply