4

Does anybody know how to setup wampserver on localhost to scan a php.ini file in the root directory?

I can do this on my remote server with NO problem, it just works. But I can't seem to figure out how to get localhost to behave the same way.

EDIT (again): I have three different websites in different stages of development on my localhost. I would like to place a php.ini file in the root directory of a specific website, and have those changes affect that website. On my remote server, it works as expected. But on wampserver, i can not get it to work. Wamp will not read the php.ini file in the root directory, or anywhere else I put it.

QUESTION: Why would wamp not scan all folders in the tree for php.ini files? I thought that was standard, unless set otherwise.

user137971
  • 43
  • 4

3 Answers3

0

Try this tutorials

php.ini include_path

http://www.howtoforge.com/how-to-set-up-apache2-with-mod_fcgid-and-php5-on-debian-etch-p2

Setting custom path to php.ini (not in Apache)

this will help you out

Community
  • 1
  • 1
Yogesh Suthar
  • 30,424
  • 18
  • 72
  • 100
0

As of http://php.net/manual/en/configuration.file.per-user.php :

.user.ini files

Since PHP 5.3.0, PHP includes support for .htaccess-style INI files on a per-directory basis. These files are processed only by the CGI/FastCGI SAPI. This functionality obsoletes the PECL htscanner extension. If you are using Apache, use .htaccess files for the same effect.

In addition to the main php.ini file, PHP scans for INI files in each directory, starting with the directory of the requested PHP file, and working its way up to the current document root (as set in $_SERVER['DOCUMENT_ROOT']). In case the PHP file is outside the document root, only its directory is scanned.

Only INI settings with the modes PHP_INI_PERDIR and PHP_INI_USER will be recognized in .user.ini-style INI files.

Two new INI directives, user_ini.filename and user_ini.cache_ttl control the use of user INI files.

user_ini.filename sets the name of the file PHP looks for in each directory; if set to an empty string, PHP doesn't scan at all. The default is .user.ini.

user_ini.cache_ttl controls how often user INI files are re-read. The default is 300 seconds (5 minutes).

rkosegi
  • 14,165
  • 5
  • 50
  • 83
  • YES, this is the right direction. However, I have happened on to a second possible solution: http://us3.php.net/manual/en/ini.sections.php – user137971 Sep 22 '12 at 06:01
  • @user137971 so you figure it out by yourself? then you may consider update question and post your own answer as well. – rkosegi Sep 22 '12 at 06:03
  • I have not come up with an efficient, universal work around to this seemingly 'personal' problem of getting my local host to behave like my remote host. As of now, I have not figured this out. I WILL post an answer... – user137971 Sep 22 '12 at 06:11
0

There are two possibilities possible (Maybe a third, but I don't really care right now). Each with it's own disadvantages. At least for my purpose.
1) As answered by "rkosegi" .user.ini files: http://php.net/manual/en/configuration.file.per-user.php
2) ini.sections: http://us3.php.net/manual/en/ini.sections.php

My solution is to reset AND/OR update the wampserver php.ini as needed per website under development.

user137971
  • 43
  • 4