Directory Dependant php.ini

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Directory Dependant php.ini

Postby bigorangemachine » 14. July 2011 04:28

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?
bigorangemachine
 
Posts: 10
Joined: 14. July 2011 04:20
Operating System: Windows 7 64 Home Premium SP1

Re: Directory Dependant php.ini

Postby Sharley » 14. July 2011 06:47

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.
Last edited by Sharley on 14. July 2011 07:09, edited 4 times in total.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Directory Dependant php.ini

Postby bigorangemachine » 14. July 2011 06:50

Thanks! This explains why I couldn't find a clear answer!
bigorangemachine
 
Posts: 10
Joined: 14. July 2011 04:20
Operating System: Windows 7 64 Home Premium SP1

Re: Directory Dependant php.ini

Postby JonB » 14. July 2011 18:31

Ms. Sharley -

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

8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 84 guests