If you install PHP as a CGI exe rather than as a server module, you can
pick up a php.ini file from the same folder as the script you wish to run.
HTH,
Richard
==========================================
Richard Black
Senior Developer, DataVisibility Ltd - http://www.datavisibility.com
Tel: 0141 951 8008
Email: rblack@datavisibility.co.uk
Herbert Grunwald
<hgrunw@gmail.com To: internals@lists.php.net
> cc:
Subject: [PHP-DEV] php.ini
04/05/2005 11:15
Please respond to
Herbert Grunwald
I'm running both PHP4 and PHP5 in two different virtual directories in IIS.
(That means that different virtual dirs use different ISAPI .dll-s for
.php files.)
Everything works fine, except php.ini -- it is obvious that I can't
use a shared php.ini. But there seems to be no way of specifying
different .ini-s for the separate ISAPI dll-s. The .ini that lies in
the same dir as the .dll won't be used.
Currently I'm running with the defaults, with no .ini specified :(
Please consider adding the .dll load path to the .ini search path (I
doubt if it's possible) or propose something to overcome the problem
(PHP4RC and PHP5RC instead of PHPRC would do the trick, but a generic
solution should be preferred as people may want to run PHP4 with
different configurations in a single IIS also).
Very few people will want to run PHP as a CGI executable.
And I am not among the few who do ;).
If you install PHP as a CGI exe rather than as a server module, you can
pick up a php.ini file from the same folder as the script you wish to run.
I propose the following trivial patches to PHP5 to resolve the problem.
- Registry based fix:
diff -Nurp win32.orig\registry.c win32\registry.c
--- win32.orig\registry.c Mon Mar 14 18:12:56 2005
+++ win32\registry.c Thu May 05 13:47:40 2005
@@ -1,7 +1,7 @@
#include "php.h"
#include "php_ini.h"
-#define PHP_REGISTRY_KEY "SOFTWARE\PHP"
+#define PHP_REGISTRY_KEY "SOFTWARE\PHP5"
void UpdateIniFromRegistry(char *path TSRMLS_DC)
{
- PHPRC / PHP5RC env. variable
diff -Nurp main.orig\php_ini.c main\php_ini.c
--- main.orig\php_ini.c Fri Sep 17 08:18:48 2004
+++ main\php_ini.c Thu May 05 13:56:32 2005
@@ -290,9 +290,11 @@ int php_init_config()
safe_mode_state = PG(safe_mode);
open_basedir = PG(open_basedir);
- env_location = getenv("PHPRC");
- env_location = getenv("PHP5RC");
if (!env_location) {
-
env_location = "";
-
env_location = getenv("PHPRC");
-
if (!env_location)
-
}env_location = "";
if (sapi_module.php_ini_path_override) {
php_ini_search_path = sapi_module.php_ini_path_override;