summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sapi/apache2filter/apache_config.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/sapi/apache2filter/apache_config.c b/sapi/apache2filter/apache_config.c
index a46c99222a..90a544415f 100644
--- a/sapi/apache2filter/apache_config.c
+++ b/sapi/apache2filter/apache_config.c
@@ -83,6 +83,30 @@ static const char *php_apache_admin_value_handler(cmd_parms *cmd, void *dummy, c
return real_value_hnd(cmd, dummy, name, value, PHP_INI_SYSTEM);
}
+static const char *real_flag_hnd(cmd_parms *cmd, void *dummy, const char *arg1, const char *arg2, int status)
+{
+ char bool_val[2];
+
+ if (!strcasecmp(arg2, "On")) {
+ bool_val[0] = '1';
+ } else {
+ bool_val[0] = '0';
+ }
+ bool_val[1] = 0;
+
+ return real_value_hnd(cmd, dummy, arg1, bool_val, status);
+}
+
+static const char *php_apache_flag_handler(cmd_parms *cmd, void *dummy, const char *name, const char *value)
+{
+ return real_flag_hnd(cmd, dummy, name, value, PHP_INI_USER);
+}
+
+static const char *php_apache_admin_flag_handler(cmd_parms *cmd, void *dummy, const char *name, const char *value)
+{
+ return real_flag_hnd(cmd, dummy, name, value, PHP_INI_SYSTEM);
+}
+
static const char *php_apache_phpini_set(cmd_parms *cmd, void *mconfig, const char *arg)
{
if (apache2_php_ini_path_override) {
@@ -139,8 +163,12 @@ const command_rec php_dir_cmds[] =
{
AP_INIT_TAKE2("php_value", php_apache_value_handler, NULL, OR_OPTIONS,
"PHP Value Modifier"),
- AP_INIT_TAKE2("php_admin_value", php_apache_admin_value_handler, NULL, OR_NONE,
- "PHP Value Modifier"),
+ AP_INIT_TAKE2("php_flag", php_apache_flag_handler, NULL, OR_OPTIONS,
+ "PHP Flag Modifier"),
+ AP_INIT_TAKE2("php_admin_value", php_apache_admin_value_handler, NULL, ACCESS_CONF,
+ "PHP Value Modifier (Admin)"),
+ AP_INIT_TAKE2("php_admin_flag", php_apache_admin_flag_handler, NULL, ACCESS_CONF,
+ "PHP Flag Modifier (Admin)"),
AP_INIT_TAKE1("PHPINIDir", php_apache_phpini_set, NULL, RSRC_CONF,
"Directory containing the php.ini file"),
{NULL}