version 1.1, 2012/02/21 23:48:05
|
version 1.1.1.5, 2014/06/15 20:04:01
|
Line 2
|
Line 2
|
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| PHP Version 5 | |
| PHP Version 5 | |
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| Copyright (c) 1997-2012 The PHP Group | | | Copyright (c) 1997-2014 The PHP Group | |
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| This source file is subject to version 3.01 of the PHP license, | |
| This source file is subject to version 3.01 of the PHP license, | |
| that is bundled with this package in the file LICENSE, and is | |
| that is bundled with this package in the file LICENSE, and is | |
Line 290 static void php_ini_parser_cb(zval *arg1, zval *arg2,
|
Line 290 static void php_ini_parser_cb(zval *arg1, zval *arg2,
|
is_special_section = 1; |
is_special_section = 1; |
has_per_dir_config = 1; |
has_per_dir_config = 1; |
|
|
/* make the path lowercase on Windows, for case insensitivty. Does nothign for other platforms */ | /* make the path lowercase on Windows, for case insensitivity. Does nothing for other platforms */ |
TRANSLATE_SLASHES_LOWER(key); |
TRANSLATE_SLASHES_LOWER(key); |
|
|
/* HOST sections */ |
/* HOST sections */ |
Line 368 int php_init_config(TSRMLS_D)
|
Line 368 int php_init_config(TSRMLS_D)
|
char *php_ini_file_name = NULL; |
char *php_ini_file_name = NULL; |
char *php_ini_search_path = NULL; |
char *php_ini_search_path = NULL; |
int php_ini_scanned_path_len; |
int php_ini_scanned_path_len; |
int safe_mode_state; |
|
char *open_basedir; |
char *open_basedir; |
int free_ini_search_path = 0; |
int free_ini_search_path = 0; |
zend_file_handle fh; |
zend_file_handle fh; |
Line 384 int php_init_config(TSRMLS_D)
|
Line 383 int php_init_config(TSRMLS_D)
|
zend_llist_init(&extension_lists.engine, sizeof(char *), (llist_dtor_func_t) free_estring, 1); |
zend_llist_init(&extension_lists.engine, sizeof(char *), (llist_dtor_func_t) free_estring, 1); |
zend_llist_init(&extension_lists.functions, sizeof(char *), (llist_dtor_func_t) free_estring, 1); |
zend_llist_init(&extension_lists.functions, sizeof(char *), (llist_dtor_func_t) free_estring, 1); |
|
|
safe_mode_state = PG(safe_mode); |
|
open_basedir = PG(open_basedir); |
open_basedir = PG(open_basedir); |
|
|
if (sapi_module.php_ini_path_override) { |
if (sapi_module.php_ini_path_override) { |
Line 395 int php_init_config(TSRMLS_D)
|
Line 393 int php_init_config(TSRMLS_D)
|
int search_path_size; |
int search_path_size; |
char *default_location; |
char *default_location; |
char *env_location; |
char *env_location; |
char *binary_location; |
|
static const char paths_separator[] = { ZEND_PATHS_SEPARATOR, 0 }; |
static const char paths_separator[] = { ZEND_PATHS_SEPARATOR, 0 }; |
#ifdef PHP_WIN32 |
#ifdef PHP_WIN32 |
char *reg_location; |
char *reg_location; |
Line 423 int php_init_config(TSRMLS_D)
|
Line 420 int php_init_config(TSRMLS_D)
|
env_location = ""; |
env_location = ""; |
} else { |
} else { |
size = GetEnvironmentVariableA("PHPRC", phprc_path, size); |
size = GetEnvironmentVariableA("PHPRC", phprc_path, size); |
env_location = phprc_path; | if (size == 0) { |
| env_location = ""; |
| } else { |
| env_location = phprc_path; |
| } |
} |
} |
} |
} |
} |
} |
Line 463 int php_init_config(TSRMLS_D)
|
Line 464 int php_init_config(TSRMLS_D)
|
#endif |
#endif |
|
|
/* Add cwd (not with CLI) */ |
/* Add cwd (not with CLI) */ |
if (strcmp(sapi_module.name, "cli") != 0) { | if (!sapi_module.php_ini_ignore_cwd) { |
if (*php_ini_search_path) { |
if (*php_ini_search_path) { |
strlcat(php_ini_search_path, paths_separator, search_path_size); |
strlcat(php_ini_search_path, paths_separator, search_path_size); |
} |
} |
strlcat(php_ini_search_path, ".", search_path_size); |
strlcat(php_ini_search_path, ".", search_path_size); |
} |
} |
|
|
/* Add binary directory */ | if (PG(php_binary)) { |
#ifdef PHP_WIN32 | char *separator_location, *binary_location; |
binary_location = (char *) emalloc(MAXPATHLEN); | |
if (GetModuleFileName(0, binary_location, MAXPATHLEN) == 0) { | |
efree(binary_location); | |
binary_location = NULL; | |
} | |
#else | |
if (sapi_module.executable_location) { | |
binary_location = (char *)emalloc(MAXPATHLEN); | |
if (!strchr(sapi_module.executable_location, '/')) { | |
char *envpath, *path; | |
int found = 0; | |
|
|
if ((envpath = getenv("PATH")) != NULL) { | binary_location = estrdup(PG(php_binary)); |
char *search_dir, search_path[MAXPATHLEN]; | separator_location = strrchr(binary_location, DEFAULT_SLASH); |
char *last = NULL; | |
|
|
path = estrdup(envpath); |
|
search_dir = php_strtok_r(path, ":", &last); |
|
|
|
while (search_dir) { |
|
snprintf(search_path, MAXPATHLEN, "%s/%s", search_dir, sapi_module.executable_location); |
|
if (VCWD_REALPATH(search_path, binary_location) && !VCWD_ACCESS(binary_location, X_OK)) { |
|
found = 1; |
|
break; |
|
} |
|
search_dir = php_strtok_r(NULL, ":", &last); |
|
} |
|
efree(path); |
|
} |
|
if (!found) { |
|
efree(binary_location); |
|
binary_location = NULL; |
|
} |
|
} else if (!VCWD_REALPATH(sapi_module.executable_location, binary_location) || VCWD_ACCESS(binary_location, X_OK)) { |
|
efree(binary_location); |
|
binary_location = NULL; |
|
} |
|
} else { |
|
binary_location = NULL; |
|
} |
|
#endif |
|
if (binary_location) { |
|
char *separator_location = strrchr(binary_location, DEFAULT_SLASH); |
|
|
|
if (separator_location && separator_location != binary_location) { |
if (separator_location && separator_location != binary_location) { |
*(separator_location) = 0; |
*(separator_location) = 0; |
} |
} |
Line 557 int php_init_config(TSRMLS_D)
|
Line 518 int php_init_config(TSRMLS_D)
|
#endif |
#endif |
} |
} |
|
|
PG(safe_mode) = 0; |
|
PG(open_basedir) = NULL; |
PG(open_basedir) = NULL; |
|
|
/* |
/* |
Line 610 int php_init_config(TSRMLS_D)
|
Line 570 int php_init_config(TSRMLS_D)
|
efree(php_ini_search_path); |
efree(php_ini_search_path); |
} |
} |
|
|
PG(safe_mode) = safe_mode_state; |
|
PG(open_basedir) = open_basedir; |
PG(open_basedir) = open_basedir; |
|
|
if (fh.handle.fp) { |
if (fh.handle.fp) { |
Line 826 PHPAPI void php_ini_activate_per_dir_config(char *path
|
Line 785 PHPAPI void php_ini_activate_per_dir_config(char *path
|
char path_bak[MAXPATHLEN]; |
char path_bak[MAXPATHLEN]; |
#endif |
#endif |
|
|
|
#if PHP_WIN32 |
|
/* MAX_PATH is \0-terminated, path_len == MAXPATHLEN would overrun path_bak */ |
|
if (path_len >= MAXPATHLEN) { |
|
#else |
if (path_len > MAXPATHLEN) { |
if (path_len > MAXPATHLEN) { |
|
#endif |
return; |
return; |
} |
} |
|
|