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