summaryrefslogtreecommitdiff
path: root/mod_php4.c
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>1999-05-29 16:03:49 +0000
committerZeev Suraski <zeev@php.net>1999-05-29 16:03:49 +0000
commite9c646e7dde7f1f8761f90960341a1e5017887d9 (patch)
tree84ba6f426f058f7cc5750d919eb651c18e60a8b5 /mod_php4.c
parent873763473f59fd68d57baeeb7f4e5d77641398b9 (diff)
downloadphp-git-e9c646e7dde7f1f8761f90960341a1e5017887d9.tar.gz
avoid crashing with php4 directives in .conf files (they still don't work)
Diffstat (limited to 'mod_php4.c')
-rw-r--r--mod_php4.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/mod_php4.c b/mod_php4.c
index b876d8c3e4..48f9e9adc5 100644
--- a/mod_php4.c
+++ b/mod_php4.c
@@ -67,6 +67,7 @@ PHPAPI int apache_php_module_main(request_rec *r, int fd, int display_source_mod
module MODULE_VAR_EXPORT php4_module;
int saved_umask;
+static int php_initialized;
#if WIN32|WINNT
@@ -345,6 +346,12 @@ static void *php_create_dir(pool * p, char *dummy)
CONST_PREFIX char *php_apache_value_handler(cmd_parms *cmd, php_apache_info_struct *conf, char *arg1, char *arg2)
{
+ if (!php_initialized) {
+ sapi_startup(&sapi_module);
+ php_module_startup(&sapi_module);
+ php_initialized = 1;
+ }
+ printf("Altering '%s' -> '%s'\n", arg1, arg2);
php_alter_ini_entry(arg1, strlen(arg1)+1, arg2, strlen(arg2)+1, PHP_INI_PERDIR);
return NULL;
}
@@ -354,6 +361,12 @@ CONST_PREFIX char *php_apache_flag_handler(cmd_parms *cmd, php_apache_info_struc
{
char bool_val[2];
+ if (!php_initialized) {
+ sapi_startup(&sapi_module);
+ php_module_startup(&sapi_module);
+ php_initialized = 1;
+ }
+
if (!strcmp(arg2, "On")) {
bool_val[0] = '1';
} else {
@@ -382,12 +395,21 @@ int php_xbithack_handler(request_rec * r)
return send_parsed_php(r);
}
+static void apache_php_module_shutdown_wrapper()
+{
+ php_initialized = 0;
+ sapi_module.shutdown(&sapi_module);
+}
+
void php_init_handler(server_rec *s, pool *p)
{
- register_cleanup(p, NULL, php_module_shutdown, php_module_shutdown_for_exec);
- sapi_startup(&sapi_module);
- php_module_startup(&sapi_module);
+ register_cleanup(p, NULL, apache_php_module_shutdown_wrapper, php_module_shutdown_for_exec);
+ if (!php_initialized) {
+ sapi_startup(&sapi_module);
+ php_module_startup(&sapi_module);
+ php_initialized = 1;
+ }
#if MODULE_MAGIC_NUMBER >= 19980527
ap_add_version_component("PHP/" PHP_VERSION);
#endif
@@ -437,8 +459,8 @@ static int php_type_checker(request_rec *r)
handler_rec php_handlers[] =
{
- {"application/x-httpd-php3", send_parsed_php},
- {"application/x-httpd-php3-source", send_parsed_php_source},
+ {"application/x-httpd-php", send_parsed_php},
+ {"application/x-httpd-php-source", send_parsed_php_source},
{"text/html", php_xbithack_handler},
{NULL}
};