xref: /PHP-7.2/sapi/apache2handler/php_apache.h (revision 7a7ec01a)
1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 7                                                        |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 1997-2018 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 through the world-wide-web at the following url:           |
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    | Author: Sascha Schumann <sascha@schumann.cx>                         |
16    +----------------------------------------------------------------------+
17  */
18 
19 /* $Id$ */
20 
21 #ifndef PHP_APACHE_H
22 #define PHP_APACHE_H
23 
24 #include "httpd.h"
25 #include "http_config.h"
26 #include "http_core.h"
27 #include "http_log.h"
28 
29 #include "php.h"
30 #include "main/php_streams.h"
31 
32 /* Enable per-module logging in Apache 2.4+ */
33 #ifdef APLOG_USE_MODULE
34 APLOG_USE_MODULE(php7);
35 #endif
36 
37 /* Declare this so we can get to it from outside the sapi_apache2.c file */
38 extern module AP_MODULE_DECLARE_DATA php7_module;
39 
40 /* A way to specify the location of the php.ini dir in an apache directive */
41 extern char *apache2_php_ini_path_override;
42 
43 /* The server_context used by PHP */
44 typedef struct php_struct {
45 	int state;
46 	request_rec *r;
47 	apr_bucket_brigade *brigade;
48 	/* stat structure of the current file */
49 	zend_stat_t finfo;
50 	/* Whether or not we've processed PHP in the output filters yet. */
51 	int request_processed;
52 	/* final content type */
53 	char *content_type;
54 } php_struct;
55 
56 void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf);
57 void *create_php_config(apr_pool_t *p, char *dummy);
58 char *get_php_config(void *conf, char *name, size_t name_len);
59 void apply_config(void *);
60 extern const command_rec php_dir_cmds[];
61 void php_ap2_register_hook(apr_pool_t *p);
62 
63 #define APR_ARRAY_FOREACH_OPEN(arr, key, val) 		\
64 {													\
65 	apr_table_entry_t *elts;						\
66 	int i;											\
67 	elts = (apr_table_entry_t *) arr->elts;			\
68 	for (i = 0; i < arr->nelts; i++) {				\
69 		key = elts[i].key;							\
70 		val = elts[i].val;
71 
72 #define APR_ARRAY_FOREACH_CLOSE() }}
73 
74 typedef struct {
75 	zend_bool engine;
76 	zend_bool xbithack;
77 	zend_bool last_modified;
78 } php_apache2_info_struct;
79 
80 extern zend_module_entry apache2_module_entry;
81 
82 #ifdef ZTS
83 extern int php_apache2_info_id;
84 #define AP2(v) ZEND_TSRMG(php_apache2_info_id, php_apache2_info_struct *, v)
85 ZEND_TSRMLS_CACHE_EXTERN()
86 #else
87 extern php_apache2_info_struct php_apache2_info;
88 #define AP2(v) (php_apache2_info.v)
89 #endif
90 
91 /* fix for gcc4 visibility patch */
92 #ifndef PHP_WIN32
93 # undef AP_MODULE_DECLARE_DATA
94 # define AP_MODULE_DECLARE_DATA PHPAPI
95 #endif
96 
97 #endif /* PHP_APACHE_H */
98