summaryrefslogtreecommitdiff
path: root/main/php_ini.c
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2004-07-01 15:43:40 +0000
committerZeev Suraski <zeev@php.net>2004-07-01 15:43:40 +0000
commit8b504aad9834eea484e984f4a17fdd73124fb228 (patch)
tree9809310e883fc265da67de6f9e26d935a7425644 /main/php_ini.c
parent8dfbcec9a6761949bc1549afd4407e9186c7c980 (diff)
downloadphp-git-8b504aad9834eea484e984f4a17fdd73124fb228.tar.gz
MFH (more or less) registry-based setting for the location of php.ini
Diffstat (limited to 'main/php_ini.c')
-rw-r--r--main/php_ini.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/main/php_ini.c b/main/php_ini.c
index 02ab926363..95cb22160d 100644
--- a/main/php_ini.c
+++ b/main/php_ini.c
@@ -31,6 +31,7 @@
#include "SAPI.h"
#include "php_main.h"
#include "php_scandir.h"
+#include "win32/php_registry.h"
#if HAVE_SCANDIR && HAVE_ALPHASORT && HAVE_DIRENT_H
#include <dirent.h>
@@ -227,11 +228,20 @@ static void php_load_zend_extension_cb(void *arg TSRMLS_DC)
}
/* }}} */
+#ifdef PHP_WIN32
+#define NUM_INI_SEARCH_LOCATIONS 4
+#else
+#define NUM_INI_SEARCH_LOCATIONS 3
+#endif
+
/* {{{ php_init_config
*/
int php_init_config()
{
char *env_location, *php_ini_search_path;
+#ifdef PHP_WIN32
+ char *registry_location;
+#endif
char *binary_location;
int safe_mode_state;
char *open_basedir;
@@ -271,7 +281,7 @@ int php_init_config()
char *default_location;
static const char paths_separator[] = { ZEND_PATHS_SEPARATOR, 0 };
- php_ini_search_path = (char *) emalloc(MAXPATHLEN * 3 + strlen(env_location) + 3 + 1);
+ php_ini_search_path = (char *) emalloc(MAXPATHLEN * NUM_INI_SEARCH_LOCATIONS + strlen(env_location) + NUM_INI_SEARCH_LOCATIONS + 1);
free_ini_search_path = 1;
php_ini_search_path[0] = 0;
@@ -287,6 +297,17 @@ int php_init_config()
strcat(php_ini_search_path, env_location);
}
+#ifdef PHP_WIN32
+ registry_location = GetIniPathFromRegistry();
+ if (registry_location) {
+ if (*php_ini_search_path) {
+ strcat(php_ini_search_path, paths_separator);
+ }
+ strcat(php_ini_search_path, registry_location);
+ efree(registry_location);
+ }
+#endif
+
/* Add cwd */
#ifdef INI_CHECK_CWD
if (strcmp(sapi_module.name, "cli") != 0) {