Local php.ini not being read

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

Local php.ini not being read

Postby microdove » 10. March 2008 15:28

I have XAMPP 1.6.6 installed, and PHP is working fine. However, I have noticed that the php.ini file from apache/bin is being used.

from phpinfo():

Configuration File (php.ini) Path C:\WINDOWS
Loaded Configuration File C:\Java\xampp\apache\bin\php.ini

Note that C:\Java\xampp is where I have installed XAMPP.

I have a php.ini file in each folder on my web site, but the files are being ignored for some reason. My understanding is that php is supposed to look for php.ini in the local folder first, then what is defined in the PHPRC environment variable (which does not appear to be defined on my system) and then the directory specified at compile time, which would be c:\windows.

Doing a global search for \php.ini in the XAMPP directory, I see a few places where the apache\bin\php.ini is found:

xampp-control.exe
xampp-control-default.exe
phpswitch.php

From the looks of the code, the phpswitch application merely changes out the php.ini file in apache\bin.

So, I am thinking that the executable files are controlling where php.ini is being read from, and it looks like it might be hard coded. Can anyone confirm if this is true? If so, is there any kind of override?

Thanks,
John
microdove
 
Posts: 2
Joined: 10. March 2008 15:10
Location: Durham, NC USA

Postby sari42 » 10. March 2008 19:13

>I have a php.ini file in each folder on my web site
IIRC only php.exe uses those files (see php.net)
but you can configure your folders to behave individually by means of .htaccess files (you even don't have to restart the webserver if you make any changes - very handy in the testing phase) like so:
Code: Select all
#boolean values:
php_flag display_errors On
#strings, variables:
php_value error_reporting 6143
#...

(you have to "AllowOverride All" in httpd.conf)
sari42
 
Posts: 800
Joined: 27. November 2005 18:28

Postby Milligan » 10. March 2008 21:15

Last edited by Milligan on 17. July 2008 06:13, edited 1 time in total.
Milligan
 
Posts: 136
Joined: 03. March 2008 06:23

Thanks!

Postby microdove » 11. March 2008 01:26

I added the line:

Code: Select all
php_value auto_prepend_file "D:\Long Path Name\global-variables.php"


That fixed my original problem (have been doing that with php.ini).

Thanks!
John
microdove
 
Posts: 2
Joined: 10. March 2008 15:10
Location: Durham, NC USA

Postby colbyt » 11. March 2008 01:37

Milligan wrote:PHP is compiled as an apache module in xampp and so it is not possible to use a local php.ini file because the php.ini file is only read once when apache starts.

Use a .htaccess file instead.

This post by Izzy explains why.
http://community.apachefriends.org/f/viewtopi ... 490#115490



I am far from an expert on the subject but I think whether a local file is read or not depends on how the allow_overide is set in Apache.
colbyt
 
Posts: 10
Joined: 03. January 2008 16:41
XAMPP version: 8.1
Operating System: windows 10


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 110 guests