33#if defined(HAVE_SCANDIR) && defined(HAVE_ALPHASORT) && defined(HAVE_DIRENT_H)
38#define TRANSLATE_SLASHES_LOWER(path) \
42 if (*tmp == '\\') *tmp = '/'; \
43 else *tmp = tolower(*tmp); \
48#define TRANSLATE_SLASHES_LOWER(path)
58static int is_special_section = 0;
61static int has_per_dir_config = 0;
62static int has_per_host_config = 0;
75 size_t display_string_length;
85 display_string =
"<i>no value</i>";
86 display_string_length =
sizeof(
"<i>no value</i>") - 1;
88 display_string =
"no value";
89 display_string_length =
sizeof(
"no value") - 1;
98 display_string =
"<i>no value</i>";
99 display_string_length =
sizeof(
"<i>no value</i>") - 1;
101 display_string =
"no value";
102 display_string_length =
sizeof(
"no value") - 1;
109 PHPWRITE(display_string, display_string_length);
123 module_number =
module->module_number;
139 PUTS(
"<td class=\"e\">");
141 PUTS(
"</td><td class=\"v\">");
143 PUTS(
"</td><td class=\"v\">");
145 PUTS(
"</td></tr>\n");
162#define PHP_EXTENSION_TOKEN "extension"
163#define ZEND_EXTENSION_TOKEN "zend_extension"
176#define RESET_ACTIVE_INI_HASH() do { \
177 active_ini_hash = NULL; \
178 is_special_section = 0; \
187 char *extension_name;
189 if (active_ini_hash) {
190 active_hash = active_ini_hash;
192 active_hash = target_hash;
195 switch (callback_type) {
257 key =
key +
sizeof(
"PATH") - 1;
259 is_special_section = 1;
260 has_per_dir_config = 1;
268 key =
key +
sizeof(
"HOST") - 1;
270 is_special_section = 1;
271 has_per_host_config = 1;
275 is_special_section = 0;
278 if (
key && key_len > 0) {
280 while (key_len > 0 && (
key[key_len - 1] ==
'/' ||
key[key_len - 1] ==
'\\')) {
314static void php_load_php_extension_cb(
void *
arg)
324static void php_load_zend_extension_cb(
void *
arg)
326 char *filename = *((
char **)
arg);
327 const size_t length =
strlen(filename);
339 int slash_suffix = 0;
356 char *orig_libpath = libpath;
367 filename, orig_libpath, err1, libpath, err2);
394static void php_load_zend_extension_cb(
void *
arg) { }
398static void append_ini_path(
char *php_ini_search_path,
size_t search_path_size,
const char *path)
402 if (*php_ini_search_path) {
403 strlcat(php_ini_search_path, paths_separator, search_path_size);
406 strlcat(php_ini_search_path, path, search_path_size);
412 char *php_ini_file_name =
NULL;
413 char *php_ini_search_path =
NULL;
414 int php_ini_scanned_path_len;
416 int free_ini_search_path = 0;
428 open_basedir =
PG(open_basedir);
431 php_ini_file_name =
sapi_module.php_ini_path_override;
432 php_ini_search_path =
sapi_module.php_ini_path_override;
433 free_ini_search_path = 0;
435 size_t search_path_size;
436 char *default_location;
443 env_location =
getenv(
"PHPRC");
455 size = GetEnvironmentVariableA(
"PHPRC", &dummybuf, 0);
456 if (GetLastError() == ERROR_ENVVAR_NOT_FOUND) {
463 size = GetEnvironmentVariableA(
"PHPRC", phprc_path,
size);
467 env_location = phprc_path;
482 php_ini_search_path = (
char *)
emalloc(search_path_size);
483 free_ini_search_path = 1;
484 php_ini_search_path[0] = 0;
487 if (env_location[0]) {
488 append_ini_path(php_ini_search_path, search_path_size, env_location);
489 php_ini_file_name = env_location;
495 if (reg_location !=
NULL) {
496 append_ini_path(php_ini_search_path, search_path_size, reg_location);
503 append_ini_path(php_ini_search_path, search_path_size,
".");
506 if (
PG(php_binary)) {
507 char *separator_location, *binary_location;
509 binary_location =
estrdup(
PG(php_binary));
512 if (separator_location && separator_location != binary_location) {
513 *(separator_location) = 0;
515 append_ini_path(php_ini_search_path, search_path_size, binary_location);
517 efree(binary_location);
524 if (0 < GetWindowsDirectory(default_location,
MAXPATHLEN)) {
525 append_ini_path(php_ini_search_path, search_path_size, default_location);
531 if (0 < GetSystemWindowsDirectory(default_location,
MAXPATHLEN)) {
532 append_ini_path(php_ini_search_path, search_path_size, default_location);
534 efree(default_location);
538 append_ini_path(php_ini_search_path, search_path_size, default_location);
549 char *filename =
NULL;
550 bool free_filename =
false;
558 if (php_ini_file_name && php_ini_file_name[0]) {
561 if (!
VCWD_STAT(php_ini_file_name, &statbuf)) {
562 if (!((statbuf.st_mode & S_IFMT) == S_IFDIR)) {
566 free_filename =
true;
574 const char *fmt =
"php-%s.ini";
593 if (free_ini_search_path) {
594 efree(php_ini_search_path);
597 PG(open_basedir) = open_basedir;
632 if (!
sapi_module.php_ini_ignore && php_ini_scanned_path_len) {
641 char *bufpath, *debpath, *endpath;
647 for (debpath = bufpath ; debpath ; debpath=endpath) {
657 lenpath = (int)
strlen(debpath);
661 for (i = 0; i < ndir; i++) {
671 if (
IS_SLASH(debpath[lenpath - 1])) {
684 l = (int)
strlen(ini_file);
703 if (!php_ini_scanned_files_len) {
706 total_l += php_ini_scanned_files_len;
707 for (element = scanned_ini_list.
head; element; element = element->
next) {
708 if (php_ini_scanned_files_len) {
780 bool orig_rc_debug = zend_rc_debug;
781 zend_rc_debug =
false;
785 zend_rc_debug = orig_rc_debug;
809 zend_string_release(data_str);
817 return has_per_dir_config;
841 memcpy(path_bak, path, path_len);
842 path_bak[path_len] = 0;
848 if (has_per_dir_config && path && path_len) {
866 return has_per_host_config;
875 if (has_per_host_config && host && host_len) {
907 *
result = zval_get_long(tmp);
921 *
result = zval_get_double(tmp);
942 return &configuration_hash;
SAPI_API sapi_module_struct sapi_module
getenv(?string $name=null, bool $local_only=false)
file(string $filename, int $flags=0, $context=null)
strrchr(string $haystack, string $needle, bool $before_needle=false)
dirname(string $path, int $levels=1)
strchr(string $haystack, string $needle, bool $before_needle=false)
PHPAPI int php_load_extension(const char *filename, int type, int start_now)
PHPAPI void * php_load_shlib(const char *path, char **errp)
PHPAPI char * expand_filepath(const char *filepath, char *real_path)
PHPAPI FILE * php_fopen_with_path(const char *filename, const char *mode, const char *path, zend_string **opened_path)
PHPAPI ZEND_COLD void php_info_print_table_header(int num_cols,...)
PHPAPI void php_html_puts(const char *str, size_t size)
const PHP_CONFIG_FILE_SCAN_DIR
const PHP_CONFIG_FILE_PATH
php_info_print_table_start()
php_info_print_table_end()
PHPAPI int cfg_get_string(const char *varname, char **result)
int php_shutdown_config(void)
PHPAPI void config_zval_dtor(zval *zvalue)
PHPAPI int php_parse_user_ini_file(const char *dirname, const char *ini_filename, HashTable *target_hash)
PHPAPI HashTable * php_ini_get_configuration_hash(void)
PHPAPI zval * cfg_get_entry_ex(zend_string *name)
#define TRANSLATE_SLASHES_LOWER(path)
#define RESET_ACTIVE_INI_HASH()
PHPAPI int php_ini_has_per_host_config(void)
PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int stage)
int php_init_config(void)
PHPAPI int php_ini_has_per_dir_config(void)
PHPAPI void php_ini_activate_per_host_config(const char *host, size_t host_len)
PHPAPI char * php_ini_scanned_files
PHPAPI char * php_ini_scanned_path
PHPAPI int cfg_get_long(const char *varname, zend_long *result)
PHPAPI int cfg_get_double(const char *varname, double *result)
PHPAPI char * php_ini_opened_path
PHPAPI void php_ini_activate_per_dir_config(char *path, size_t path_len)
#define PHP_EXTENSION_TOKEN
PHPAPI ZEND_COLD void display_ini_entries(zend_module_entry *module)
PHPAPI zval * cfg_get_entry(const char *name, size_t name_length)
struct _php_extension_lists php_extension_lists
void php_ini_register_extensions(void)
#define ZEND_EXTENSION_TOKEN
#define PHP_INI_STAGE_ACTIVATE
#define PHPWRITE(str, str_len)
unsigned char key[REFLECTION_KEY_LEN]
char * GetIniPathFromRegistry()
PHPAPI int php_scandir(const char *dirname, struct dirent **namelist[], int(*selector)(const struct dirent *entry), int(*compare)(const struct dirent **a, const struct dirent **b))
PHPAPI int php_alphasort(const struct dirent **a, const struct dirent **b)
union _zend_file_handle::@045057025306333206016200356074063117305134322373 handle
void(* displayer)(zend_ini_entry *ini_entry, int type)
struct _zend_llist_element * next
zend_llist_element * head
PHP_WINUTIL_API BOOL php_win32_image_compatible(HMODULE handle, char **err)
void free_estring(char **str_p)
ZEND_API char *ZEND_FASTCALL zend_strndup(const char *s, size_t length)
#define estrndup(s, length)
strcmp(string $string1, string $string2)
zend_string_release_ex(func->internal_function.function_name, 0)
ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle)
ZEND_API void(ZEND_FASTCALL *zend_touch_vm_stack_data)(void *vm_stack_data)
zend_result zend_load_extension(const char *path)
zend_result zend_load_extension_handle(DL_HANDLE handle, const char *path)
struct _zend_ini_entry zend_ini_entry
ZEND_API void ZEND_FASTCALL zend_hash_destroy(HashTable *ht)
ZEND_API zval *ZEND_FASTCALL zend_hash_str_find(const HashTable *ht, const char *str, size_t len)
ZEND_API zval *ZEND_FASTCALL zend_hash_next_index_insert(HashTable *ht, zval *pData)
ZEND_API zval *ZEND_FASTCALL zend_hash_str_update(HashTable *ht, const char *str, size_t len, zval *pData)
ZEND_API zval *ZEND_FASTCALL zend_hash_update(HashTable *ht, zend_string *key, zval *pData)
ZEND_API zval *ZEND_FASTCALL zend_hash_find(const HashTable *ht, zend_string *key)
#define zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent)
#define ZEND_HASH_MAP_FOREACH_PTR(ht, _ptr)
#define ZEND_HASH_FOREACH_END()
#define ZEND_HASH_MAP_FOREACH_STR_KEY_VAL(ht, _key, _val)
ZEND_API zend_result zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value, int modify_type, int stage, bool force_change)
ZEND_API zend_result zend_parse_ini_file(zend_file_handle *fh, bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg)
#define ZEND_INI_PARSER_ENTRY
void(* zend_ini_parser_cb_t)(zval *arg1, zval *arg2, zval *arg3, int callback_type, void *arg)
#define ZEND_INI_DISPLAY_ORIG
#define ZEND_INI_PARSER_POP_ENTRY
ZEND_API zend_result zend_parse_ini_string(const char *str, bool unbuffered_errors, int scanner_mode, zend_ini_parser_cb_t ini_parser_cb, void *arg)
#define ZEND_INI_PARSER_SECTION
#define ZEND_INI_DISPLAY_ACTIVE
struct _zend_file_handle zend_file_handle
#define ZEND_INI_SCANNER_NORMAL
ZEND_API void zend_llist_destroy(zend_llist *l)
ZEND_API void zend_llist_add_element(zend_llist *l, const void *element)
ZEND_API void zend_llist_init(zend_llist *l, size_t size, llist_dtor_func_t dtor, unsigned char persistent)
ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t func)
struct _zend_llist_element zend_llist_element
void(* llist_dtor_func_t)(void *)
struct _zend_llist zend_llist
struct _zend_string zend_string
struct _zend_module_entry zend_module_entry
#define MODULE_PERSISTENT
ZEND_API void ZEND_FASTCALL zend_str_tolower(char *str, size_t length)
ZEND_API int ZEND_FASTCALL zend_binary_strncasecmp(const char *s1, size_t len1, const char *s2, size_t len2, size_t length)
#define ZEND_PATHS_SEPARATOR
ZEND_API void zend_stream_init_fp(zend_file_handle *handle, FILE *fp, const char *filename)
#define zend_string_equals_literal_ci(str, c)
#define Z_STRVAL_P(zval_p)
#define Z_ARRVAL_P(zval_p)
struct _zend_array HashTable
void(* dtor_func_t)(zval *pDest)
#define Z_STRLEN_P(zval_p)
#define ZVAL_NEW_STR(z, s)
#define ZVAL_NEW_PERSISTENT_ARR(z)
#define VCWD_FOPEN(path, mode)
#define IS_ABSOLUTE_PATH(path, len)
#define DEFAULT_DIR_SEPARATOR
#define VCWD_STAT(path, buff)