1 To test which is main php.ini:
2 $ php -r 'var_dump(array(get_cfg_var("cfg_file_path"),php_ini_loaded_file()));'
4 https://github.com/pld-linux/php/commit/762ec2e
6 diff --git a/main/php_ini.c b/main/php_ini.c
7 index d508c13b50..2cf28eb7f5 100644
10 @@ -410,6 +410,11 @@ static void php_load_zend_extension_cb(void *arg) { }
14 +static int php_csort(const struct dirent **a, const struct dirent **b)
16 + return strcmp((*a)->d_name,(*b)->d_name);
19 /* {{{ php_init_config
21 int php_init_config(void)
22 @@ -661,12 +666,14 @@ int php_init_config(void)
23 zend_llist scanned_ini_list;
24 zend_llist_element *element;
26 + const char *fmt = "%s:" PHP_CONFIG_FILE_PATH "/%s.d";
27 char *bufpath, *debpath, *endpath;
30 zend_llist_init(&scanned_ini_list, sizeof(char *), (llist_dtor_func_t) free_estring, 1);
32 - bufpath = estrdup(php_ini_scanned_path);
33 + bufpath = emalloc(strlen(php_ini_scanned_path) + strlen(fmt) + strlen(sapi_module.name));
34 + sprintf(bufpath, fmt, php_ini_scanned_path, sapi_module.name);
35 for (debpath = bufpath ; debpath ; debpath=endpath) {
36 endpath = strchr(debpath, DEFAULT_DIR_SEPARATOR);
38 @@ -679,7 +686,7 @@ int php_init_config(void)
40 lenpath = (int)strlen(debpath);
42 - if (lenpath > 0 && (ndir = php_scandir(debpath, &namelist, 0, php_alphasort)) > 0) {
43 + if (lenpath > 0 && (ndir = php_scandir(debpath, &namelist, 0, php_csort)) > 0) {
45 for (i = 0; i < ndir; i++) {