2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | Copyright (c) 1997-2013 The PHP Group |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available at through the world-wide-web at |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
15 | Authors: Rasmus Lerdorf <rasmus@php.net> |
16 | (with helpful hints from Dean Gaudet <dgaudet@arctic.org> |
17 | PHP 4.0 patches by Zeev Suraski <zeev@zend.com> |
18 +----------------------------------------------------------------------+
22 #include "php_apache_http.h"
25 #define SIGPIPE SIGINT
32 int apache_php_module_main(request_rec
*r
, int display_source_mode TSRMLS_DC
);
33 static void php_save_umask(void);
34 static void php_restore_umask(void);
35 static int sapi_apache_read_post(char *buffer
, uint count_bytes TSRMLS_DC
);
36 static char *sapi_apache_read_cookies(TSRMLS_D
);
37 static int sapi_apache_header_handler(sapi_header_struct
*sapi_header
, sapi_header_op_enum op
, sapi_headers_struct
*sapi_headers TSRMLS_DC
);
38 static int sapi_apache_send_headers(sapi_headers_struct
*sapi_headers TSRMLS_DC
);
39 static int send_php(request_rec
*r
, int display_source_mode
, char *filename
);
40 static int send_parsed_php(request_rec
* r
);
41 static int send_parsed_php_source(request_rec
* r
);
42 static int php_xbithack_handler(request_rec
* r
);
43 static void php_init_handler(server_rec
*s
, pool
*p
);
46 #if MODULE_MAGIC_NUMBER >= 19970728
47 static void php_child_exit_handler(server_rec
*s
, pool
*p
);
50 #if MODULE_MAGIC_NUMBER > 19961007
51 #define CONST_PREFIX const
57 typedef struct _sapi_stack
{
58 int top
, max
, persistent
;
62 typedef struct _php_per_dir_config
{
63 HashTable
*ini_settings
;
64 sapi_stack headers_handlers
;
65 sapi_stack auth_handlers
;
66 sapi_stack access_handlers
;
67 sapi_stack type_handlers
;
68 sapi_stack fixup_handlers
;
69 sapi_stack logger_handlers
;
70 sapi_stack post_read_handlers
;
71 sapi_stack response_handlers
;
74 typedef struct _php_per_server_config
{
75 sapi_stack uri_handlers
;
77 } php_per_server_config
;
80 static CONST_PREFIX
char *php_apache_value_handler_ex(cmd_parms
*cmd
, HashTable
*conf
, char *arg1
, char *arg2
, int mode
);
81 static CONST_PREFIX
char *php_apache_value_handler(cmd_parms
*cmd
, php_per_dir_config
*conf
, char *arg1
, char *arg2
);
82 static CONST_PREFIX
char *php_apache_admin_value_handler(cmd_parms
*cmd
, php_per_dir_config
*conf
, char *arg1
, char *arg2
);
83 static CONST_PREFIX
char *php_apache_flag_handler(cmd_parms
*cmd
, php_per_dir_config
*conf
, char *arg1
, char *arg2
);
84 static CONST_PREFIX
char *php_apache_flag_handler_ex(cmd_parms
*cmd
, HashTable
*conf
, char *arg1
, char *arg2
, int mode
);
85 static CONST_PREFIX
char *php_apache_admin_flag_handler(cmd_parms
*cmd
, php_per_dir_config
*conf
, char *arg1
, char *arg2
);
87 /* ### these should be defined in mod_php5.h or somewhere else */
91 module MODULE_VAR_EXPORT php5_module
;
94 /* static int setup_env = 0; */
95 static unsigned char apache_php_initialized
;
97 typedef struct _php_per_dir_entry
{
105 /* some systems are missing these from their header files */
107 /* {{{ zend stack utility functions
110 /* This code is ripped part and parcel from zend_stack.[ch]. Assuming that the
111 patch supporting zend_stack_init_ex is applied, all but the bottom two
112 module-specific iterators will be removed
115 int sapi_stack_init_ex(sapi_stack
*stack
, int persistent
)
118 stack
->persistent
= persistent
;
119 stack
->elements
= (void **) pemalloc(sizeof(void **) * STACK_BLOCK_SIZE
, persistent
);
120 if (!stack
->elements
) {
123 stack
->max
= STACK_BLOCK_SIZE
;
127 int sapi_stack_push(sapi_stack
*stack
, void *element
)
129 if (stack
->top
>= stack
->max
) { /* we need to allocate more memory */
130 stack
->elements
= (void **) perealloc(stack
->elements
,
131 (sizeof(void **) * (stack
->max
+= STACK_BLOCK_SIZE
)), stack
->persistent
);
132 if (!stack
->elements
) {
136 stack
->elements
[stack
->top
] = (void *) element
;
139 void* sapi_stack_pop(sapi_stack
*stack
) {
140 if(stack
->top
== 0) {
144 return stack
->elements
[--stack
->top
];
148 int sapi_stack_destroy(sapi_stack
*stack
)
153 int sapi_stack_apply_with_argument_all(sapi_stack
*stack
, int type
, int (*apply_function
)(void *element
, void *arg
), void *arg
)
158 case ZEND_STACK_APPLY_TOPDOWN
:
159 for (i
=stack
->top
-1; i
>=0; i
--) {
160 retval
= apply_function(stack
->elements
[i
], arg
);
163 case ZEND_STACK_APPLY_BOTTOMUP
:
164 for (i
=0; i
<stack
->top
; i
++) {
165 retval
= apply_function(stack
->elements
[i
], arg
);
173 int sapi_stack_apply_with_argument_stop_if_equals(sapi_stack
*stack
, int type
, int (*apply_function
)(void *element
, void *arg
), void *arg
, int stopval
)
178 case ZEND_STACK_APPLY_TOPDOWN
:
179 for (i
=stack
->top
-1; i
>=0; i
--) {
180 if ((ret
= apply_function(stack
->elements
[i
], arg
)) == stopval
) {
185 case ZEND_STACK_APPLY_BOTTOMUP
:
186 for (i
=0; i
<stack
->top
; i
++) {
187 if ((ret
= apply_function(stack
->elements
[i
], arg
)) == stopval
) {
196 int sapi_stack_apply_with_argument_stop_if_http_error(sapi_stack
*stack
, int type
, int (*apply_function
)(void *element
, void *arg
), void *arg
)
201 case ZEND_STACK_APPLY_TOPDOWN
:
202 for (i
=stack
->top
-1; i
>=0; i
--) {
203 if ((ret
= apply_function(stack
->elements
[i
], arg
)) > 0) {
208 case ZEND_STACK_APPLY_BOTTOMUP
:
209 for (i
=0; i
<stack
->top
; i
++) {
210 if ((ret
= apply_function(stack
->elements
[i
], arg
)) > 0) {
219 void php_handler_stack_destroy(sapi_stack
*stack
)
222 while((ph
= (php_handler
*)sapi_stack_pop(stack
)) != NULL
) {
229 /* {{{ php_save_umask
231 static void php_save_umask(void)
233 saved_umask
= umask(077);
238 /* {{{ sapi_apache_ub_write
240 static int sapi_apache_ub_write(const char *str
, uint str_length TSRMLS_DC
)
244 if (SG(server_context
)) {
245 ret
= rwrite(str
, str_length
, (request_rec
*) SG(server_context
));
247 if (ret
!= str_length
) {
248 php_handle_aborted_connection();
254 /* {{{ sapi_apache_flush
256 static void sapi_apache_flush(void *server_context
)
258 if (server_context
) {
259 #if MODULE_MAGIC_NUMBER > 19970110
260 rflush((request_rec
*) server_context
);
262 bflush((request_rec
*) server_context
->connection
->client
);
268 /* {{{ sapi_apache_read_post
270 static int sapi_apache_read_post(char *buffer
, uint count_bytes TSRMLS_DC
)
272 uint total_read_bytes
=0, read_bytes
;
273 request_rec
*r
= (request_rec
*) SG(server_context
);
274 void (*handler
)(int);
277 * This handles the situation where the browser sends a Expect: 100-continue header
278 * and needs to recieve confirmation from the server on whether or not it can send
279 * the rest of the request. RFC 2616
282 if (!SG(read_post_bytes
) && !ap_should_client_block(r
)) {
283 return total_read_bytes
;
286 handler
= signal(SIGPIPE
, SIG_IGN
);
287 while (total_read_bytes
<count_bytes
) {
288 hard_timeout("Read POST information", r
); /* start timeout timer */
289 read_bytes
= get_client_block(r
, buffer
+total_read_bytes
, count_bytes
-total_read_bytes
);
294 total_read_bytes
+= read_bytes
;
296 signal(SIGPIPE
, handler
);
297 return total_read_bytes
;
301 /* {{{ sapi_apache_read_cookies
303 static char *sapi_apache_read_cookies(TSRMLS_D
)
305 return (char *) table_get(((request_rec
*) SG(server_context
))->subprocess_env
, "HTTP_COOKIE");
309 /* {{{ sapi_apache_header_handler
311 static int sapi_apache_header_handler(sapi_header_struct
*sapi_header
, sapi_header_op_enum op
, sapi_headers_struct
*sapi_headers TSRMLS_DC
)
313 char *header_name
, *header_content
, *p
;
314 request_rec
*r
= (request_rec
*) SG(server_context
);
320 case SAPI_HEADER_DELETE_ALL
:
321 clear_table(r
->headers_out
);
324 case SAPI_HEADER_DELETE
:
325 table_unset(r
->headers_out
, sapi_header
->header
);
328 case SAPI_HEADER_ADD
:
329 case SAPI_HEADER_REPLACE
:
330 header_name
= sapi_header
->header
;
332 header_content
= p
= strchr(header_name
, ':');
340 } while (*header_content
==' ');
342 if (!strcasecmp(header_name
, "Content-Type")) {
343 r
->content_type
= pstrdup(r
->pool
, header_content
);
344 } else if (!strcasecmp(header_name
, "Set-Cookie")) {
345 table_add(r
->headers_out
, header_name
, header_content
);
346 } else if (op
== SAPI_HEADER_REPLACE
) {
347 table_set(r
->headers_out
, header_name
, header_content
);
349 table_add(r
->headers_out
, header_name
, header_content
);
352 *p
= ':'; /* a well behaved header handler shouldn't change its original arguments */
354 return SAPI_HEADER_ADD
;
362 /* {{{ sapi_apache_send_headers
364 static int sapi_apache_send_headers(sapi_headers_struct
*sapi_headers TSRMLS_DC
)
366 if(SG(server_context
) == NULL
) { /* server_context is not here anymore */
367 return SAPI_HEADER_SEND_FAILED
;
370 ((request_rec
*) SG(server_context
))->status
= SG(sapi_headers
).http_response_code
;
371 /* check that we haven't sent headers already, we use our own
372 * headers_sent since we may send headers at anytime
374 if(!AP(headers_sent
)) {
375 send_http_header((request_rec
*) SG(server_context
));
376 AP(headers_sent
) = 1;
378 return SAPI_HEADER_SENT_SUCCESSFULLY
;
382 /* {{{ sapi_apache_register_server_variables
384 static void sapi_apache_register_server_variables(zval
*track_vars_array TSRMLS_DC
)
387 array_header
*arr
= table_elts(((request_rec
*) SG(server_context
))->subprocess_env
);
388 table_entry
*elts
= (table_entry
*) arr
->elts
;
389 zval
**path_translated
;
390 HashTable
*symbol_table
;
392 for (i
= 0; i
< arr
->nelts
; i
++) {
400 php_register_variable(elts
[i
].key
, val
, track_vars_array TSRMLS_CC
);
403 /* If PATH_TRANSLATED doesn't exist, copy it from SCRIPT_FILENAME */
404 if (track_vars_array
) {
405 symbol_table
= track_vars_array
->value
.ht
;
410 && !zend_hash_exists(symbol_table
, "PATH_TRANSLATED", sizeof("PATH_TRANSLATED"))
411 && zend_hash_find(symbol_table
, "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME"), (void **) &path_translated
)==SUCCESS
) {
412 php_register_variable("PATH_TRANSLATED", Z_STRVAL_PP(path_translated
), track_vars_array TSRMLS_CC
);
415 php_register_variable("PHP_SELF", ((request_rec
*) SG(server_context
))->uri
, track_vars_array TSRMLS_CC
);
419 /* {{{ php_apache_startup
421 static int php_apache_startup(sapi_module_struct
*sapi_module
)
423 if (php_module_startup(sapi_module
, &apache_module_entry
, 1) == FAILURE
) {
431 /* {{{ php_apache_log_message
433 static void php_apache_log_message(char *message TSRMLS_DC
)
435 if (SG(server_context
)) {
436 #if MODULE_MAGIC_NUMBER >= 19970831
437 aplog_error(NULL
, 0, APLOG_ERR
| APLOG_NOERRNO
, ((request_rec
*) SG(server_context
))->server
, "%s", message
);
439 log_error(message
, ((request_rec
*) SG(server_context
))->server
);
442 fprintf(stderr
, "%s", message
);
443 fprintf(stderr
, "\n");
448 /* {{{ php_apache_request_shutdown
450 static void php_apache_request_shutdown(void *dummy
)
453 AP(current_hook
) = AP_CLEANUP
;
454 php_output_set_status(PHP_OUTPUT_DISABLED TSRMLS_CC
);
455 SG(server_context
) = NULL
; /* The server context (request) is invalid by the time run_cleanups() is called */
456 if(SG(sapi_started
)) {
457 php_request_shutdown(dummy
);
458 SG(sapi_started
) = 0;
464 AP(current_hook
) = AP_WAITING_FOR_REQUEST
;
465 AP(headers_sent
) = 0;
469 /* {{{ php_apache_sapi_activate
471 static int php_apache_sapi_activate(TSRMLS_D
)
473 request_rec
*r
= (request_rec
*) SG(server_context
);
476 * For the Apache module version, this bit of code registers a cleanup
477 * function that gets triggered when our request pool is destroyed.
478 * We need this because at any point in our code we can be interrupted
479 * and that may happen before we have had time to free our memory.
480 * The php_request_shutdown function needs to free all outstanding allocated
484 register_cleanup(r
->pool
, NULL
, php_apache_request_shutdown
, php_request_shutdown_for_exec
);
488 /* Override the default headers_only value - sometimes "GET" requests should actually only
491 SG(request_info
).headers_only
= r
->header_only
;
496 /* {{{ php_apache_get_stat
498 static struct stat
*php_apache_get_stat(TSRMLS_D
)
500 return &((request_rec
*) SG(server_context
))->finfo
;
504 /* {{{ php_apache_getenv
506 static char *php_apache_getenv(char *name
, size_t name_len TSRMLS_DC
)
508 return (char *) table_get(((request_rec
*) SG(server_context
))->subprocess_env
, name
);
512 /* {{{ sapi_module_struct apache_sapi_module
514 static sapi_module_struct apache_sapi_module
= {
516 "Apache", /* pretty name */
518 php_apache_startup
, /* startup */
519 php_module_shutdown_wrapper
, /* shutdown */
521 php_apache_sapi_activate
, /* activate */
522 NULL
, /* deactivate */
524 sapi_apache_ub_write
, /* unbuffered write */
525 sapi_apache_flush
, /* flush */
526 php_apache_get_stat
, /* get uid */
527 php_apache_getenv
, /* getenv */
529 php_error
, /* error handler */
531 sapi_apache_header_handler
, /* header handler */
532 sapi_apache_send_headers
, /* send headers handler */
533 NULL
, /* send header handler */
535 sapi_apache_read_post
, /* read POST data */
536 sapi_apache_read_cookies
, /* read Cookies */
538 sapi_apache_register_server_variables
, /* register server variables */
539 php_apache_log_message
, /* Log message */
540 NULL
, /* Get request time */
541 NULL
, /* child terminate */
543 NULL
, /* php.ini path override */
549 block_alarms
, /* Block interruptions */
550 unblock_alarms
, /* Unblock interruptions */
553 NULL
, /* default post reader */
554 NULL
, /* treat data */
555 NULL
, /* exe location */
562 /* {{{ php_restore_umask
564 static void php_restore_umask(void)
570 /* {{{ init_request_info
572 static void init_request_info(TSRMLS_D
)
574 request_rec
*r
= ((request_rec
*) SG(server_context
));
575 char *content_length
= (char *) table_get(r
->subprocess_env
, "CONTENT_LENGTH");
576 const char *authorization
=NULL
;
577 char *tmp
, *tmp_user
;
579 SG(request_info
).query_string
= r
->args
;
580 SG(request_info
).path_translated
= r
->filename
;
581 SG(request_info
).request_uri
= r
->uri
;
582 SG(request_info
).request_method
= (char *)r
->method
;
583 SG(request_info
).proto_num
= r
->proto_num
;
584 SG(request_info
).content_type
= (char *) table_get(r
->subprocess_env
, "CONTENT_TYPE");
585 SG(request_info
).content_length
= (content_length
? atol(content_length
) : 0);
586 SG(sapi_headers
).http_response_code
= r
->status
;
589 authorization
= table_get(r
->headers_in
, "Authorization");
592 SG(request_info
).auth_user
= NULL
;
593 SG(request_info
).auth_password
= NULL
;
595 if (authorization
&& !auth_type(r
)) {
596 if (!strcasecmp(getword(r
->pool
, &authorization
, ' '), "Basic")) {
597 tmp
= uudecode(r
->pool
, authorization
);
598 tmp_user
= getword_nulls_nc(r
->pool
, &tmp
, ':');
600 r
->connection
->user
= pstrdup(r
->connection
->pool
, tmp_user
);
601 r
->connection
->ap_auth_type
= "Basic";
602 SG(request_info
).auth_user
= estrdup(tmp_user
);
605 SG(request_info
).auth_password
= estrdup(tmp
);
607 } else if (!strcasecmp(getword(r
->pool
, &authorization
, ' '), "Digest")) {
608 r
->connection
->ap_auth_type
= "Digest";
609 SG(request_info
).auth_digest
= estrdup(authorization
);
615 /* {{{ php_apache_alter_ini_entries
617 static int php_apache_alter_ini_entries(php_per_dir_entry
*per_dir_entry TSRMLS_DC
)
619 zend_alter_ini_entry(per_dir_entry
->key
, per_dir_entry
->key_length
+1, per_dir_entry
->value
, per_dir_entry
->value_length
, per_dir_entry
->type
, PHP_INI_STAGE_ACTIVATE
);
624 /* {{{ php_apache_get_default_mimetype
626 static char *php_apache_get_default_mimetype(request_rec
*r TSRMLS_DC
)
630 if (SG(default_mimetype
) || SG(default_charset
)) {
631 /* Assume output will be of the default MIME type. Individual
632 scripts may change this later. */
634 tmpmimetype
= sapi_get_default_content_type(TSRMLS_C
);
635 mimetype
= pstrdup(r
->pool
, tmpmimetype
);
638 mimetype
= SAPI_DEFAULT_MIMETYPE
"; charset=" SAPI_DEFAULT_CHARSET
;
646 static int send_php(request_rec
*r
, int display_source_mode
, char *filename
)
649 php_per_dir_config
*per_dir_conf
;
651 if (AP(in_request
)) {
654 fh
.filename
= r
->filename
;
655 fh
.opened_path
= NULL
;
656 fh
.free_filename
= 0;
657 fh
.type
= ZEND_HANDLE_FILENAME
;
659 zend_execute_scripts(ZEND_INCLUDE TSRMLS_CC
, NULL
, 1, &fh
);
665 /* Make sure file exists */
666 if (filename
== NULL
&& r
->finfo
.st_mode
== 0) {
670 per_dir_conf
= (php_per_dir_config
*) get_module_config(r
->per_dir_config
, &php5_module
);
672 zend_hash_apply((HashTable
*) per_dir_conf
->ini_settings
, (apply_func_t
) php_apache_alter_ini_entries TSRMLS_CC
);
675 /* If PHP parser engine has been turned off with an "engine off"
676 * directive, then decline to handle this request
679 r
->content_type
= php_apache_get_default_mimetype(r TSRMLS_CC
);
680 r
->allowed
|= (1 << METHODS
) - 1;
682 zend_ini_deactivate(TSRMLS_C
);
686 if (filename
== NULL
) {
687 filename
= r
->filename
;
690 /* Apache 1.2 has a more complex mechanism for reading POST data */
691 #if MODULE_MAGIC_NUMBER > 19961007
692 if ((retval
= setup_client_block(r
, REQUEST_CHUNKED_ERROR
))) {
694 zend_ini_deactivate(TSRMLS_C
);
700 if (AP(last_modified
)) {
701 #if MODULE_MAGIC_NUMBER < 19970912
702 if ((retval
= set_last_modified(r
, r
->finfo
.st_mtime
))) {
704 zend_ini_deactivate(TSRMLS_C
);
709 update_mtime (r
, r
->finfo
.st_mtime
);
710 set_last_modified(r
);
714 /* Assume output will be of the default MIME type. Individual
715 scripts may change this later in the request. */
716 r
->content_type
= php_apache_get_default_mimetype(r TSRMLS_CC
);
719 hard_timeout("send", r
);
721 SG(server_context
) = r
;
729 init_request_info(TSRMLS_C
);
730 apache_php_module_main(r
, display_source_mode TSRMLS_CC
);
732 /* Done, restore umask, turn off timeout, close file and return */
741 /* {{{ send_parsed_php
743 static int send_parsed_php(request_rec
* r
)
745 int result
= send_php(r
, 0, NULL
);
748 ap_table_setn(r
->notes
, "mod_php_memory_usage",
749 ap_psprintf(r
->pool
, "%u", zend_memory_peak_usage(1 TSRMLS_CC
)));
755 /* {{{ send_parsed_php_source
757 static int send_parsed_php_source(request_rec
* r
)
759 return send_php(r
, 1, NULL
);
764 /* {{{ destroy_per_dir_entry
766 static void destroy_per_dir_entry(php_per_dir_entry
*per_dir_entry
)
768 free(per_dir_entry
->key
);
769 free(per_dir_entry
->value
);
773 /* {{{ copy_per_dir_entry
775 static void copy_per_dir_entry(php_per_dir_entry
*per_dir_entry
)
777 php_per_dir_entry tmp
= *per_dir_entry
;
779 per_dir_entry
->key
= (char *) malloc(tmp
.key_length
+1);
780 memcpy(per_dir_entry
->key
, tmp
.key
, tmp
.key_length
);
781 per_dir_entry
->key
[per_dir_entry
->key_length
] = 0;
783 per_dir_entry
->value
= (char *) malloc(tmp
.value_length
+1);
784 memcpy(per_dir_entry
->value
, tmp
.value
, tmp
.value_length
);
785 per_dir_entry
->value
[per_dir_entry
->value_length
] = 0;
789 /* {{{ should_overwrite_per_dir_entry;
792 static zend_bool
should_overwrite_per_dir_entry(HashTable
*target_ht
, php_per_dir_entry
*orig_per_dir_entry
, zend_hash_key
*hash_key
, void *pData
)
794 php_per_dir_entry
*new_per_dir_entry
;
796 if (zend_hash_find(target_ht
, hash_key
->arKey
, hash_key
->nKeyLength
, (void **) &new_per_dir_entry
)==FAILURE
) {
797 return 1; /* does not exist in dest, copy from source */
800 if (new_per_dir_entry
->type
==PHP_INI_SYSTEM
801 && orig_per_dir_entry
->type
!=PHP_INI_SYSTEM
) {
808 /* {{{ php_destroy_per_server_info
810 static void php_destroy_per_server_info(php_per_server_config
*conf
)
812 php_handler_stack_destroy(&conf
->requires
);
813 php_handler_stack_destroy(&conf
->uri_handlers
);
817 /* {{{ php_destroy_per_dir_info
819 static void php_destroy_per_dir_info(php_per_dir_config
*conf
)
821 zend_hash_destroy(conf
->ini_settings
);
822 php_handler_stack_destroy(&conf
->response_handlers
);
823 php_handler_stack_destroy(&conf
->auth_handlers
);
824 php_handler_stack_destroy(&conf
->access_handlers
);
825 php_handler_stack_destroy(&conf
->type_handlers
);
826 php_handler_stack_destroy(&conf
->fixup_handlers
);
827 php_handler_stack_destroy(&conf
->logger_handlers
);
828 php_handler_stack_destroy(&conf
->post_read_handlers
);
829 php_handler_stack_destroy(&conf
->headers_handlers
);
830 free(conf
->ini_settings
);
834 /* {{{ php_create_server
836 static void *php_create_server(pool
*p
, char *dummy
)
838 php_per_server_config
*conf
;
839 conf
= (php_per_server_config
*) malloc(sizeof(php_per_server_config
));
840 register_cleanup(p
, (void *) conf
, (void (*)(void *)) php_destroy_per_server_info
, (void (*)(void *)) php_destroy_per_server_info
);
842 sapi_stack_init_ex(&conf
->requires
, 1);
843 sapi_stack_init_ex(&conf
->uri_handlers
, 1);
850 /* {{{ php_create_dir
852 static void *php_create_dir(pool
*p
, char *dummy
)
854 php_per_dir_config
*conf
;
855 conf
= (php_per_dir_config
*) malloc(sizeof(php_per_dir_config
));
856 conf
->ini_settings
= (HashTable
*) malloc(sizeof(HashTable
));
857 zend_hash_init_ex(conf
->ini_settings
, 5, NULL
, (void (*)(void *)) destroy_per_dir_entry
, 1, 0);
858 sapi_stack_init_ex(&conf
->response_handlers
, 1);
859 sapi_stack_init_ex(&conf
->headers_handlers
, 1);
860 sapi_stack_init_ex(&conf
->auth_handlers
, 1);
861 sapi_stack_init_ex(&conf
->access_handlers
, 1);
862 sapi_stack_init_ex(&conf
->type_handlers
, 1);
863 sapi_stack_init_ex(&conf
->fixup_handlers
, 1);
864 sapi_stack_init_ex(&conf
->logger_handlers
, 1);
865 sapi_stack_init_ex(&conf
->post_read_handlers
, 1);
866 register_cleanup(p
, (void *) conf
, (void (*)(void *)) php_destroy_per_dir_info
, (void (*)(void *)) php_destroy_per_dir_info
);
875 static void *php_merge_dir(pool
*p
, void *basev
, void *addv
)
877 php_per_dir_config
*a
= (php_per_dir_config
*) addv
;
878 php_per_dir_config
*b
= (php_per_dir_config
*) basev
;
879 /* This function *must* return addv, and not modify basev */
880 zend_hash_merge_ex((HashTable
*) a
->ini_settings
, (HashTable
*) b
->ini_settings
, (copy_ctor_func_t
) copy_per_dir_entry
, sizeof(php_per_dir_entry
), (merge_checker_func_t
) should_overwrite_per_dir_entry
, NULL
);
881 a
->headers_handlers
= (a
->headers_handlers
.top
)?a
->headers_handlers
:b
->headers_handlers
;
882 a
->auth_handlers
= (a
->auth_handlers
.top
)?a
->auth_handlers
:b
->auth_handlers
;
883 a
->access_handlers
= (a
->access_handlers
.top
)?a
->access_handlers
:b
->access_handlers
;
884 a
->type_handlers
= (a
->type_handlers
.top
)?a
->type_handlers
:b
->type_handlers
;
885 a
->fixup_handlers
= (a
->fixup_handlers
.top
)?a
->fixup_handlers
:b
->fixup_handlers
;
886 a
->logger_handlers
= (a
->logger_handlers
.top
)?a
->logger_handlers
:b
->logger_handlers
;
887 a
->post_read_handlers
= (a
->post_read_handlers
.top
)?a
->post_read_handlers
:b
->post_read_handlers
;
888 a
->response_handlers
= (a
->response_handlers
.top
)?a
->response_handlers
:b
->response_handlers
;
893 /* {{{ php_apache_value_handler_ex
895 static CONST_PREFIX
char *php_apache_value_handler_ex(cmd_parms
*cmd
, HashTable
*conf
, char *arg1
, char *arg2
, int mode
)
897 php_per_dir_entry per_dir_entry
;
899 if (!apache_php_initialized
) {
900 apache_php_initialized
= 1;
902 tsrm_startup(1, 1, 0, NULL
);
904 sapi_startup(&apache_sapi_module
);
905 php_apache_startup(&apache_sapi_module
);
907 per_dir_entry
.type
= mode
;
909 if (strcasecmp(arg2
, "none") == 0) {
913 per_dir_entry
.key_length
= strlen(arg1
);
914 per_dir_entry
.value_length
= strlen(arg2
);
916 per_dir_entry
.key
= (char *) malloc(per_dir_entry
.key_length
+1);
917 memcpy(per_dir_entry
.key
, arg1
, per_dir_entry
.key_length
);
918 per_dir_entry
.key
[per_dir_entry
.key_length
] = 0;
920 per_dir_entry
.value
= (char *) malloc(per_dir_entry
.value_length
+1);
921 memcpy(per_dir_entry
.value
, arg2
, per_dir_entry
.value_length
);
922 per_dir_entry
.value
[per_dir_entry
.value_length
] = 0;
924 zend_hash_update(conf
, per_dir_entry
.key
, per_dir_entry
.key_length
, &per_dir_entry
, sizeof(php_per_dir_entry
), NULL
);
929 static CONST_PREFIX
char *php_set_server_handler(server_rec
*s
, char *arg1
, long handler_stage
, long handler_type
)
931 php_per_server_config
*conf
;
932 php_handler
*handler
;
933 handler
= (php_handler
*) malloc(sizeof(php_handler
));
934 handler
->type
= handler_type
;
935 handler
->stage
= handler_stage
;
936 handler
->name
= strdup(arg1
);
937 conf
= get_module_config(s
->module_config
, &php5_module
);
938 switch(handler_stage
) {
940 sapi_stack_push(&conf
->uri_handlers
, handler
);
943 sapi_stack_push(&conf
->requires
, handler
);
949 static CONST_PREFIX
char *php_set_dir_handler(php_per_dir_config
*conf
, char *arg1
, long handler_stage
, long handler_type
)
951 php_handler
*handler
;
952 handler
= (php_handler
*) malloc(sizeof(php_handler
));
953 handler
->type
= handler_type
;
954 handler
->stage
= handler_stage
;
955 handler
->name
= strdup(arg1
);
956 switch(handler_stage
) {
958 sapi_stack_push(&conf
->post_read_handlers
, handler
);
960 case AP_HEADER_PARSE
:
961 sapi_stack_push(&conf
->headers_handlers
, handler
);
963 case AP_ACCESS_CONTROL
:
964 sapi_stack_push(&conf
->access_handlers
, handler
);
966 case AP_AUTHENTICATION
:
967 sapi_stack_push(&conf
->auth_handlers
, handler
);
969 case AP_AUTHORIZATION
:
971 case AP_TYPE_CHECKING
:
972 sapi_stack_push(&conf
->type_handlers
, handler
);
975 sapi_stack_push(&conf
->fixup_handlers
, handler
);
978 sapi_stack_push(&conf
->response_handlers
, handler
);
981 sapi_stack_push(&conf
->logger_handlers
, handler
);
989 /* {{{ php_set_uri_handler
991 static CONST_PREFIX
char *php_set_uri_handler(cmd_parms
*cmd
, void *dummy
, char *arg1
)
993 return php_set_server_handler(cmd
->server
, arg1
, AP_URI_TRANS
, AP_HANDLER_TYPE_FILE
);
997 /* {{{ php_set_uri_handler_code */
998 static CONST_PREFIX
char *php_set_uri_handler_code(cmd_parms
*cmd
, void *dummy
, char *arg1
)
1000 return php_set_server_handler(cmd
->server
, arg1
, AP_URI_TRANS
, AP_HANDLER_TYPE_METHOD
);
1004 /* {{{ php_set_header_handler
1006 static CONST_PREFIX
char *php_set_header_handler(cmd_parms
*cmd
, php_per_dir_config
*conf
, char *arg1
)
1008 return php_set_dir_handler(conf
, arg1
, AP_HEADER_PARSE
, AP_HANDLER_TYPE_FILE
);
1010 static CONST_PREFIX
char *php_set_header_handler_code(cmd_parms
*cmd
, php_per_dir_config
*conf
, char *arg1
)
1012 return php_set_dir_handler(conf
, arg1
, AP_HEADER_PARSE
, AP_HANDLER_TYPE_METHOD
);
1016 /* {{{ php_set_auth_handler
1018 static CONST_PREFIX
char *php_set_auth_handler(cmd_parms
*cmd
, php_per_dir_config
*conf
, char *arg1
)
1020 return php_set_dir_handler(conf
, arg1
, AP_AUTHENTICATION
, AP_HANDLER_TYPE_FILE
);
1022 static CONST_PREFIX
char *php_set_auth_handler_code(cmd_parms
*cmd
, php_per_dir_config
*conf
, char *arg1
)
1024 return php_set_dir_handler(conf
, arg1
, AP_AUTHENTICATION
, AP_HANDLER_TYPE_METHOD
);
1029 /* {{{ php_set_access_handler
1031 static CONST_PREFIX
char *php_set_access_handler(cmd_parms
*cmd
, php_per_dir_config
*conf
, char *arg1
)
1033 return php_set_dir_handler(conf
, arg1
, AP_ACCESS_CONTROL
, AP_HANDLER_TYPE_FILE
);
1035 static CONST_PREFIX
char *php_set_access_handler_code(cmd_parms
*cmd
, php_per_dir_config
*conf
, char *arg1
)
1037 return php_set_dir_handler(conf
, arg1
, AP_ACCESS_CONTROL
, AP_HANDLER_TYPE_METHOD
);
1042 /* {{{ php_set_type_handler
1044 static CONST_PREFIX
char *php_set_type_handler(cmd_parms
*cmd
, php_per_dir_config
*conf
, char *arg1
)
1046 return php_set_dir_handler(conf
, arg1
, AP_TYPE_CHECKING
, AP_HANDLER_TYPE_FILE
);
1048 static CONST_PREFIX
char *php_set_type_handler_code(cmd_parms
*cmd
, php_per_dir_config
*conf
, char *arg1
)
1050 return php_set_dir_handler(conf
, arg1
, AP_TYPE_CHECKING
, AP_HANDLER_TYPE_METHOD
);
1055 /* {{{ php_set_fixup_handler
1057 static CONST_PREFIX
char *php_set_fixup_handler(cmd_parms
*cmd
, php_per_dir_config
*conf
, char *arg1
)
1059 return php_set_dir_handler(conf
, arg1
, AP_FIXUP
, AP_HANDLER_TYPE_FILE
);
1061 static CONST_PREFIX
char *php_set_fixup_handler_code(cmd_parms
*cmd
, php_per_dir_config
*conf
, char *arg1
)
1063 return php_set_dir_handler(conf
, arg1
, AP_FIXUP
, AP_HANDLER_TYPE_METHOD
);
1067 /* {{{ php_set_logger_handler
1069 static CONST_PREFIX
char *php_set_logger_handler(cmd_parms
*cmd
, php_per_dir_config
*conf
, char *arg1
)
1071 return php_set_dir_handler(conf
, arg1
, AP_LOGGING
, AP_HANDLER_TYPE_FILE
);
1073 static CONST_PREFIX
char *php_set_logger_handler_code(cmd_parms
*cmd
, php_per_dir_config
*conf
, char *arg1
)
1075 return php_set_dir_handler(conf
, arg1
, AP_LOGGING
, AP_HANDLER_TYPE_METHOD
);
1080 /* {{{ php_set_post_read_handler
1082 static CONST_PREFIX
char *php_set_post_read_handler(cmd_parms
*cmd
, php_per_dir_config
*conf
, char *arg1
)
1084 return php_set_dir_handler(conf
, arg1
, AP_POST_READ
, AP_HANDLER_TYPE_FILE
);
1086 static CONST_PREFIX
char *php_set_post_read_handler_code(cmd_parms
*cmd
, php_per_dir_config
*conf
, char *arg1
)
1088 return php_set_dir_handler(conf
, arg1
, AP_POST_READ
, AP_HANDLER_TYPE_METHOD
);
1094 /* {{{ php_set_require
1097 static CONST_PREFIX
char *php_set_require(cmd_parms
*cmd
, void *dummy
, char *arg1
)
1099 return php_set_server_handler(cmd
->server
, arg1
, 0, AP_HANDLER_TYPE_FILE
);
1103 /* {{{ php_set_response_handler
1105 static CONST_PREFIX
char *php_set_response_handler(cmd_parms
*cmd
, php_per_dir_config
*conf
, char *arg1
)
1107 return php_set_dir_handler(conf
, arg1
, AP_RESPONSE
, AP_HANDLER_TYPE_FILE
);
1109 static CONST_PREFIX
char *php_set_response_handler_code(cmd_parms
*cmd
, php_per_dir_config
*conf
, char *arg1
)
1111 return php_set_dir_handler(conf
, arg1
, AP_RESPONSE
, AP_HANDLER_TYPE_METHOD
);
1115 /* {{{ php_apache_value_handler
1117 static CONST_PREFIX
char *php_apache_value_handler(cmd_parms
*cmd
, php_per_dir_config
*conf
, char *arg1
, char *arg2
)
1119 return php_apache_value_handler_ex(cmd
, conf
->ini_settings
, arg1
, arg2
, PHP_INI_PERDIR
);
1123 /* {{{ php_apache_admin_value_handler
1125 static CONST_PREFIX
char *php_apache_admin_value_handler(cmd_parms
*cmd
, php_per_dir_config
*conf
, char *arg1
, char *arg2
)
1127 return php_apache_value_handler_ex(cmd
, conf
->ini_settings
, arg1
, arg2
, PHP_INI_SYSTEM
);
1131 /* {{{ php_apache_flag_handler_ex
1133 static CONST_PREFIX
char *php_apache_flag_handler_ex(cmd_parms
*cmd
, HashTable
*conf
, char *arg1
, char *arg2
, int mode
)
1137 if (!strcasecmp(arg2
, "On")) {
1144 return php_apache_value_handler_ex(cmd
, conf
, arg1
, bool_val
, mode
);
1148 /* {{{ php_apache_flag_handler
1150 static CONST_PREFIX
char *php_apache_flag_handler(cmd_parms
*cmd
, php_per_dir_config
*conf
, char *arg1
, char *arg2
)
1152 return php_apache_flag_handler_ex(cmd
, conf
->ini_settings
, arg1
, arg2
, PHP_INI_PERDIR
);
1156 /* {{{ php_apache_admin_flag_handler
1158 static CONST_PREFIX
char *php_apache_admin_flag_handler(cmd_parms
*cmd
, php_per_dir_config
*conf
, char *arg1
, char *arg2
)
1160 return php_apache_flag_handler_ex(cmd
, conf
->ini_settings
, arg1
, arg2
, PHP_INI_SYSTEM
);
1164 /* {{{ php_apache_phpini_set
1166 static CONST_PREFIX
char *php_apache_phpini_set(cmd_parms
*cmd
, HashTable
*conf
, char *arg
)
1168 if (apache_sapi_module
.php_ini_path_override
) {
1169 return "Only first PHPINIDir directive honored per configuration tree - subsequent ones ignored";
1171 apache_sapi_module
.php_ini_path_override
= ap_server_root_relative(cmd
->pool
, arg
);
1176 /* {{{ int php_xbithack_handler(request_rec * r)
1178 static int php_xbithack_handler(request_rec
* r
)
1180 php_per_dir_config
*conf
;
1183 if (!(r
->finfo
.st_mode
& S_IXUSR
)) {
1184 r
->allowed
|= (1 << METHODS
) - 1;
1187 conf
= (php_per_dir_config
*) get_module_config(r
->per_dir_config
, &php5_module
);
1189 zend_hash_apply((HashTable
*) conf
->ini_settings
, (apply_func_t
) php_apache_alter_ini_entries TSRMLS_CC
);
1192 r
->allowed
|= (1 << METHODS
) - 1;
1194 zend_ini_deactivate(TSRMLS_C
);
1198 return send_parsed_php(r
);
1202 /* {{{ apache_php_module_shutdown_wrapper
1204 static void apache_php_module_shutdown_wrapper(void)
1206 apache_php_initialized
= 0;
1207 apache_sapi_module
.shutdown(&apache_sapi_module
);
1209 #if MODULE_MAGIC_NUMBER >= 19970728
1210 /* This function is only called on server exit if the apache API
1211 * child_exit handler exists, so shutdown globally
1222 #if MODULE_MAGIC_NUMBER >= 19970728
1223 /* {{{ php_child_exit_handler
1225 static void php_child_exit_handler(server_rec
*s
, pool
*p
)
1227 /* apache_php_initialized = 0; */
1228 apache_sapi_module
.shutdown(&apache_sapi_module
);
1237 /* {{{ void php_init_handler(server_rec *s, pool *p)
1239 static void php_init_handler(server_rec
*s
, pool
*p
)
1241 register_cleanup(p
, NULL
, (void (*)(void *))apache_php_module_shutdown_wrapper
, (void (*)(void *))php_module_shutdown_for_exec
);
1242 if (!apache_php_initialized
) {
1243 apache_php_initialized
= 1;
1245 tsrm_startup(1, 1, 0, NULL
);
1247 sapi_startup(&apache_sapi_module
);
1248 php_apache_startup(&apache_sapi_module
);
1250 #if MODULE_MAGIC_NUMBER >= 19980527
1253 if (PG(expose_php
)) {
1254 ap_add_version_component("PHP/" PHP_VERSION
);
1261 static int php_run_hook(php_handler
*handler
, request_rec
*r
)
1264 php_per_dir_config
*conf
;
1268 if(!AP(apache_config_loaded
)) {
1269 conf
= (php_per_dir_config
*) get_module_config(r
->per_dir_config
, &php5_module
);
1271 zend_hash_apply((HashTable
*)conf
->ini_settings
, (apply_func_t
) php_apache_alter_ini_entries TSRMLS_CC
);
1272 AP(apache_config_loaded
) = 1;
1274 if (!handler
->name
) {
1278 if (!AP(setup_env
)) {
1283 SG(server_context
) = r
;
1284 init_request_info(TSRMLS_C
);
1285 apache_php_module_hook(r
, handler
, &ret TSRMLS_CC
);
1286 php_restore_umask();
1289 convert_to_long(ret
);
1290 return Z_LVAL_P(ret
);
1292 return HTTP_INTERNAL_SERVER_ERROR
;
1296 static int php_uri_translation(request_rec
*r
)
1298 php_per_server_config
*conf
;
1300 AP(current_hook
) = AP_URI_TRANS
;
1301 conf
= (php_per_server_config
*) get_module_config(r
->server
->module_config
, &php5_module
);
1302 return sapi_stack_apply_with_argument_stop_if_equals(&conf
->uri_handlers
,
1303 ZEND_STACK_APPLY_BOTTOMUP
,
1304 (int (*)(void *element
, void *)) php_run_hook
, r
, OK
);
1307 static int php_header_hook(request_rec
*r
)
1309 php_per_dir_config
*conf
;
1311 AP(current_hook
) = AP_HEADER_PARSE
;
1312 conf
= (php_per_dir_config
*) get_module_config(r
->per_dir_config
, &php5_module
);
1313 return sapi_stack_apply_with_argument_stop_if_http_error(&conf
->headers_handlers
,
1314 ZEND_STACK_APPLY_BOTTOMUP
,
1315 (int (*)(void *element
, void *)) php_run_hook
, r
);
1318 static int php_auth_hook(request_rec
*r
)
1320 php_per_dir_config
*conf
;
1322 AP(current_hook
) = AP_AUTHENTICATION
;
1323 conf
= (php_per_dir_config
*) get_module_config(r
->per_dir_config
, &php5_module
);
1324 return sapi_stack_apply_with_argument_stop_if_equals(&conf
->auth_handlers
,
1325 ZEND_STACK_APPLY_BOTTOMUP
,
1326 (int (*)(void *element
, void *)) php_run_hook
, r
, OK
);
1329 static int php_access_hook(request_rec
*r
)
1331 php_per_dir_config
*conf
;
1332 int status
= DECLINED
;
1334 AP(current_hook
) = AP_ACCESS_CONTROL
;
1335 conf
= (php_per_dir_config
*) get_module_config(r
->per_dir_config
, &php5_module
);
1336 status
= sapi_stack_apply_with_argument_stop_if_http_error(&conf
->access_handlers
,
1337 ZEND_STACK_APPLY_BOTTOMUP
,
1338 (int (*)(void *element
, void *)) php_run_hook
, r
);
1343 static int php_type_hook(request_rec
*r
)
1345 php_per_dir_config
*conf
;
1347 AP(current_hook
) = AP_TYPE_CHECKING
;
1348 conf
= (php_per_dir_config
*) get_module_config(r
->per_dir_config
, &php5_module
);
1349 return sapi_stack_apply_with_argument_stop_if_equals(&conf
->type_handlers
,
1350 ZEND_STACK_APPLY_BOTTOMUP
,
1351 (int (*)(void *element
, void *)) php_run_hook
,
1355 static int php_fixup_hook(request_rec
*r
)
1357 php_per_dir_config
*conf
;
1359 AP(current_hook
) = AP_FIXUP
;
1360 conf
= (php_per_dir_config
*) get_module_config(r
->per_dir_config
, &php5_module
);
1361 return sapi_stack_apply_with_argument_stop_if_http_error(&conf
->fixup_handlers
,
1362 ZEND_STACK_APPLY_BOTTOMUP
,
1363 (int (*)(void *element
, void *)) php_run_hook
,
1367 static int php_logger_hook(request_rec
*r
)
1369 php_per_dir_config
*conf
;
1371 AP(current_hook
) = AP_LOGGING
;
1372 conf
= (php_per_dir_config
*) get_module_config(r
->per_dir_config
, &php5_module
);
1373 return sapi_stack_apply_with_argument_stop_if_http_error(&conf
->logger_handlers
,
1374 ZEND_STACK_APPLY_BOTTOMUP
,
1375 (int (*)(void *element
, void *)) php_run_hook
,
1379 static int php_post_read_hook(request_rec
*r
)
1381 php_per_dir_config
*conf
;
1382 php_per_server_config
*svr
;
1384 AP(current_hook
) = AP_POST_READ
;
1385 svr
= get_module_config(r
->server
->module_config
, &php5_module
);
1386 if(ap_is_initial_req(r
)) {
1387 sapi_stack_apply_with_argument_all(&svr
->requires
, ZEND_STACK_APPLY_BOTTOMUP
, (int (*)(void *element
, void *)) php_run_hook
, r
);
1389 conf
= (php_per_dir_config
*) get_module_config(r
->per_dir_config
, &php5_module
);
1390 return sapi_stack_apply_with_argument_stop_if_http_error(&conf
->post_read_handlers
,
1391 ZEND_STACK_APPLY_BOTTOMUP
,
1392 (int (*)(void *element
, void *)) php_run_hook
, r
);
1395 static int php_response_handler(request_rec
*r
)
1397 php_per_dir_config
*conf
;
1399 AP(current_hook
) = AP_RESPONSE
;
1400 conf
= (php_per_dir_config
*) get_module_config(r
->per_dir_config
, &php5_module
);
1401 return sapi_stack_apply_with_argument_all(&conf
->response_handlers
, ZEND_STACK_APPLY_BOTTOMUP
, (int (*)(void *element
, void *)) php_run_hook
, r
);
1404 /* {{{ handler_rec php_handlers[]
1406 handler_rec php_handlers
[] =
1408 {"application/x-httpd-php", send_parsed_php
},
1409 {"application/x-httpd-php-source", send_parsed_php_source
},
1410 {"text/html", php_xbithack_handler
},
1411 {"php-script", php_response_handler
},
1416 /* {{{ command_rec php_commands[]
1418 command_rec php_commands
[] =
1420 {"php_value", php_apache_value_handler
, NULL
, OR_OPTIONS
, TAKE2
, "PHP Value Modifier"},
1421 {"phpUriHandler", php_set_uri_handler
, NULL
, RSRC_CONF
, TAKE1
, "PHP Value Modifier"},
1422 {"phpUriHandlerMethod", php_set_uri_handler_code
, NULL
, RSRC_CONF
, TAKE1
, "PHP Value Modifier"},
1423 #if MODULE_MAGIC_NUMBER >= 19970103
1424 {"phpHeaderHandler", php_set_header_handler
, NULL
, OR_OPTIONS
, TAKE1
, "PHP Value Modifier"},
1425 {"phpHeaderHandlerMethod", php_set_header_handler_code
, NULL
, OR_OPTIONS
, TAKE1
, "PHP Value Modifier"},
1427 {"phpAuthHandler", php_set_auth_handler
, NULL
, OR_OPTIONS
, TAKE1
, "PHP Value Modifier"},
1428 {"phpAuthHandlerMethod", php_set_auth_handler_code
, NULL
, OR_OPTIONS
, TAKE1
, "PHP Value Modifier"},
1429 {"phpAccessHandler", php_set_access_handler
, NULL
, OR_OPTIONS
, TAKE1
, "PHP Value Modifier"},
1430 {"phpAccessHandlerMethod", php_set_access_handler_code
, NULL
, OR_OPTIONS
, TAKE1
, "PHP Value Modifier"},
1431 {"phpTypeHandler", php_set_type_handler
, NULL
, OR_OPTIONS
, TAKE1
, "PHP Value Modifier"},
1432 {"phpTypeHandlerMethod", php_set_type_handler_code
, NULL
, OR_OPTIONS
, TAKE1
, "PHP Value Modifier"},
1433 {"phpFixupHandler", php_set_fixup_handler
, NULL
, OR_OPTIONS
, TAKE1
, "PHP Value Modifier"},
1434 {"phpFixupHandlerMethod", php_set_fixup_handler_code
, NULL
, OR_OPTIONS
, TAKE1
, "PHP Value Modifier"},
1435 {"phpLoggerHandler", php_set_logger_handler
, NULL
, OR_OPTIONS
, TAKE1
, "PHP Value Modifier"},
1436 {"phpLoggerHandlerMethod", php_set_logger_handler_code
, NULL
, OR_OPTIONS
, TAKE1
, "PHP Value Modifier"},
1437 #if MODULE_MAGIC_NUMBER >= 19970902
1438 {"phpPostReadHandler", php_set_post_read_handler
, NULL
, OR_OPTIONS
, TAKE1
, "PHP Value Modifier"},
1439 {"phpPostReadHandlerMethod", php_set_post_read_handler_code
, NULL
, OR_OPTIONS
, TAKE1
, "PHP Value Modifier"},
1440 {"phpRequire", php_set_require
, NULL
, OR_OPTIONS
, TAKE1
, "PHP Value Modifier"},
1441 {"phpResponseHandler", php_set_response_handler
, NULL
, OR_OPTIONS
, TAKE1
, "PHP Value Modifier"},
1442 {"phpResponseHandlerMethod", php_set_response_handler_code
, NULL
, OR_OPTIONS
, TAKE1
, "PHP Value Modifier"},
1444 {"php_flag", php_apache_flag_handler
, NULL
, OR_OPTIONS
, TAKE2
, "PHP Flag Modifier"},
1445 {"php_admin_value", php_apache_admin_value_handler
, NULL
, ACCESS_CONF
|RSRC_CONF
, TAKE2
, "PHP Value Modifier (Admin)"},
1446 {"php_admin_flag", php_apache_admin_flag_handler
, NULL
, ACCESS_CONF
|RSRC_CONF
, TAKE2
, "PHP Flag Modifier (Admin)"},
1447 {"PHPINIDir", php_apache_phpini_set
, NULL
, RSRC_CONF
, TAKE1
, "Directory containing the php.ini file"},
1452 /* {{{ module MODULE_VAR_EXPORT php5_module
1454 module MODULE_VAR_EXPORT php5_module
=
1456 STANDARD_MODULE_STUFF
,
1457 php_init_handler
, /* initializer */
1458 php_create_dir
, /* per-directory config creator */
1459 php_merge_dir
, /* dir merger */
1460 php_create_server
, /* per-server config creator */
1461 NULL
, /* merge server config */
1462 php_commands
, /* command table */
1463 php_handlers
, /* handlers */
1464 php_uri_translation
, /* filename translation */
1465 NULL
, /* check_user_id */
1466 php_auth_hook
, /* check auth */
1467 php_access_hook
, /* check access */
1468 php_type_hook
, /* type_checker */
1469 php_fixup_hook
, /* fixups */
1470 php_logger_hook
/* logger */
1471 #if MODULE_MAGIC_NUMBER >= 19970103
1472 , php_header_hook
/* header parser */
1474 #if MODULE_MAGIC_NUMBER >= 19970719
1475 , NULL
/* child_init */
1477 #if MODULE_MAGIC_NUMBER >= 19970728
1478 , php_child_exit_handler
/* child_exit */
1480 #if MODULE_MAGIC_NUMBER >= 19970902
1481 , php_post_read_hook
/* post read-request */
1491 * vim600: sw=4 ts=4 fdm=marker
1492 * vim<600: sw=4 ts=4