Patch attached as usual, should be quite self-exlaining. :D

--Jani

Index: php_ini.c
===================================================================
RCS file: /repository/php-src/main/php_ini.c,v
retrieving revision 1.136.2.4.2.7
diff -u -r1.136.2.4.2.7 php_ini.c
--- php_ini.c	24 Feb 2007 02:17:28 -0000	1.136.2.4.2.7
+++ php_ini.c	2 Apr 2007 12:48:31 -0000
@@ -258,6 +258,7 @@
  */
 int php_init_config(TSRMLS_D)
 {
+	char *default_location = NULL;
 	char *php_ini_file_name = NULL;
 	char *php_ini_search_path = NULL;
 	int safe_mode_state;
@@ -292,7 +293,6 @@
 		free_ini_search_path = 0;
 	} else if (!sapi_module.php_ini_ignore) {
 		int search_path_size;
-		char *default_location;
 		char *env_location;
 		char *binary_location;
 		static const char paths_separator[] = { ZEND_PATHS_SEPARATOR, 0 };
@@ -424,11 +424,11 @@
 	PG(open_basedir) = NULL;
 
 	memset(&fh, 0, sizeof(fh));
-	/* Check if php_ini_path_override is a file */
 	if (!sapi_module.php_ini_ignore) {
+		struct stat statbuf;
+
+		/* Check if php_ini_path_override is a file */
 		if (php_ini_file_name && php_ini_file_name[0]) {
-			struct stat statbuf;
-	
 			if (!VCWD_STAT(php_ini_file_name, &statbuf)) {
 				if (!((statbuf.st_mode & S_IFMT) == S_IFDIR)) {
 					fh.handle.fp = VCWD_FOPEN(php_ini_file_name, "r");
@@ -438,6 +438,21 @@
 				}
 			}
 		}
+#ifndef PHP_WIN32
+		/* Check if PHP_CONFIG_FILE_PATH points to a file */
+		if (default_location && default_location[0] && 
+			default_location[strlen(default_location)-1] != '/'
+		) {
+			if (!VCWD_STAT(default_location, &statbuf)) {
+				if (!((statbuf.st_mode & S_IFMT) == S_IFDIR)) {
+					fh.handle.fp = VCWD_FOPEN(default_location, "r");
+					if (fh.handle.fp) {
+						fh.filename = php_ini_opened_path = expand_filepath(default_location, NULL TSRMLS_CC);
+					}
+				}
+			}
+		}
+#endif
 		/* Search php-%sapi-module-name%.ini file in search path */
 		if (!fh.handle.fp) {
 			const char *fmt = "php-%s.ini";

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to