Download | Plain Text | Line Numbers
--- php-5.3.2.orig/main/php_ini.c 2010-02-03 21:13:18.000000000 +0100
+++ php-5.3.2/main/php_ini.c 2010-06-12 21:09:14.000000000 +0200
@@ -687,6 +687,48 @@
php_ini_scanned_path = NULL;
}
+ char *php_ini_extra = getenv("PHP_INI_EXTRA");
+ if (!sapi_module.php_ini_ignore && php_ini_extra) {
+ struct stat sb;
+ zend_file_handle fh;
+ RESET_ACTIVE_INI_HASH();
+ memset(&fh, 0, sizeof(fh));
+
+ if (VCWD_STAT(php_ini_extra, &sb) == 0) {
+ if (S_ISREG(sb.st_mode)) {
+ if ((fh.handle.fp = VCWD_FOPEN(php_ini_extra, "r"))) {
+ fh.filename = php_ini_extra;
+ fh.type = ZEND_HANDLE_FP;
+
+ /* add an fake-host section so our settings will be changed to PHP_INI_SYSTEM during merge */
+ zval fakehost;
+ Z_STRLEN(fakehost) = sizeof("HOST=\%fake\%") - 1;
+ Z_STRVAL(fakehost) = zend_strndup("HOST=\%fake\%", Z_STRLEN(fakehost));
+ Z_TYPE(fakehost) = IS_STRING;
+ php_ini_parser_cb(&fakehost, NULL, NULL, ZEND_INI_PARSER_SECTION, &configuration_hash TSRMLS_CC);
+
+ if (zend_parse_ini_file(&fh, 1, ZEND_INI_SCANNER_NORMAL, (zend_ini_parser_cb_t) php_ini_parser_cb, &configuration_hash TSRMLS_CC) == SUCCESS) {
+ /* Here, add it to the list of ini files read */
+ int add_len = strlen(php_ini_extra) + 2;
+
+ int php_ini_scanned_files_len = (php_ini_scanned_files) ? strlen(php_ini_scanned_files) + 1 : 0;
+ php_ini_scanned_files = (char *) realloc(php_ini_scanned_files, php_ini_scanned_files_len + add_len + 1);
+ if (!php_ini_scanned_files_len) {
+ *php_ini_scanned_files = '\0';
+ }
+ add_len += php_ini_scanned_files_len;
+ if (php_ini_scanned_files_len) {
+ php_ini_scanned_files[php_ini_scanned_files_len - 2] = '\0';
+ strlcat(php_ini_scanned_files, ",\n", add_len);
+ }
+ strlcat(php_ini_scanned_files, php_ini_extra, add_len);
+ strlcat(php_ini_scanned_files, "\n", add_len);
+ }
+ }
+ }
+ }
+ }
+
if (sapi_module.ini_entries) {
/* Reset active ini section */
RESET_ACTIVE_INI_HASH();
diff -Naur php-5.3.2.orig/sapi/cgi/cgi_main.c php-5.3.2/sapi/cgi/cgi_main.c
--- php-5.3.2.orig/sapi/cgi/cgi_main.c 2012-09-06 13:37:47.599471003 +0200
+++ php-5.3.2/sapi/cgi/cgi_main.c 2012-09-06 14:06:10.504809677 +0200
@@ -832,6 +832,9 @@
}
if (php_ini_has_per_host_config()) {
+ /* activate our fake host entries. lowercase string required! */
+ php_ini_activate_per_host_config("\%fake\%", sizeof("\%fake\%") TSRMLS_CC);
+
/* Activate per-host-system-configuration defined in php.ini and stored into configuration_hash during startup */
if (fcgi_is_fastcgi()) {
fcgi_request *request = (fcgi_request*) SG(server_context);