version 1.1, 2012/02/21 23:48:05
|
version 1.1.1.2, 2012/05/29 12:34:35
|
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) { |