mirror of
https://github.com/php/php-src.git
synced 2025-08-18 06:58:55 +02:00
- Added support for [HOST=www.example.com] sections
# Works the same way as PATH, just the SERVER_NAME is matched with these
This commit is contained in:
parent
3025b4296d
commit
ae2b2b1465
3 changed files with 23 additions and 3 deletions
|
@ -760,6 +760,21 @@ PHPAPI void php_ini_activate_per_dir_config(char *path, uint path_len TSRMLS_DC)
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
/* {{{ php_ini_activate_per_host_config
|
||||||
|
*/
|
||||||
|
PHPAPI void php_ini_activate_per_host_config(char *host, uint host_len TSRMLS_DC)
|
||||||
|
{
|
||||||
|
zval *tmp;
|
||||||
|
|
||||||
|
if (host && host_len) {
|
||||||
|
/* Search for source array matching the host from configuration_hash */
|
||||||
|
if (zend_hash_find(&configuration_hash, host, host_len, (void **) &tmp) == SUCCESS) {
|
||||||
|
php_ini_activate_config(Z_ARRVAL_P(tmp), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE TSRMLS_CC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ cfg_get_entry
|
/* {{{ cfg_get_entry
|
||||||
*/
|
*/
|
||||||
PHPAPI zval *cfg_get_entry(char *name, uint name_length)
|
PHPAPI zval *cfg_get_entry(char *name, uint name_length)
|
||||||
|
|
|
@ -35,6 +35,7 @@ PHPAPI int cfg_get_string(char *varname, char **result);
|
||||||
PHPAPI int php_parse_user_ini_file(char *dirname, char *ini_filename, HashTable *target_hash TSRMLS_DC);
|
PHPAPI int php_parse_user_ini_file(char *dirname, char *ini_filename, HashTable *target_hash TSRMLS_DC);
|
||||||
PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int stage TSRMLS_DC);
|
PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int stage TSRMLS_DC);
|
||||||
PHPAPI void php_ini_activate_per_dir_config(char *path, uint path_len TSRMLS_DC);
|
PHPAPI void php_ini_activate_per_dir_config(char *path, uint path_len TSRMLS_DC);
|
||||||
|
PHPAPI void php_ini_activate_per_host_config(char *host, uint host_len TSRMLS_DC);
|
||||||
#if ZEND_DEBUG
|
#if ZEND_DEBUG
|
||||||
PHPAPI HashTable get_configuration_hash(void);
|
PHPAPI HashTable get_configuration_hash(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -700,7 +700,7 @@ static void php_cgi_ini_activate_user_config(char *path, int path_len, int start
|
||||||
|
|
||||||
static int sapi_cgi_activate(TSRMLS_D)
|
static int sapi_cgi_activate(TSRMLS_D)
|
||||||
{
|
{
|
||||||
char *path, *doc_root;
|
char *path, *doc_root, *server_name;
|
||||||
uint path_len, doc_root_len;
|
uint path_len, doc_root_len;
|
||||||
|
|
||||||
/* PATH_TRANSLATED should be defined at this stage but better safe than sorry :) */
|
/* PATH_TRANSLATED should be defined at this stage but better safe than sorry :) */
|
||||||
|
@ -709,9 +709,10 @@ static int sapi_cgi_activate(TSRMLS_D)
|
||||||
}
|
}
|
||||||
|
|
||||||
doc_root = sapi_cgibin_getenv("DOCUMENT_ROOT", sizeof("DOCUMENT_ROOT") - 1 TSRMLS_CC);
|
doc_root = sapi_cgibin_getenv("DOCUMENT_ROOT", sizeof("DOCUMENT_ROOT") - 1 TSRMLS_CC);
|
||||||
|
server_name = sapi_cgibin_getenv("SERVER_NAME", sizeof("SERVER_NAME") - 1 TSRMLS_CC);
|
||||||
|
|
||||||
/* DOCUMENT_ROOT should also be defined at this stage..but better check it anyway */
|
/* DOCUMENT_ROOT and SERVER_NAME should also be defined at this stage..but better check it anyway */
|
||||||
if (!doc_root) {
|
if (!doc_root || !server_name) {
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
doc_root_len = strlen(doc_root);
|
doc_root_len = strlen(doc_root);
|
||||||
|
@ -734,6 +735,9 @@ static int sapi_cgi_activate(TSRMLS_D)
|
||||||
/* Activate per-dir-system-configuration defined in php.ini and stored into configuration_hash during startup */
|
/* Activate per-dir-system-configuration defined in php.ini and stored into configuration_hash during startup */
|
||||||
php_ini_activate_per_dir_config(path, path_len TSRMLS_CC); /* Note: for global settings sake we check from root to path */
|
php_ini_activate_per_dir_config(path, path_len TSRMLS_CC); /* Note: for global settings sake we check from root to path */
|
||||||
|
|
||||||
|
/* Activate per-host-system-configuration defined in php.ini and stored into configuration_hash during startup */
|
||||||
|
php_ini_activate_per_host_config(server_name, strlen(server_name) + 1 TSRMLS_CC);
|
||||||
|
|
||||||
/* Load and activate user ini files in path starting from DOCUMENT_ROOT */
|
/* Load and activate user ini files in path starting from DOCUMENT_ROOT */
|
||||||
if (strlen(PG(user_ini_filename))) {
|
if (strlen(PG(user_ini_filename))) {
|
||||||
php_cgi_ini_activate_user_config(path, path_len, doc_root_len - 1 TSRMLS_CC);
|
php_cgi_ini_activate_user_config(path, path_len, doc_root_len - 1 TSRMLS_CC);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue