From: Zeev Suraski [mailto:[EMAIL PROTECTED]] > > At 23:11 01/05/2002, Shane Caraveo wrote: > >That would only solve that particular situation, what about multiple > >installations of the same version, or seperate configurations for the same > >installation? > > We can have PHP look for php.ini in the directory where php.exe is > located. This would allow you to easily configure different INI settings > for different versions. > That's kind of what I wanted to do years ago, but ended up making it look > for php.ini in the CWD, which is not all that helpful.
Posted this earlier, but in case it got lost this is the patch to load php.ini from the current module's directory. If we're running php.exe then php.ini will first be looked for in the same directory. If php4ts.dll was loaded by another executable then the php.ini file is looked for first in the same directory as that executable. The net result is very similar to Unix, in that php.ini is loaded from the same directory as the PHP executable. This is a good thing :). Index: main/php_ini.c =================================================================== RCS file: /repository/php4/main/php_ini.c,v retrieving revision 1.85 diff -u -b -r1.85 php_ini.c --- main/php_ini.c 19 Apr 2002 05:48:22 -0000 1.85 +++ main/php_ini.c 1 May 2002 20:35:06 -0000 @@ -226,19 +226,19 @@ php_ini_search_path = php_ini_path_override; free_ini_search_path = 0; } else { - char *default_location; - int free_default_location; - #ifdef PHP_WIN32 - default_location = (char *) emalloc(512); + char sSearchPath[1024]; + char *default_location = sSearchPath; - if (!GetWindowsDirectory(default_location, 255)) { - default_location[0]=0; - } - free_default_location=1; + /* Look in the same directory as the executable. */ + GetModuleFileName(0,sSearchPath,sizeof(sSearchPath)) || (sSearchPath[0] = 0); + { char* p = strrchr(sSearchPath,'\\'); if (p) *++p = 0; } + + /* Add the Windows base directory as well. */ + strncat(sSearchPath,";",sizeof(sSearchPath)); + { int n = strlen(sSearchPath); +GetWindowsDirectory(sSearchPath+n,sizeof(sSearchPath)-n); } #else - default_location = PHP_CONFIG_FILE_PATH; - free_default_location=0; + char *default_location = PHP_CONFIG_FILE_PATH; #endif php_ini_search_path = (char *) emalloc(sizeof(".")+strlen(env_location)+strlen(default_location)+2+1); free_ini_search_path = 1; @@ -255,9 +255,6 @@ sprintf(php_ini_search_path, ".%c%s", ZEND_PATHS_SEPARATOR, default_location); } } - if (free_default_location) { - efree(default_location); - } } PG(safe_mode) = 0; -- Preston L. Bannister http://members.cox.net/preston.bannister/ pbannister on Yahoo Messenger -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php