]> granicus.if.org Git - php/commitdiff
Fix a problem resolving the php.ini path under win32 terminal services environment.
authorWez Furlong <wez@php.net>
Sat, 6 Dec 2003 16:04:34 +0000 (16:04 +0000)
committerWez Furlong <wez@php.net>
Sat, 6 Dec 2003 16:04:34 +0000 (16:04 +0000)
Remove config-file-path option from configure under win32; it is not used except to display what might have been chosen, so lets default to the getenv() thingy.

ext/standard/config.w32
main/php_ini.c
win32/build/config.w32.h.in

index 9658ed6aebd6cc7c536c1fad35e8c202f158877f..d587dedcc60dc9f30f9f7416d3d7556d6eb81001 100644 (file)
@@ -4,15 +4,6 @@
 ARG_WITH("config-file-scan-dir", "Dir to check for additional php ini files", "");
 AC_DEFINE("PHP_CONFIG_FILE_SCAN_DIR", PHP_CONFIG_FILE_SCAN_DIR);
 
-ARG_WITH("config-file-path", "Where to find php.ini",
-       '(getenv("SystemRoot"))?getenv("SystemRoot"):""');
-
-if (PHP_CONFIG_FILE_PATH == null) {
-       AC_DEFINE("PHP_CONFIG_FILE_PATH", PHP_CONFIG_FILE_PATH, null, false);
-} else {
-       AC_DEFINE("PHP_CONFIG_FILE_PATH", PHP_CONFIG_FILE_PATH);
-}
-
 EXTENSION("standard", "array.c base64.c basic_functions.c browscap.c \
        crc32.c crypt.c cyr_convert.c datetime.c dir.c dl.c dns.c exec.c \
        file.c filestat.c formatted_print.c fsock.c head.c html.c image.c \
index f4d2d9a0f1254ebb53b5816fccd9f4676e1bc4cf..59d5ce705331b8760e47dce7a20a819e81176542 100644 (file)
@@ -379,6 +379,32 @@ int php_init_config()
                        strcat(php_ini_search_path, default_location);
                }
                efree(default_location);
+
+               {
+                       /* For people running under terminal services, GetWindowsDirectory will
+                        * return their personal Windows directory, so lets add the system
+                        * windows directory too */
+                       typedef UINT (WINAPI *get_system_windows_directory_func)(char *buffer, UINT size);
+                       static get_system_windows_directory_func get_system_windows_directory = NULL;
+                       HMODULE kern;
+
+                       if (get_system_windows_directory == NULL) {
+                               kern = LoadLibrary("kernel32.dll");
+                               if (kern) {
+                                       get_system_windows_directory = (get_system_windows_directory_func)GetProcAddress(kern, "GetSystemWindowsDirectoryA");
+                               }
+                       }
+                       if (get_system_windows_directory != NULL) {
+                               default_location = (char *) emalloc(MAXPATHLEN + 1);
+                               if (0 < get_system_windows_directory(default_location, MAXPATHLEN)) {
+                                       if (*php_ini_search_path) {
+                                               strcat(php_ini_search_path, paths_separator);
+                                       }
+                                       strcat(php_ini_search_path, default_location);
+                               }
+                               efree(default_location);
+                       }
+               }
 #else
                default_location = PHP_CONFIG_FILE_PATH;
                if (*php_ini_search_path) {
index 02607f1672edc6f49c55ea6cc98ea8e31366a3d0..4aabd98f1135d8bf85940d2237a0a32f60a112f1 100644 (file)
@@ -4,6 +4,7 @@
 */
 
 /* Default PHP / PEAR directories */
+#define PHP_CONFIG_FILE_PATH (getenv("SystemRoot"))?getenv("SystemRoot"):""
 #define CONFIGURATION_FILE_PATH "php.ini"
 #define PEAR_INSTALLDIR "@PREFIX@\\pear"
 #define PHP_BINDIR "@PREFIX@"