summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--acconfig.h.in3
-rw-r--r--acinclude.m42
-rw-r--r--ext/aspell/aspell.c5
-rw-r--r--ext/db/db.c2
-rw-r--r--ext/ereg/php_regex.h3
-rw-r--r--ext/hyperwave/hg_comm.c4
-rw-r--r--ext/mysql/php_mysql.c38
-rw-r--r--ext/oci8/oci8.c2
-rw-r--r--ext/posix/posix.c4
-rw-r--r--ext/standard/basic_functions.c2
-rw-r--r--ext/standard/browscap.c1
-rw-r--r--ext/standard/dl.c10
-rw-r--r--ext/standard/exec.c21
-rw-r--r--ext/standard/head.c123
-rw-r--r--ext/standard/mail.c6
-rw-r--r--ext/standard/php_string.h41
-rw-r--r--ext/standard/string.c4
-rw-r--r--ext/standard/url.c2
-rw-r--r--main/config.w32.h2
-rw-r--r--main/fopen_wrappers.c2
-rw-r--r--main/internal_functions_registry.h10
-rw-r--r--main/php.h51
-rw-r--r--main/php_regex.h3
-rw-r--r--main/snprintf.c36
-rw-r--r--main/snprintf.h14
-rw-r--r--main/win95nt.h4
-rw-r--r--request_info.c18
-rw-r--r--request_info.h1
-rw-r--r--sapi/apache/config.m46
-rw-r--r--sapi/apache/mod_php4.c6
-rw-r--r--sapi/apache/php_apache.c4
-rw-r--r--sapi/apache/php_apache_http.h24
-rw-r--r--sapi/cgi/cgi_main.c6
33 files changed, 108 insertions, 352 deletions
diff --git a/acconfig.h.in b/acconfig.h.in
index c2d6038706..2194c1cd4a 100644
--- a/acconfig.h.in
+++ b/acconfig.h.in
@@ -74,9 +74,6 @@
/* Define if you have the sendmail program available */
#define HAVE_SENDMAIL 0
-/* Define if you are compiling PHP as an Apache module */
-#define APACHE 0
-
/* Define if you are compiling PHP as an Apache module with mod_charset patch applied (aka Russian Apache)*/
#define USE_TRANSFER_TABLES 0
diff --git a/acinclude.m4 b/acinclude.m4
index 0aec0c688a..ff560ebdfa 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -295,8 +295,6 @@ if test "$REGEX_TYPE" = "php"; then
PHP_FAST_OUTPUT(regex/Makefile)
elif test "$REGEX_TYPE" = "system"; then
AC_DEFINE(REGEX,0)
-elif test "$REGEX_TYPE" = "apache"; then
- AC_DEFINE(REGEX,2)
fi
AC_MSG_CHECKING(which regex library to use)
diff --git a/ext/aspell/aspell.c b/ext/aspell/aspell.c
index b942517ba2..5866a66b57 100644
--- a/ext/aspell/aspell.c
+++ b/ext/aspell/aspell.c
@@ -29,11 +29,6 @@
#if HAVE_ASPELL
#include "php_aspell.h"
-#if APACHE
-# ifndef DEBUG
-# undef palloc
-# endif
-#endif
#include <aspell-c.h>
function_entry aspell_functions[] = {
diff --git a/ext/db/db.c b/ext/db/db.c
index 5b0eb11282..e4e5b51d3b 100644
--- a/ext/db/db.c
+++ b/ext/db/db.c
@@ -317,7 +317,7 @@ dbm_info *php_dbm_open(char *filename, char *mode) {
#if NFS_HACK
while((last_try = stat(lockfn,&sb))==0) {
retries++;
- sleep(1);
+ php_sleep(1);
if (retries>30) break;
}
if (last_try!=0) {
diff --git a/ext/ereg/php_regex.h b/ext/ereg/php_regex.h
index be0f445af7..f4dc865163 100644
--- a/ext/ereg/php_regex.h
+++ b/ext/ereg/php_regex.h
@@ -5,10 +5,9 @@
* REGEX means:
* 0.. system regex
* 1.. bundled regex
- * 2.. Apache's regex
*/
-#if REGEX == 1
+#if REGEX
/* get aliases */
#include "regex/regex_extra.h"
#include "regex/regex.h"
diff --git a/ext/hyperwave/hg_comm.c b/ext/hyperwave/hg_comm.c
index 1138df59b6..20ed8d683e 100644
--- a/ext/hyperwave/hg_comm.c
+++ b/ext/hyperwave/hg_comm.c
@@ -1137,7 +1137,7 @@ static int hg_read(int sockfd, char *buf, int size)
if ( (errno == EAGAIN) || (errno == EWOULDBLOCK) ) {
if ( ++try > 5 )
return(-1);
- sleep(1);
+ php_sleep(1);
}
else return(-1);
}
@@ -1159,7 +1159,7 @@ static int hg_write(int sockfd, char *buf, int size)
if ( (errno == EAGAIN) || (errno == EWOULDBLOCK) ) {
if ( ++try > 5 )
return(-1);
- sleep(1);
+ php_sleep(1);
}
else return(-1);
}
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c
index f02382d2fe..57c3add055 100644
--- a/ext/mysql/php_mysql.c
+++ b/ext/mysql/php_mysql.c
@@ -158,9 +158,6 @@ PHP_MYSQL_API php_mysql_globals mysql_globals;
DLEXPORT zend_module_entry *get_module(void) { return &mysql_module_entry; }
#endif
-#if APACHE
-void timeout(int sig);
-#endif
#define CHECK_LINK(link) { if (link==-1) { php_error(E_WARNING,"MySQL: A link to the server could not be established"); RETURN_FALSE; } }
@@ -187,42 +184,19 @@ static void php_mysql_set_default_link(int id)
static void _close_mysql_link(MYSQL *link)
{
-#if APACHE
- void (*handler) (int);
-#endif
MySLS_FETCH();
-#if APACHE
- handler = signal(SIGPIPE, SIG_IGN);
-#endif
-
mysql_close(link);
-
-#if APACHE
- signal(SIGPIPE,handler);
-#endif
-
efree(link);
MySG(num_links)--;
}
static void _close_mysql_plink(MYSQL *link)
{
-#if APACHE
- void (*handler) (int);
-#endif
MySLS_FETCH();
-#if APACHE
- handler = signal(SIGPIPE, SIG_IGN);
-#endif
-
mysql_close(link);
-#if APACHE
- signal(SIGPIPE,handler);
-#endif
-
free(link);
MySG(num_persistent)--;
MySG(num_links)--;
@@ -338,9 +312,6 @@ PHP_MINFO_FUNCTION(mysql)
static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
{
-#if APACHE
- void (*handler) (int);
-#endif
char *user,*passwd,*host,*socket=NULL,*tmp;
char *hashed_details;
int hashed_details_length,port = MYSQL_PORT;
@@ -478,18 +449,12 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
RETURN_FALSE;
}
/* ensure that the link did not die */
-#if APACHE
- handler=signal(SIGPIPE,SIG_IGN);
-#endif
#if defined(HAVE_MYSQL_ERRNO) && defined(CR_SERVER_GONE_ERROR)
mysql_stat(le->ptr);
if (mysql_errno((MYSQL *)le->ptr) == CR_SERVER_GONE_ERROR) {
#else
if (!strcasecmp(mysql_stat(le->ptr),"mysql server has gone away")) { /* the link died */
#endif
-#if APACHE
- signal(SIGPIPE,handler);
-#endif
#if MYSQL_VERSION_ID > 32199 /* this lets us set the port number */
if (mysql_real_connect(le->ptr,host,user,passwd,NULL,port,socket,0)==NULL) {
#else
@@ -501,9 +466,6 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
RETURN_FALSE;
}
}
-#if APACHE
- signal(SIGPIPE,handler);
-#endif
mysql = (MYSQL *) le->ptr;
}
ZEND_REGISTER_RESOURCE(return_value, mysql, le_plink);
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index 85b9a391f5..8304a0bb83 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -1642,7 +1642,7 @@ oci_failover_callback(dvoid *svchp,
case OCI_FO_ERROR:
{
printf(" Failover error gotten. Sleeping...\n");
- sleep(3);
+ php_sleep(3);
/* cannot find this blody define !!! return OCI_FO_RETRY; */
break;
}
diff --git a/ext/posix/posix.c b/ext/posix/posix.c
index 37d6fa39c6..8d32d82a69 100644
--- a/ext/posix/posix.c
+++ b/ext/posix/posix.c
@@ -132,10 +132,6 @@ zend_module_entry posix_module_entry = {
DLEXPORT zend_module_entry *get_module(void) { return &posix__module_entry; }
#endif
-#if APACHE
-void timeout(int sig);
-#endif
-
static PHP_MINFO_FUNCTION(posix)
{
PUTS("$Revision$\n");
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 2309df2db2..953eebe7f2 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -664,7 +664,7 @@ PHP_FUNCTION(sleep)
WRONG_PARAM_COUNT;
}
convert_to_long_ex(num);
- sleep((*num)->value.lval);
+ php_sleep((*num)->value.lval);
}
PHP_FUNCTION(usleep)
diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c
index c6ea118081..f29429e2d4 100644
--- a/ext/standard/browscap.c
+++ b/ext/standard/browscap.c
@@ -17,6 +17,7 @@
*/
#include "php.h"
+#include "php_regex.h"
#include "php_browscap.h"
#include "php_ini.h"
diff --git a/ext/standard/dl.c b/ext/standard/dl.c
index 471ef75e9a..86decf5d37 100644
--- a/ext/standard/dl.c
+++ b/ext/standard/dl.c
@@ -104,7 +104,7 @@ void php_dl(pval *file,int type,pval *return_value)
}
/* load dynamic symbol */
- handle = dlopen(libpath, RTLD_LAZY);
+ handle = DL_LOAD(libpath);
if (!handle) {
int error_type;
@@ -120,10 +120,10 @@ void php_dl(pval *file,int type,pval *return_value)
#endif
RETURN_FALSE;
}
- get_module = (zend_module_entry *(*)(void)) dlsym(handle, "get_module");
+ get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, "get_module");
if (!get_module) {
- dlclose(handle);
+ DL_UNLOAD(handle);
php_error(E_CORE_WARNING,"Invalid library (maybe not a PHP library) '%s' ",file->value.str.val);
RETURN_FALSE;
}
@@ -133,7 +133,7 @@ void php_dl(pval *file,int type,pval *return_value)
if (module_entry->module_startup_func) {
if (module_entry->module_startup_func(type, module_entry->module_number ELS_CC)==FAILURE) {
php_error(E_CORE_WARNING,"%s: Unable to initialize module",module_entry->name);
- dlclose(handle);
+ DL_UNLOAD(handle);
RETURN_FALSE;
}
}
@@ -143,7 +143,7 @@ void php_dl(pval *file,int type,pval *return_value)
if (module_entry->request_startup_func) {
if (module_entry->request_startup_func(type, module_entry->module_number ELS_CC)) {
php_error(E_CORE_WARNING,"%s: Unable to initialize module",module_entry->name);
- dlclose(handle);
+ DL_UNLOAD(handle);
RETURN_FALSE;
}
}
diff --git a/ext/standard/exec.c b/ext/standard/exec.c
index 53394a4b36..c450d17ecd 100644
--- a/ext/standard/exec.c
+++ b/ext/standard/exec.c
@@ -145,27 +145,8 @@ static int _Exec(int type, char *cmd, pval *array, pval *return_value)
if (type == 1) {
-#if APACHE
- SLS_FETCH();
-#endif
-
if (output) PUTS(buf);
-#if APACHE
-# if MODULE_MAGIC_NUMBER > 19970110
- if (output) rflush(((request_rec *) SG(server_context)));
-# else
- if (output) bflush(((request_rec *) SG(server_context))->connection->client);
-# endif
-#endif
-#if CGI_BINARY
- fflush(stdout);
-#endif
-#if FHTTPD
- /* fhttpd doesn't flush */
-#endif
-#if USE_SAPI
- sapi_rqst->flush(sapi_rqst->scid);
-#endif
+ sapi_flush();
}
else if (type == 2) {
/* strip trailing whitespaces */
diff --git a/ext/standard/head.c b/ext/standard/head.c
index 493703e772..23f5f58efb 100644
--- a/ext/standard/head.c
+++ b/ext/standard/head.c
@@ -58,133 +58,10 @@ PHP_RINIT_FUNCTION(head)
}
-#if 0
-/* Adds header information */
-void php4i_add_header_information(char *header_information, uint header_length)
-{
- char *r;
-#if APACHE
- char *rr = NULL;
- char *temp = NULL;
- long myuid = 0L;
- char temp2[32];
- request_rec *req;
- SLS_FETCH();
-
- req = ((request_rec *) SG(server_context));
-#endif
-
- if (php_header_printed == 1) {
-#if DEBUG
- php_error(E_WARNING, "Cannot add more header information - the header was already sent "
- "(header information may be added only before any output is generated from the script - "
- "check for text or whitespace outside PHP tags, or calls to functions that output text)");
-#endif
- return; /* too late, already sent */
- }
-#if APACHE
- /*
- * Not entirely sure this is the right way to support the header
- * command in the Apache module. Comments?
- */
- r = strchr(header_information, ':');
- if (r) {
- *r = '\0';
- if (!strcasecmp(header_information, "Content-type")) {
- if (*(r + 1) == ' ')
- req->content_type = pstrdup(req->pool,r + 2);
- else
- req->content_type = pstrdup(req->pool,r + 1);
- cont_type = (char *) req->content_type;
- } else {
- if (*(r + 1) == ' ') {
- rr = r + 2;
- } else {
- rr = r + 1;
- }
- if (PG(safe_mode) && (!strcasecmp(header_information, "WWW-authenticate"))) {
- myuid = php_getuid();
- sprintf(temp2, "realm=\"%ld ", myuid); /* SAFE */
- temp = php_reg_replace("realm=\"", temp2, rr, 1, 0);
- if (!strcmp(temp, rr)) {
- sprintf(temp2, "realm=%ld", myuid); /* SAFE */
- temp = php_reg_replace("realm=", temp2, rr, 1, 0);
- if (!strcmp(temp, rr)) {
- sprintf(temp2, " realm=%ld", myuid); /* SAFE */
- temp = php_reg_replace("$", temp2, rr, 0, 0);
- }
- }
- table_set(req->headers_out, header_information, temp);
- } else
- table_set(req->headers_out, header_information, rr);
- }
- if (!strcasecmp(header_information, "location")) {
- req->status = REDIRECT;
- }
- *r = ':';
- php_header_printed = 2;
- }
- if (!strncasecmp(header_information, "http/", 5)) {
- if (strlen(header_information) > 9) {
- req->status = atoi(&((header_information)[9]));
- }
- /* Use a pstrdup here to get the memory straight from Apache's per-request pool to
- * avoid having our own memory manager complain about this memory not being freed
- * because it really shouldn't be freed until the end of the request and it isn't
- * easy for us to figure out when we allocated it vs. when something else might have.
- */
- req->status_line = pstrdup(req->pool,&((header_information)[9]));
- }
-#else
- r = strchr(header_information, ':');
- if (r) {
- *r = '\0';
- if (!strcasecmp(header_information, "Content-type")) {
- if (cont_type) efree(cont_type);
- cont_type = estrdup(r + 1);
-#if 0 /*WIN32|WINNT / *M$ does us again*/
- if (!strcmp(cont_type," text/html")){
- *r=':';
- PUTS_H(header_information);
- PUTS_H("\015\012");
- }
-#endif
- } else {
- *r = ':';
-#if USE_SAPI
- {
- char *tempstr=emalloc(strlen(header_information)+2);
-
- sprintf(tempstr,"%s\015\012",tempstr);
- sapi_rqst->header(sapi_rqst->scid,tempstr);
- efree(tempstr);
- }
-#else
- PUTS_H(header_information);
- PUTS_H("\015\012");
-#endif
- }
- } else {
-#if USE_SAPI
- {
- char *tempstr=emalloc(strlen(header_information)+2);
- sprintf(tempstr,"%s\015\012",tempstr);
- sapi_rqst->header(sapi_rqst->scid,tempstr);
- efree(tempstr);
- }
-#else
- PUTS_H(header_information);
- PUTS_H("\015\012");
-#endif
- }
-#endif
-}
-#else
void php4i_add_header_information(char *header_information, uint header_length)
{
sapi_add_header(header_information, header_length);
}
-#endif
/* Implementation of the language Header() function */
diff --git a/ext/standard/mail.c b/ext/standard/mail.c
index 7657ef6ba7..d87861a605 100644
--- a/ext/standard/mail.c
+++ b/ext/standard/mail.c
@@ -28,12 +28,6 @@
#include "php_mail.h"
#include "php_ini.h"
-#if APACHE
-# ifndef DEBUG
-# undef palloc
-# endif
-#endif
-
#if HAVE_SENDMAIL
#if MSVC5
#include "win32/sendmail.h"
diff --git a/ext/standard/php_string.h b/ext/standard/php_string.h
index 74f0b899d8..467e85789e 100644
--- a/ext/standard/php_string.h
+++ b/ext/standard/php_string.h
@@ -83,26 +83,31 @@ PHP_FUNCTION(strip_tags);
PHP_FUNCTION(str_repeat);
PHP_FUNCTION(substr_replace);
-extern PHPAPI char *php_strtoupper(char *s, size_t len);
-extern PHPAPI char *php_strtolower(char *s, size_t len);
-extern PHPAPI char *php_strtr(char *str, int len, char *str_from, char *str_to, int trlen);
-extern PHPAPI char *php_addslashes(char *str, int length, int *new_length, int freeit);
-extern PHPAPI char *php_addcslashes(char *str, int length, int *new_length, int freeit, char *what, int wlength);
-extern PHPAPI void php_stripslashes(char *str, int *len);
-extern PHPAPI void php_stripcslashes(char *str, int *len);
-extern PHPAPI void php_dirname(char *str, int len);
-extern PHPAPI char *php_stristr(unsigned char *s, unsigned char *t, size_t s_len, size_t t_len);
-extern PHPAPI char *php_str_to_str(char *haystack, int length, char *needle,
+PHPAPI char *php_strtoupper(char *s, size_t len);
+PHPAPI char *php_strtolower(char *s, size_t len);
+PHPAPI char *php_strtr(char *str, int len, char *str_from, char *str_to, int trlen);
+PHPAPI char *php_addslashes(char *str, int length, int *new_length, int freeit);
+PHPAPI char *php_addcslashes(char *str, int length, int *new_length, int freeit, char *what, int wlength);
+PHPAPI void php_stripslashes(char *str, int *len);
+PHPAPI void php_stripcslashes(char *str, int *len);
+PHPAPI void php_dirname(char *str, int len);
+PHPAPI char *php_stristr(unsigned char *s, unsigned char *t, size_t s_len, size_t t_len);
+PHPAPI char *php_str_to_str(char *haystack, int length, char *needle,
int needle_len, char *str, int str_len, int *_new_length);
-extern PHPAPI void php_trim(pval *str, pval *return_value, int mode);
-extern PHPAPI void php_strip_tags(char *rbuf, int len, int state, char *allow, int allow_len);
+PHPAPI void php_trim(pval *str, pval *return_value, int mode);
+PHPAPI void php_strip_tags(char *rbuf, int len, int state, char *allow, int allow_len);
-extern PHPAPI void php_char_to_str(char *str, uint len, char from, char *to, int to_len, pval *result);
+PHPAPI void php_char_to_str(char *str, uint len, char from, char *to, int to_len, pval *result);
-extern PHPAPI void php_implode(pval *delim, pval *arr, pval *return_value);
-extern PHPAPI void php_explode(pval *delim, pval *str, pval *return_value);
-extern PHPAPI inline char *php_memnstr(char *haystack, char *needle, int needle_len, char *end);
-extern PHPAPI size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end);
-extern PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end);
+PHPAPI void php_implode(pval *delim, pval *arr, pval *return_value);
+PHPAPI void php_explode(pval *delim, pval *str, pval *return_value);
+PHPAPI inline char *php_memnstr(char *haystack, char *needle, int needle_len, char *end);
+PHPAPI size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end);
+PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end);
+
+#ifndef HAVE_STRERROR
+PHPAPI char *php_strerror(int errnum);
+#define strerror php_strerror
+#endif
#endif /* _PHPSTRING_H */
diff --git a/ext/standard/string.c b/ext/standard/string.c
index a9f767a82c..f3cd2bda12 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -1503,8 +1503,7 @@ PHP_FUNCTION(stripslashes)
/* }}} */
#ifndef HAVE_STRERROR
-#if !APACHE
-char *strerror(int errnum)
+char *php_strerror(int errnum)
{
extern int sys_nerr;
extern char *sys_errlist[];
@@ -1515,7 +1514,6 @@ char *strerror(int errnum)
return(BG(str_ebuf));
}
#endif
-#endif
PHPAPI void php_stripcslashes(char *str, int *len)
{
diff --git a/ext/standard/url.c b/ext/standard/url.c
index f37500f984..e8e85b3b41 100644
--- a/ext/standard/url.c
+++ b/ext/standard/url.c
@@ -27,7 +27,7 @@
#include "url.h"
#ifdef _OSD_POSIX
#ifndef APACHE
-#error On this EBCDIC platform, PHP3 is only supported as an Apache module.
+#error On this EBCDIC platform, PHP is only supported as an Apache module.
#else /*APACHE*/
#ifndef CHARSET_EBCDIC
#define CHARSET_EBCDIC /* this machine uses EBCDIC, not ASCII! */
diff --git a/main/config.w32.h b/main/config.w32.h
index e12c7efe33..d9f8b1ecf2 100644
--- a/main/config.w32.h
+++ b/main/config.w32.h
@@ -97,8 +97,6 @@
will move to the "don't touch" list below eventualy.
---------------------------------------------------------------*/
-/*#define APACHE 0 defined in preprocessor section*/
-
/* ----------------------------------------------------------------
The following should never need to be played with
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c
index 4dd5c7d734..28706af514 100644
--- a/main/fopen_wrappers.c
+++ b/main/fopen_wrappers.c
@@ -208,7 +208,6 @@ PHPAPI FILE *php_fopen_wrapper(char *path, char *mode, int options, int *issock,
}
}
-#if CGI_BINARY || FHTTPD || USE_SAPI
PHPAPI FILE *php_fopen_primary_script(void)
{
@@ -307,7 +306,6 @@ PHPAPI FILE *php_fopen_primary_script(void)
return fp;
}
-#endif /* CGI_BINARY || USE_SAPI */
/*
* Tries to open a file with a PATH-style list of directories.
diff --git a/main/internal_functions_registry.h b/main/internal_functions_registry.h
index 7152eb8b16..a2d71969e5 100644
--- a/main/internal_functions_registry.h
+++ b/main/internal_functions_registry.h
@@ -25,16 +25,6 @@
extern int php_init_mime(INIT_FUNC_ARGS);
-#if 0
-#if APACHE
-extern zend_module_entry apache_module_entry;
-#define phpext_apache_ptr &apache_module_entry
-extern void php_virtual(INTERNAL_FUNCTION_PARAMETERS);
-#else
-#define phpext_apache_ptr NULL
-#endif
-#endif
-
/* environment functions */
extern int php_init_environment(void);
diff --git a/main/php.h b/main/php.h
index cefb35e6b5..ff8c3c8c43 100644
--- a/main/php.h
+++ b/main/php.h
@@ -30,8 +30,6 @@
#define YYDEBUG 0
-#define CGI_BINARY (!APACHE && !USE_SAPI && !FHTTPD)
-
#include "php_version.h"
#include "zend.h"
@@ -89,6 +87,8 @@ extern unsigned char second_arg_allow_ref[];
#define inline
#endif
+#define APACHE 0
+#define CGI_BINARY 0
#if HAVE_UNIX_H
#include <unix.h>
@@ -116,19 +116,6 @@ typedef unsigned int socklen_t;
#include "request_info.h"
-#if HAVE_LIBDL
-# if MSVC5
-# include <windows.h>
-# define dlclose FreeLibrary
-# define dlopen(a,b) LoadLibrary(a)
-# define dlsym GetProcAddress
-# else
-#if HAVE_DLFCN_H && !((defined(_AIX) || defined(AIX)) && APACHE)
-# include <dlfcn.h>
-#endif
-# endif
-#endif
-
#define CREATE_MUTEX(a,b)
#define SET_MUTEX(a)
#define FREE_MUTEX(a)
@@ -180,35 +167,6 @@ extern char *strerror(int);
#include "fopen-wrappers.h"
-#if APACHE /* apache httpd */
-# if HAVE_AP_CONFIG_H
-#include "ap_config_auto.h"
-#ifdef RHAPSODY
-#undef HAVE_SNPRINTF
-#endif
-#include "ap_config.h"
-#ifdef RHAPSODY
-#undef HAVE_SNPRINTF
-#define HAVE_SNPRINTF 1
-#endif
-# endif
-# if HAVE_OLD_COMPAT_H
-#include "compat.h"
-# endif
-# if HAVE_AP_COMPAT_H
-#include "ap_compat.h"
-# endif
-#include "httpd.h"
-#include "http_main.h"
-#include "http_core.h"
-#include "http_request.h"
-#include "http_protocol.h"
-#include "http_config.h"
-#include "http_log.h"
-#define BLOCK_INTERRUPTIONS block_alarms
-#define UNBLOCK_INTERRUPTIONS unblock_alarms
-#endif
-
#if REGEX == 1 || REGEX == 0
#include "regex/regex_extra.h"
#endif
@@ -222,10 +180,6 @@ extern char *strerror(int);
#include <sys/param.h>
# endif
#endif
-#if CGI_BINARY /* CGI version */
-#define BLOCK_INTERRUPTIONS NULL
-#define UNBLOCK_INTERRUPTIONS NULL
-#endif
#if HAVE_LIMITS_H
#include <limits.h>
@@ -292,6 +246,7 @@ extern int ap_vsnprintf(char *, size_t, const char *, va_list);
extern pval *data;
#if !(PHP_WIN32)
extern char **environ;
+#define php_sleep sleep
#endif
extern void phperror(char *error);
diff --git a/main/php_regex.h b/main/php_regex.h
index be0f445af7..f4dc865163 100644
--- a/main/php_regex.h
+++ b/main/php_regex.h
@@ -5,10 +5,9 @@
* REGEX means:
* 0.. system regex
* 1.. bundled regex
- * 2.. Apache's regex
*/
-#if REGEX == 1
+#if REGEX
/* get aliases */
#include "regex/regex_extra.h"
#include "regex/regex.h"
diff --git a/main/snprintf.c b/main/snprintf.c
index 4437dee003..b3afec1146 100644
--- a/main/snprintf.c
+++ b/main/snprintf.c
@@ -55,7 +55,6 @@
#include "php.h"
-#if !defined(APACHE) || (!APACHE)
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
#include <stdio.h>
@@ -69,9 +68,9 @@
#ifdef HAVE_GCVT
-#define ap_ecvt ecvt
-#define ap_fcvt fcvt
-#define ap_gcvt gcvt
+#define ap_php_ecvt ecvt
+#define ap_php_fcvt fcvt
+#define ap_php_gcvt gcvt
#else
@@ -81,7 +80,7 @@
*/
/*
- * ap_ecvt converts to decimal
+ * ap_php_ecvt converts to decimal
* the number of digits is specified by ndigit
* decpt is set to the position of the decimal point
* sign is set to 0 for positive, 1 for negative
@@ -90,7 +89,7 @@
#define NDIG 80
static char *
- ap_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag)
+ ap_php_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag)
{
register int r2;
double fi, fj;
@@ -164,30 +163,30 @@ static char *
}
static char *
- ap_ecvt(double arg, int ndigits, int *decpt, int *sign)
+ ap_php_ecvt(double arg, int ndigits, int *decpt, int *sign)
{
- return (ap_cvt(arg, ndigits, decpt, sign, 1));
+ return (ap_php_cvt(arg, ndigits, decpt, sign, 1));
}
static char *
- ap_fcvt(double arg, int ndigits, int *decpt, int *sign)
+ ap_php_fcvt(double arg, int ndigits, int *decpt, int *sign)
{
- return (ap_cvt(arg, ndigits, decpt, sign, 0));
+ return (ap_php_cvt(arg, ndigits, decpt, sign, 0));
}
/*
- * ap_gcvt - Floating output conversion to
+ * ap_php_gcvt - Floating output conversion to
* minimal length string
*/
static char *
- ap_gcvt(double number, int ndigit, char *buf)
+ ap_php_gcvt(double number, int ndigit, char *buf)
{
int sign, decpt;
register char *p1, *p2;
register i;
- p1 = ap_ecvt(number, ndigit, &decpt, &sign);
+ p1 = ap_php_ecvt(number, ndigit, &decpt, &sign);
p2 = buf;
if (sign)
*p2++ = '-';
@@ -413,9 +412,9 @@ static char *
int decimal_point;
if (format == 'f')
- p = ap_fcvt(num, precision, &decimal_point, is_negative);
+ p = ap_php_fcvt(num, precision, &decimal_point, is_negative);
else /* either e or E format */
- p = ap_ecvt(num, precision + 1, &decimal_point, is_negative);
+ p = ap_php_ecvt(num, precision + 1, &decimal_point, is_negative);
/*
* Check for Infinity and NaN
@@ -765,7 +764,7 @@ static int format_converter(register buffy * odp, const char *fmt,
/*
* * We use &num_buf[ 1 ], so that we have room for the sign
*/
- s = ap_gcvt(va_arg(ap, double), precision, &num_buf[1]);
+ s = ap_php_gcvt(va_arg(ap, double), precision, &num_buf[1]);
if (*s == '-')
prefix_char = *s++;
else if (print_sign)
@@ -910,7 +909,7 @@ static void strx_printv(int *ccp, char *buf, size_t len, const char *format,
}
-int ap_snprintf(char *buf, size_t len, const char *format,...)
+int ap_php_snprintf(char *buf, size_t len, const char *format,...)
{
int cc;
va_list ap;
@@ -922,7 +921,7 @@ int ap_snprintf(char *buf, size_t len, const char *format,...)
}
-int ap_vsnprintf(char *buf, size_t len, const char *format, va_list ap)
+int ap_php_vsnprintf(char *buf, size_t len, const char *format, va_list ap)
{
int cc;
@@ -931,4 +930,3 @@ int ap_vsnprintf(char *buf, size_t len, const char *format, va_list ap)
}
#endif /* HAVE_SNPRINTF */
-#endif /* APACHE */
diff --git a/main/snprintf.h b/main/snprintf.h
index 7c9afdbff8..e9a10e4e79 100644
--- a/main/snprintf.h
+++ b/main/snprintf.h
@@ -16,17 +16,17 @@
+----------------------------------------------------------------------+
*/
-#ifndef _PHP3_SNPRINTF_H
-#define _PHP3_SNPRINTF_H
+#ifndef _PHP_SNPRINTF_H
+#define _PHP_SNPRINTF_H
#ifndef HAVE_SNPRINTF
-extern int ap_snprintf(char *, size_t, const char *, ...);
-#define snprintf ap_snprintf
+extern int ap_php_snprintf(char *, size_t, const char *, ...);
+#define snprintf ap_php_snprintf
#endif
#ifndef HAVE_VSNPRINTF
-extern int ap_vsnprintf(char *, size_t, const char *, va_list ap);
-#define vsnprintf ap_vsnprintf
+extern int ap_php_vsnprintf(char *, size_t, const char *, va_list ap);
+#define vsnprintf ap_php_vsnprintf
#endif
#if BROKEN_SPRINTF
@@ -35,7 +35,7 @@ int php_sprintf (char* s, const char* format, ...);
#define php_sprintf sprintf
#endif
-#endif /* _PHP3_SNPRINTF_H */
+#endif /* _PHP_SNPRINTF_H */
/*
* Local variables:
diff --git a/main/win95nt.h b/main/win95nt.h
index b481d70f61..1d565aa8f6 100644
--- a/main/win95nt.h
+++ b/main/win95nt.h
@@ -25,9 +25,7 @@ typedef char * caddr_t;
#define mkdir(a,b) _mkdir(a)
#define rmdir _rmdir
#define getpid _getpid
-#if !(APACHE)
-#define sleep(t) Sleep(t*1000)
-#endif
+#define php_sleep(t) Sleep(t*1000)
#define getcwd _getcwd
#define snprintf _snprintf
#define off_t _off_t
diff --git a/request_info.c b/request_info.c
index 770a68bbb5..03d5c70329 100644
--- a/request_info.c
+++ b/request_info.c
@@ -26,8 +26,6 @@ PHPAPI php_request_info request_info;
#if CGI_BINARY
int php_init_request_info(void *conf)
{
- request_info.current_user = NULL;
- request_info.current_user_length = 0;
request_info.script_name = getenv("SCRIPT_NAME");
request_info.script_filename = getenv("SCRIPT_FILENAME");
/* Hack for annoying servers that do not set SCRIPT_FILENAME for us */
@@ -79,8 +77,6 @@ int php_init_request_info(void *conf)
SLS_FETCH();
r = ((request_rec *) SG(server_context));
- request_info.current_user = NULL;
- request_info.current_user_length = 0;
return SUCCESS;
}
@@ -95,8 +91,18 @@ int php_destroy_request_info(void *conf)
return SUCCESS;
}
#endif
-/*
- * Local variables:
+
+
+int php_init_request_info(void *conf)
+{
+ request_info.current_user = NULL;
+ request_info.current_user_length = 0;
+ return SUCCESS;
+}
+
+
+
+/* * Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
diff --git a/request_info.h b/request_info.h
index ccf9c60b89..12933eea4d 100644
--- a/request_info.h
+++ b/request_info.h
@@ -20,7 +20,6 @@
#define _REQUEST_INFO_H_
typedef struct {
- char *script_name;
char *current_user;
int current_user_length;
const char *script_filename;
diff --git a/sapi/apache/config.m4 b/sapi/apache/config.m4
index e35b11caf0..05ade912aa 100644
--- a/sapi/apache/config.m4
+++ b/sapi/apache/config.m4
@@ -36,7 +36,6 @@ AC_ARG_WITH(apxs,
PHP_APXS_BROKEN=yes
fi
STRONGHOLD=
- AC_DEFINE(APACHE)
AC_DEFINE(HAVE_AP_CONFIG_H)
AC_DEFINE(HAVE_AP_COMPAT_H)
AC_MSG_RESULT(yes)
@@ -66,7 +65,6 @@ AC_ARG_WITH(apache,
PHP_SAPI=apache
APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_INSTALL_FILES $APACHE_TARGET"
PHP_LIBS="-L. -lphp3"
- AC_DEFINE(APACHE)
AC_MSG_RESULT(yes - Apache 1.2.x)
STRONGHOLD=
if test -f $withval/src/ap_config.h; then
@@ -84,7 +82,6 @@ AC_ARG_WITH(apache,
PHP_SAPI=apache
APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp4.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
PHP_LIBS="-Lmodules/php4 -L../modules/php4 -L../../modules/php4 -lmodphp4"
- AC_DEFINE(APACHE)
AC_MSG_RESULT(yes - Apache 2.0.X)
STRONGHOLD=
if test -f $withval/src/include/ap_config.h; then
@@ -111,7 +108,6 @@ AC_ARG_WITH(apache,
PHP_SAPI=apache
APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp4.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
PHP_LIBS="-Lmodules/php4 -L../modules/php4 -L../../modules/php4 -lmodphp4"
- AC_DEFINE(APACHE)
AC_MSG_RESULT(yes - Apache 1.3.x)
STRONGHOLD=
if test -f $withval/src/include/ap_config.h; then
@@ -141,7 +137,6 @@ AC_ARG_WITH(apache,
PHP_SAPI=apache
PHP_LIBS="-Lmodules/php4 -L../modules/php4 -L../../modules/php4 -lmodphp4"
APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp4.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
- AC_DEFINE(APACHE)
AC_MSG_RESULT(yes - Apache 1.3.x)
STRONGHOLD=
if test -f $withval/src/include/ap_config.h; then
@@ -165,7 +160,6 @@ AC_ARG_WITH(apache,
PHP_LIBS="-Lmodules/php4 -L../modules/php4 -L../../modules/php4 -lmodphp4"
APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp4.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET"
STRONGHOLD=-DSTRONGHOLD=1
- AC_DEFINE(APACHE)
AC_MSG_RESULT(yes - StrongHold)
if test -f $withval/apache/ap_config.h; then
AC_DEFINE(HAVE_AP_CONFIG_H)
diff --git a/sapi/apache/mod_php4.c b/sapi/apache/mod_php4.c
index 86bab41fa2..5d23a64ab6 100644
--- a/sapi/apache/mod_php4.c
+++ b/sapi/apache/mod_php4.c
@@ -22,6 +22,7 @@
#include "zend.h"
#include "php.h"
#include "php_variables.h"
+#include "SAPI.h"
#include "httpd.h"
#include "http_config.h"
@@ -299,6 +300,7 @@ static int php_apache_sapi_activate(SLS_D)
block_alarms();
register_cleanup(((request_rec *) SG(server_context))->pool, NULL, php_request_shutdown, php_request_shutdown_for_exec);
unblock_alarms();
+ return SUCCESS;
}
@@ -310,9 +312,7 @@ static struct stat *php_apache_get_stat(SLS_D)
static char *php_apache_getenv(char *name, int name_len SLS_DC)
{
- char *value;
-
- return (char *) table_get(((request_rec *) SG(server_context))->subprocess_env, name));
+ return (char *) table_get(((request_rec *) SG(server_context))->subprocess_env, name);
}
diff --git a/sapi/apache/php_apache.c b/sapi/apache/php_apache.c
index e9988594e6..0915feb7c8 100644
--- a/sapi/apache/php_apache.c
+++ b/sapi/apache/php_apache.c
@@ -35,7 +35,7 @@
#include <errno.h>
#include <ctype.h>
-#if APACHE
+#include "remains.h"
#include "http_request.h"
#include "build-defs.h"
@@ -440,8 +440,6 @@ PHP_FUNCTION(apache_exec_uri)
}
#endif
-#endif
-
/*
* Local variables:
* tab-width: 4
diff --git a/sapi/apache/php_apache_http.h b/sapi/apache/php_apache_http.h
new file mode 100644
index 0000000000..a878b8fa3e
--- /dev/null
+++ b/sapi/apache/php_apache_http.h
@@ -0,0 +1,24 @@
+# if HAVE_AP_CONFIG_H
+#include "ap_config_auto.h"
+#ifdef RHAPSODY
+#undef HAVE_SNPRINTF
+#endif
+#include "ap_config.h"
+#ifdef RHAPSODY
+#undef HAVE_SNPRINTF
+#define HAVE_SNPRINTF 1
+#endif
+# endif
+# if HAVE_OLD_COMPAT_H
+#include "compat.h"
+# endif
+# if HAVE_AP_COMPAT_H
+#include "ap_compat.h"
+# endif
+#include "httpd.h"
+#include "http_main.h"
+#include "http_core.h"
+#include "http_request.h"
+#include "http_protocol.h"
+#include "http_config.h"
+#include "http_log.h"
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index af4bf9da1c..b764bfaa02 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -25,8 +25,6 @@
#include "SAPI.h"
-#if CGI_BINARY
-
#include <stdio.h>
#include "php.h"
#ifdef MSVC5
@@ -138,7 +136,7 @@ static void sapi_cgi_register_variables(zval *track_vars_array ELS_DC SLS_DC PLS
char *val;
int l=0;
- sn = request_info.script_name;
+ sn = getenv("SCRIPT_NAME");
pi = SG(request_info).request_uri;
if (sn)
l += strlen(sn);
@@ -574,5 +572,3 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
return SUCCESS;
}
-
-#endif