Permalink
Browse files

First try to open php-SAPI.ini and if it fails fall back to regular

php.ini file. For example cli version of PHP will first try to open
php-cli.ini in the usual ini file search path and only if it fails
will it try to open php.ini using the same path.
  • Loading branch information...
1 parent 200058a commit 8f94a8a7449cf0273fdbd0d00975325f870d6cd2 @edinkad edinkad committed Jul 29, 2002
Showing with 6 additions and 1 deletion.
  1. +6 −1 main/php_ini.c
View
7 main/php_ini.c
@@ -312,7 +312,12 @@ int php_init_config()
}
/* Search php.ini file in search path */
if (!fh.handle.fp) {
- fh.handle.fp = php_fopen_with_path("php.ini", "r", php_ini_search_path, &php_ini_opened_path TSRMLS_CC);
+ char *ini_fname=emalloc(10+strlen(sapi_module.name));
+ sprintf(ini_fname, "php-%s.ini", sapi_module.name);
+ if (!(fh.handle.fp = php_fopen_with_path(ini_fname, "r", php_ini_search_path, &php_ini_opened_path TSRMLS_CC))) {
+ fh.handle.fp = php_fopen_with_path("php.ini", "r", php_ini_search_path, &php_ini_opened_path TSRMLS_CC);
+ }
+ efree(ini_fname);
fh.filename = php_ini_opened_path;
}
if (free_ini_search_path) {

0 comments on commit 8f94a8a

Please sign in to comment.