Page 1 of 1

Directory Dependant php.ini

PostPosted: 14. July 2011 04:28
by bigorangemachine
Hello,
I tried to google this (as I usually have a lot of success) but I don't think I have the search words correct.

I cannot find out how to allow XAMPP to load local php.ini files without having to put an .htaccess file with the 'suPHP_ConfigPath' for each new directory I setup. When I make changes to my live sites I often change the .htaccess file and forget that it is different from the live sites thus creating 500 errors :(.

What I would like to do is simply just put a php.ini file in a directory (/xampp/htdocs/project_a1/ or /xampp/htdocs/blog/) which would allow the 'local' php.ini to change the default php.ini (the one found in the /xampp/php/ext/ directory).

I know my host does this so I assume its possible. Unless of course php 5.3 doesn't support this anymore?

Could someone point me in the right direction?

Re: Directory Dependant php.ini

PostPosted: 14. July 2011 06:47
by Sharley
bigorangemachine wrote:What I would like to do is simply just put a php.ini file in a directory
Not possible when using XAMPP.

PHP is compiled with Apache as a module not as a CGI (Common Gateway Interface) - the CGI method of compiling Apache and PHP is the method used by most hosting service providers.

When compiled as a module you have to restart Apache when ever you edit (change) the php.ini file as it is only read once when Apache starts.

Where as in the CGI compiled version you can use a php.ini file in any directory of a web site you use which means Apache will read the php.ini file every time it needs to in, real time.

So you will have to remain with using a .htaccess file which is read by Apache on every request from your web site directory.

Perhaps your keywords now for searching may be something similar to the following:
php as apache module versus php as a cgi
Most responses that refer to user/group are Linux server related and are not relevant in Windows based Apache servers.

Hope this helps clear up this issue for you.

Best wishes.

Re: Directory Dependant php.ini

PostPosted: 14. July 2011 06:50
by bigorangemachine
Thanks! This explains why I couldn't find a clear answer!

Re: Directory Dependant php.ini

PostPosted: 14. July 2011 18:31
by JonB
Ms. Sharley -

That was a very well-composed and easy to understand explanation.

8)