Permalink
Browse files

In addtion to path to php.ini, PHPRC now may specify full file name

  • Loading branch information...
1 parent bc8f1bc commit c946b4d1b25fa1723d3c08b5fc3be69bb32f90c2 Dmitry Stogov committed Aug 3, 2006
Showing with 10 additions and 4 deletions.
  1. +1 −0 NEWS
  2. +9 −4 main/php_ini.c
View
1 NEWS
@@ -1,6 +1,7 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? Aug 2006, PHP 5.2.0RC2
+- In addtion to path to php.ini, PHPRC now may specify full file name. (Dmitry)
- Added "PHPINIDir" Apache directive to apache and apache_hooks SAPIs. (Dmitry)
- Added an optional boolean parameter to memory_get_usage() and
memory_get_peak_usage() to get memory size allocated by emalloc() or real
View
13 main/php_ini.c
@@ -258,6 +258,7 @@ static void pvalue_config_destructor(zval *pvalue)
*/
int php_init_config(TSRMLS_D)
{
+ char *php_ini_file_name = NULL;
char *php_ini_search_path = NULL;
int safe_mode_state;
char *open_basedir;
@@ -286,6 +287,7 @@ int php_init_config(TSRMLS_D)
open_basedir = PG(open_basedir);
if (sapi_module.php_ini_path_override) {
+ php_ini_file_name = sapi_module.php_ini_path_override;
php_ini_search_path = sapi_module.php_ini_path_override;
free_ini_search_path = 0;
} else if (!sapi_module.php_ini_ignore) {
@@ -316,6 +318,7 @@ int php_init_config(TSRMLS_D)
strcat(php_ini_search_path, paths_separator);
}
strcat(php_ini_search_path, env_location);
+ php_ini_file_name = env_location;
}
#ifdef PHP_WIN32
@@ -421,13 +424,15 @@ int php_init_config(TSRMLS_D)
memset(&fh, 0, sizeof(fh));
/* Check if php_ini_path_override is a file */
if (!sapi_module.php_ini_ignore) {
- if (sapi_module.php_ini_path_override && sapi_module.php_ini_path_override[0]) {
+ if (php_ini_file_name && php_ini_file_name[0]) {
struct stat statbuf;
- if (!VCWD_STAT(sapi_module.php_ini_path_override, &statbuf)) {
+ if (!VCWD_STAT(php_ini_file_name, &statbuf)) {
if (!((statbuf.st_mode & S_IFMT) == S_IFDIR)) {
- fh.handle.fp = VCWD_FOPEN(sapi_module.php_ini_path_override, "r");
- fh.filename = sapi_module.php_ini_path_override;
+ fh.handle.fp = VCWD_FOPEN(php_ini_file_name, "r");
+ if (fh.handle.fp) {
+ fh.filename = php_ini_opened_path = expand_filepath(php_ini_file_name, NULL TSRMLS_CC);
+ }
}
}
}

0 comments on commit c946b4d

Please sign in to comment.