2003-02-11 17:40:11 +00:00
|
|
|
/*
|
|
|
|
+----------------------------------------------------------------------+
|
2014-09-18 17:25:23 +00:00
|
|
|
| PHP Version 7 |
|
2003-02-11 17:40:11 +00:00
|
|
|
+----------------------------------------------------------------------+
|
2015-01-15 15:27:30 +00:00
|
|
|
| Copyright (c) 1997-2015 The PHP Group |
|
2003-02-11 17:40:11 +00:00
|
|
|
+----------------------------------------------------------------------+
|
2006-01-01 12:51:34 +00:00
|
|
|
| This source file is subject to version 3.01 of the PHP license, |
|
2003-02-11 17:40:11 +00:00
|
|
|
| that is bundled with this package in the file LICENSE, and is |
|
2003-06-10 20:04:29 +00:00
|
|
|
| available through the world-wide-web at the following url: |
|
2006-01-01 12:51:34 +00:00
|
|
|
| http://www.php.net/license/3_01.txt |
|
2003-02-11 17:40:11 +00:00
|
|
|
| If you did not receive a copy of the PHP license and are unable to |
|
|
|
|
| obtain it through the world-wide-web, please send a note to |
|
|
|
|
| license@php.net so we can mail you a copy immediately. |
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| Author: Sascha Schumann <sascha@schumann.cx> |
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
#ifndef PHP_APACHE_H
|
|
|
|
#define PHP_APACHE_H
|
|
|
|
|
|
|
|
#include "httpd.h"
|
|
|
|
#include "http_config.h"
|
|
|
|
#include "http_core.h"
|
|
|
|
|
2014-08-19 21:39:22 +00:00
|
|
|
#include "php.h"
|
|
|
|
#include "main/php_streams.h"
|
|
|
|
|
2003-02-11 17:40:11 +00:00
|
|
|
/* Declare this so we can get to it from outside the sapi_apache2.c file */
|
2014-09-18 17:25:23 +00:00
|
|
|
extern module AP_MODULE_DECLARE_DATA php7_module;
|
2003-02-11 17:40:11 +00:00
|
|
|
|
|
|
|
/* A way to specify the location of the php.ini dir in an apache directive */
|
|
|
|
extern char *apache2_php_ini_path_override;
|
|
|
|
|
|
|
|
/* The server_context used by PHP */
|
|
|
|
typedef struct php_struct {
|
|
|
|
int state;
|
|
|
|
request_rec *r;
|
2003-02-20 18:20:03 +00:00
|
|
|
apr_bucket_brigade *brigade;
|
|
|
|
/* stat structure of the current file */
|
2003-02-11 17:40:11 +00:00
|
|
|
#if defined(NETWARE) && defined(CLIB_STAT_PATCH)
|
|
|
|
struct stat_libc finfo;
|
|
|
|
#else
|
2014-08-25 18:22:49 +00:00
|
|
|
zend_stat_t finfo;
|
2003-02-11 17:40:11 +00:00
|
|
|
#endif
|
|
|
|
/* Whether or not we've processed PHP in the output filters yet. */
|
|
|
|
int request_processed;
|
2006-05-28 20:32:00 +00:00
|
|
|
/* final content type */
|
|
|
|
char *content_type;
|
2003-02-11 17:40:11 +00:00
|
|
|
} php_struct;
|
|
|
|
|
|
|
|
void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf);
|
|
|
|
void *create_php_config(apr_pool_t *p, char *dummy);
|
|
|
|
char *get_php_config(void *conf, char *name, size_t name_len);
|
|
|
|
void apply_config(void *);
|
|
|
|
extern const command_rec php_dir_cmds[];
|
2003-10-21 11:48:31 +00:00
|
|
|
void php_ap2_register_hook(apr_pool_t *p);
|
2003-02-11 17:40:11 +00:00
|
|
|
|
|
|
|
#define APR_ARRAY_FOREACH_OPEN(arr, key, val) \
|
|
|
|
{ \
|
|
|
|
apr_table_entry_t *elts; \
|
|
|
|
int i; \
|
|
|
|
elts = (apr_table_entry_t *) arr->elts; \
|
|
|
|
for (i = 0; i < arr->nelts; i++) { \
|
|
|
|
key = elts[i].key; \
|
|
|
|
val = elts[i].val;
|
|
|
|
|
|
|
|
#define APR_ARRAY_FOREACH_CLOSE() }}
|
|
|
|
|
2003-03-07 13:45:33 +00:00
|
|
|
typedef struct {
|
2014-12-15 12:49:46 +00:00
|
|
|
zend_bool engine;
|
|
|
|
zend_bool xbithack;
|
|
|
|
zend_bool last_modified;
|
2003-03-07 13:45:33 +00:00
|
|
|
} php_apache2_info_struct;
|
|
|
|
|
|
|
|
extern zend_module_entry apache2_module_entry;
|
|
|
|
|
|
|
|
#ifdef ZTS
|
reworked the patch, less new stuff but worky
TLS is already used in TSRM, the way exporting the tsrm cache through
a thread local variable is not portable. Additionally, the current
patch suffers from bugs which are hard to find, but prevent it to
be worky with apache. What is done here is mainly uses the idea
from the RFC patch, but
- __thread variable is removed
- offset math and declarations are removed
- extra macros and definitions are removed
What is done merely is
- use an inline function to access the tsrm cache. The function uses
the portable tsrm_tls_get macro which is cheap
- all the TSRM_* macros are set to placebo. Thus this opens the way
remove them later
Except that, the logic is old. TSRMLS_FETCH will have to be done once
per thread, then tsrm_get_ls_cache() can be used. Things seeming to be
worky are cli, cli server and apache. I also tried to enable bz2
shared and it has worked out of the box. The change is yet minimal
diffing to the current master bus is a worky start, IMHO. Though will
have to recheck the other previously done SAPIs - embed and cgi.
The offsets can be added to the tsrm_resource_type struct, then
it'll not be needed to declare them in the userspace. Even the
"done" member type can be changed to int16 or smaller, then adding
the offset as int16 will not change the struct size. As well on the
todo might be removing the hashed storage, thread_id != thread_id and
linked list logic in favour of the explicit TLS operations.
2014-09-25 16:48:27 +00:00
|
|
|
extern int php_apache2_info_id;
|
2014-10-15 14:33:40 +00:00
|
|
|
#define AP2(v) ZEND_TSRMG(php_apache2_info_id, php_apache2_info_struct *, v)
|
2015-02-16 16:19:32 +00:00
|
|
|
ZEND_TSRMLS_CACHE_EXTERN();
|
2003-03-07 13:45:33 +00:00
|
|
|
#else
|
|
|
|
extern php_apache2_info_struct php_apache2_info;
|
|
|
|
#define AP2(v) (php_apache2_info.v)
|
|
|
|
#endif
|
|
|
|
|
2008-01-30 09:41:12 +00:00
|
|
|
/* fix for gcc4 visibility patch */
|
|
|
|
#ifndef PHP_WIN32
|
|
|
|
# undef AP_MODULE_DECLARE_DATA
|
|
|
|
# define AP_MODULE_DECLARE_DATA PHPAPI
|
|
|
|
#endif
|
2003-03-07 13:45:33 +00:00
|
|
|
|
2003-02-11 17:40:11 +00:00
|
|
|
#endif /* PHP_APACHE_H */
|