]> git.pld-linux.org Git - packages/php.git/blob - php-sapi-ini-file.patch
install extra sapi config to <sapi>.d dir
[packages/php.git] / php-sapi-ini-file.patch
1 To test which is main php.ini:
2 $ php -r 'var_dump(array(get_cfg_var("cfg_file_path"),php_ini_loaded_file()));'
3
4 https://github.com/pld-linux/php/commit/762ec2e
5
6 diff --git a/main/php_ini.c b/main/php_ini.c
7 index d508c13b50..2cf28eb7f5 100644
8 --- a/main/php_ini.c
9 +++ b/main/php_ini.c
10 @@ -410,6 +410,11 @@ static void php_load_zend_extension_cb(void *arg) { }
11  #endif
12  /* }}} */
13  
14 +static int php_csort(const struct dirent **a, const struct dirent **b)
15 +{
16 +       return strcmp((*a)->d_name,(*b)->d_name);
17 +}
18 +
19  /* {{{ php_init_config
20   */
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;
25                 int l, total_l = 0;
26 +               const char *fmt = "%s:" PHP_CONFIG_FILE_PATH "/%s.d";
27                 char *bufpath, *debpath, *endpath;
28                 int lenpath;
29  
30                 zend_llist_init(&scanned_ini_list, sizeof(char *), (llist_dtor_func_t) free_estring, 1);
31  
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);
37                         if (endpath) {
38 @@ -679,7 +686,7 @@ int php_init_config(void)
39                         }
40                         lenpath = (int)strlen(debpath);
41  
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) {
44  
45                                 for (i = 0; i < ndir; i++) {
46  
This page took 0.04275 seconds and 4 git commands to generate.