Skip to content

Commit 6a2d84b

Browse files
committed
Oops, forgot to add sapi_apache.c to the apache_hooks branch
1 parent 3c64473 commit 6a2d84b

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

sapi/apache/sapi_apache.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,40 @@ int apache_php_module_main(request_rec *r, int display_source_mode TSRMLS_DC)
100100
}
101101
/* }}} */
102102

103+
/* {{{ apache_php_module_hook
104+
*/
105+
int apache_php_module_hook(request_rec *r, char *filename, zval **ret TSRMLS_DC)
106+
{
107+
zend_file_handle file_handle;
108+
109+
#if PHP_SIGCHILD
110+
signal(SIGCHLD, sigchld_handler);
111+
#endif
112+
113+
if (php_request_startup_for_hook(TSRMLS_C) == FAILURE) {
114+
return FAILURE;
115+
}
116+
117+
/* Add PHP_SELF_HOOK - Absolute path */
118+
php_register_variable("PHP_SELF_HOOK", filename, PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC);
119+
120+
file_handle.type = ZEND_HANDLE_FILENAME;
121+
file_handle.handle.fd = 0;
122+
file_handle.filename = filename;
123+
file_handle.opened_path = NULL;
124+
file_handle.free_filename = 0;
125+
126+
(void) php_execute_simple_script(&file_handle, ret TSRMLS_CC);
127+
128+
AP(in_request) = 0;
129+
130+
zend_try {
131+
php_request_shutdown_for_hook(NULL);
132+
} zend_end_try();
133+
134+
return (OK);
135+
}
136+
103137
/*
104138
* Local variables:
105139
* tab-width: 4

0 commit comments

Comments
 (0)