Index: main/SAPI.c
===================================================================
RCS file: /repository/php-src/main/SAPI.c,v
retrieving revision 1.202.2.7
diff -u -r1.202.2.7 SAPI.c
--- main/SAPI.c	1 Jan 2006 12:50:17 -0000	1.202.2.7
+++ main/SAPI.c	16 Jun 2006 20:25:47 -0000
@@ -968,6 +968,12 @@
 	}
 }
 
+SAPI_API void sapi_terminate_process(TSRMLS_D) {
+	if (sapi_module.terminate_process) {
+        sapi_module.terminate_process(TSRMLS_C);
+	}
+}
+
 /*
  * Local variables:
  * tab-width: 4
Index: main/SAPI.h
===================================================================
RCS file: /repository/php-src/main/SAPI.h,v
retrieving revision 1.114.2.1
diff -u -r1.114.2.1 SAPI.h
--- main/SAPI.h	1 Jan 2006 12:50:17 -0000	1.114.2.1
+++ main/SAPI.h	16 Jun 2006 20:46:01 -0000
@@ -205,6 +205,7 @@
 SAPI_API int sapi_get_target_uid(uid_t * TSRMLS_DC);
 SAPI_API int sapi_get_target_gid(gid_t * TSRMLS_DC);
 SAPI_API time_t sapi_get_request_time(TSRMLS_D);
+SAPI_API void sapi_terminate_process(TSRMLS_D);
 END_EXTERN_C()
 
 struct _sapi_module_struct {
@@ -234,6 +235,7 @@
 	void (*register_server_variables)(zval *track_vars_array TSRMLS_DC);
 	void (*log_message)(char *message);
 	time_t (*get_request_time)(TSRMLS_D);
+	void (*terminate_process)(TSRMLS_D);
 
 	char *php_ini_path_override;
 
Index: sapi/apache/mod_php5.c
===================================================================
RCS file: /repository/php-src/sapi/apache/mod_php5.c,v
retrieving revision 1.19.2.9
diff -u -r1.19.2.9 mod_php5.c
--- sapi/apache/mod_php5.c	13 May 2006 22:03:51 -0000	1.19.2.9
+++ sapi/apache/mod_php5.c	16 Jun 2006 20:46:01 -0000
@@ -435,6 +435,14 @@
 }
 /* }}} */
 
+/* {{{ sapi_apache_child_terminate
+ */
+static void sapi_apache_child_terminate(TSRMLS_D)
+{
+	ap_child_terminate((request_rec *)SG(server_context));
+}
+/* }}} */
+
 /* {{{ sapi_module_struct apache_sapi_module
  */
 static sapi_module_struct apache_sapi_module = {
@@ -464,6 +472,7 @@
 	sapi_apache_register_server_variables,		/* register server variables */
 	php_apache_log_message,			/* Log message */
 	php_apache_get_request_time,	/* Get request time */
+	sapi_apache_child_terminate,
 
 	NULL,							/* php.ini path override */
 
Index: main/main.c
===================================================================
RCS file: /repository/php-src/main/main.c,v
retrieving revision 1.640.2.24
diff -u -r1.640.2.24 main.c
--- main/main.c	11 May 2006 22:11:17 -0000	1.640.2.24
+++ main/main.c	16 Jun 2006 20:25:47 -0000
@@ -1014,6 +1017,7 @@
 {
 	PG(connection_status) |= PHP_CONNECTION_TIMEOUT;
 	zend_set_timeout(EG(timeout_seconds));
+	if(PG(exit_on_timeout)) sapi_terminate_process(TSRMLS_C);
 }
 
 #if PHP_SIGCHILD
@@ -1041,6 +1045,7 @@
 			PG(modules_activated) = 0;
 			PG(header_is_being_sent) = 0;
 			PG(connection_status) = PHP_CONNECTION_NORMAL;
+			PG(exit_on_timeout) = 1;
 
 			zend_activate(TSRMLS_C);
 			zend_set_timeout(EG(timeout_seconds));
Index: main/php_globals.h
===================================================================
RCS file: /repository/php-src/main/php_globals.h,v
retrieving revision 1.98.2.1
diff -u -r1.98.2.1 php_globals.h
--- main/php_globals.h	1 Jan 2006 12:50:17 -0000	1.98.2.1
+++ main/php_globals.h	16 Jun 2006 20:25:47 -0000
@@ -150,6 +150,7 @@
 
 	char *disable_functions;
 	char *disable_classes;
+	zend_bool exit_on_timeout;
 };
 
 
