summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2002-11-12 20:56:47 +0000
committerMarcus Boerger <helly@php.net>2002-11-12 20:56:47 +0000
commitcecb9dfc7983b24cc99bb399ffc5a6f0eb9fafa9 (patch)
tree30571bd4cef67f5d80d578d3d9588e9dc9772169 /main
parent072466203d698ef0bf16995722c1748eaf9e39bd (diff)
downloadphp-git-cecb9dfc7983b24cc99bb399ffc5a6f0eb9fafa9.tar.gz
Implemented -n switch to skip parsing ini at startup as suggested by Wez.
#The switch 'n' was planned to be used for beautifying....delete n to make #clear these functions do not have a switch yet.
Diffstat (limited to 'main')
-rw-r--r--main/SAPI.h4
-rw-r--r--main/php_ini.c50
2 files changed, 29 insertions, 25 deletions
diff --git a/main/SAPI.h b/main/SAPI.h
index b720e41ea8..7e0464ffea 100644
--- a/main/SAPI.h
+++ b/main/SAPI.h
@@ -218,6 +218,8 @@ struct _sapi_module_struct {
void (*default_post_reader)(TSRMLS_D);
void (*treat_data)(int arg, char *str, zval *destArray TSRMLS_DC);
char *executable_location;
+
+ int php_ini_ignore;
};
@@ -251,7 +253,7 @@ SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data);
SAPI_API SAPI_POST_READER_FUNC(php_default_post_reader);
SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data);
-#define STANDARD_SAPI_MODULE_PROPERTIES NULL, NULL
+#define STANDARD_SAPI_MODULE_PROPERTIES NULL, NULL, 0
#endif /* SAPI_H */
diff --git a/main/php_ini.c b/main/php_ini.c
index e439547809..af41b6c97b 100644
--- a/main/php_ini.c
+++ b/main/php_ini.c
@@ -340,32 +340,34 @@ int php_init_config()
fh.handle.fp = NULL;
/* Check if php_ini_path_override is a file */
- if (sapi_module.php_ini_path_override && sapi_module.php_ini_path_override[0]) {
- struct stat statbuf;
-
- if (!VCWD_STAT(sapi_module.php_ini_path_override, &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;
+ if (!sapi_module.php_ini_ignore) {
+ if (sapi_module.php_ini_path_override && sapi_module.php_ini_path_override[0]) {
+ struct stat statbuf;
+
+ if (!VCWD_STAT(sapi_module.php_ini_path_override, &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;
+ }
}
}
- }
- /* Search php-%sapi-module-name%.ini file in search path */
- if (!fh.handle.fp) {
- const char *fmt = "php-%s.ini";
- char *ini_fname=emalloc(strlen(fmt)+strlen(sapi_module.name));
- sprintf(ini_fname, fmt, sapi_module.name);
- fh.handle.fp = php_fopen_with_path(ini_fname, "r", php_ini_search_path, &php_ini_opened_path TSRMLS_CC);
- efree(ini_fname);
- if (fh.handle.fp) {
- fh.filename = php_ini_opened_path;
+ /* Search php-%sapi-module-name%.ini file in search path */
+ if (!fh.handle.fp) {
+ const char *fmt = "php-%s.ini";
+ char *ini_fname=emalloc(strlen(fmt)+strlen(sapi_module.name));
+ sprintf(ini_fname, fmt, sapi_module.name);
+ fh.handle.fp = php_fopen_with_path(ini_fname, "r", php_ini_search_path, &php_ini_opened_path TSRMLS_CC);
+ efree(ini_fname);
+ if (fh.handle.fp) {
+ fh.filename = php_ini_opened_path;
+ }
}
- }
- /* 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);
- if (fh.handle.fp) {
- fh.filename = php_ini_opened_path;
+ /* 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);
+ if (fh.handle.fp) {
+ fh.filename = php_ini_opened_path;
+ }
}
}
if (free_ini_search_path) {
@@ -390,7 +392,7 @@ int php_init_config()
efree(php_ini_opened_path);
php_ini_opened_path = zend_strndup(Z_STRVAL(tmp), Z_STRLEN(tmp));
}
- }
+ }
/* If the config_file_scan_dir is set at compile-time, go and scan this directory and
* parse any .ini files found in this directory. */