Skip to content

Commit

Permalink
In addtion to path to php.ini, PHPRC now may specify full file name
Browse files Browse the repository at this point in the history
  • Loading branch information
dstogov committed Aug 3, 2006
1 parent bc8f1bc commit c946b4d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions 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
Expand Down
13 changes: 9 additions & 4 deletions main/php_ini.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
}
}
}
Expand Down

0 comments on commit c946b4d

Please sign in to comment.