summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2000-02-10 19:41:21 +0000
committerZeev Suraski <zeev@php.net>2000-02-10 19:41:21 +0000
commit6d0ab6166cc1a4eca90211cdfa0ca144704ad677 (patch)
treeee2b2758afeb47bf3a9648c0067d9b747b91e5b2 /sapi
parent9709f7ec73557e0a1a85ad3fbc4c73806de50620 (diff)
downloadphp-git-6d0ab6166cc1a4eca90211cdfa0ca144704ad677.tar.gz
SAPIfication, Episode VI: Return of the SAPI
Remove mostly all references to APACHE and CGI_BINARY from the code. - Apache include files are no longer included by any PHP code, except for the Apache SAPI module. - No server specific code is in any of the base PHP code. Still left to be done: - Eliminate any references to APACHE from the few remaining modules. - Move request_info.c's logic to SAPI - Modify the regex function names, and globals, so that we can always include them, without having to fear any interference with Apache; Always use the bundled regex library
Diffstat (limited to 'sapi')
-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
5 files changed, 29 insertions, 17 deletions
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