summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
Diffstat (limited to 'sapi')
-rw-r--r--sapi/Makefile.am4
-rw-r--r--sapi/README20
-rw-r--r--sapi/aolserver/Makefile.am4
-rw-r--r--sapi/aolserver/aolserver.c609
-rw-r--r--sapi/aolserver/config.h.stub1
-rw-r--r--sapi/aolserver/config.m424
-rw-r--r--sapi/aolserver/php.sym2
-rw-r--r--sapi/apache/Makefile.am6
-rw-r--r--sapi/apache/apMakefile.libdir4
-rw-r--r--sapi/apache/apMakefile.tmpl77
-rw-r--r--sapi/apache/config.h.stub0
-rw-r--r--sapi/apache/config.m4209
-rw-r--r--sapi/apache/libphp4.module.in7
-rw-r--r--sapi/apache/mod_php4.c629
-rw-r--r--sapi/apache/mod_php4.exp1
-rw-r--r--sapi/apache/mod_php4.h49
-rw-r--r--sapi/apache/php.sym1
-rw-r--r--sapi/apache/sapi_apache.c100
-rw-r--r--sapi/cgi/Makefile.am4
-rw-r--r--sapi/cgi/cgi_main.c497
-rw-r--r--sapi/cgi/config.h.in0
-rw-r--r--sapi/cgi/config.m484
-rw-r--r--sapi/cgi/php.sym0
-rw-r--r--sapi/isapi/Makefile.am5
-rw-r--r--sapi/isapi/config.m428
-rw-r--r--sapi/isapi/php.sym5
-rw-r--r--sapi/isapi/php4isapi.c493
-rw-r--r--sapi/isapi/php4isapi.def5
-rw-r--r--sapi/isapi/php4isapi.dsp106
-rw-r--r--sapi/roxen/Makefile.am4
-rw-r--r--sapi/roxen/README17
-rw-r--r--sapi/roxen/config.h.stub12
-rw-r--r--sapi/roxen/config.m463
-rw-r--r--sapi/roxen/phpmod.pike363
-rw-r--r--sapi/roxen/roxen.c745
-rw-r--r--sapi/servlet/Makefile.am28
-rw-r--r--sapi/servlet/README52
-rw-r--r--sapi/servlet/config.h.stub3
-rw-r--r--sapi/servlet/config.m440
-rw-r--r--sapi/servlet/servlet.c380
-rw-r--r--sapi/servlet/servlet.dsp271
-rw-r--r--sapi/servlet/servlet.java138
-rw-r--r--sapi/servlet/web.xml24
43 files changed, 0 insertions, 5114 deletions
diff --git a/sapi/Makefile.am b/sapi/Makefile.am
deleted file mode 100644
index 98c7104787..0000000000
--- a/sapi/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS = $(PHP_SAPI)
-
diff --git a/sapi/README b/sapi/README
deleted file mode 100644
index 5ab9381733..0000000000
--- a/sapi/README
+++ /dev/null
@@ -1,20 +0,0 @@
-Each SAPI backend has to contain:
-
-config.m4: just like for extensions, this file contains
-autoconf/automake directives that end up in the configure script. The
-only difference is that the sapi config.m4 files are read in diversion
-(output block) 2 instead of 3. The sapi config.m4 files should set
-two variables: PHP_SAPI (which sapi backend to choose) and INSTALL_IT
-(the actions performed when "make install" is executed). If they are
-not specified, they will default to "cgi" and "do nothing,"
-respectively. Additionally, the following m4 macros can be used to
-influence what is created during "make":
-
-PHP_BUILD_SHARED -- build shared target libs/libphp4.so
-PHP_BUILD_STATIC -- build static target libs/libphp4.a
-PHP_BUILD_PROGRAM -- build executable php
-
-(paths relative to top build dir)
-
-Makefile.am: just what you think. Make sure your target is called
-"libphpsapi_NNN.la", where NNN is the value of PHP_SAPI.
diff --git a/sapi/aolserver/Makefile.am b/sapi/aolserver/Makefile.am
deleted file mode 100644
index db29f279e8..0000000000
--- a/sapi/aolserver/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-noinst_LTLIBRARIES=libphpsapi_aolserver.la
-libphpsapi_aolserver_la_SOURCES=aolserver.c
diff --git a/sapi/aolserver/aolserver.c b/sapi/aolserver/aolserver.c
deleted file mode 100644
index 7786652eef..0000000000
--- a/sapi/aolserver/aolserver.c
+++ /dev/null
@@ -1,609 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_0.txt. |
- | 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> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * TODO:
- * - write documentation
- * - CGI/1.1 conformance
- */
-
-/* $Id$ */
-
-/* conflict between PHP and AOLserver headers */
-#define Debug php_Debug
-#include "php.h"
-#undef Debug
-
-#ifdef HAVE_AOLSERVER
-
-#ifndef ZTS
-#error AOLserver module is only useable in thread-safe mode
-#endif
-
-#include "ext/standard/info.h"
-
-#define NS_BUF_SIZE 511
-
-#include "php_ini.h"
-#include "php_globals.h"
-#include "SAPI.h"
-#include "main.h"
-
-#include "ns.h"
-
-#include "php_version.h"
-
-/* This symbol is used by AOLserver to tell the API version we expect */
-
-int Ns_ModuleVersion = 1;
-
-#define NSLS_D ns_globals_struct *ns_context
-#define NSLS_DC , NSLS_D
-#define NSLS_C ns_context
-#define NSLS_CC , NSLS_C
-#define NSG(v) (ns_context->v)
-#define NSLS_FETCH() ns_globals_struct *ns_context = ts_resource(ns_globals_id)
-
-/* TSRM id */
-
-static int ns_globals_id;
-
-/* php_ns_context is per-server (thus only once at all) */
-
-typedef struct {
- sapi_module_struct *sapi_module;
- char *ns_server;
- char *ns_module;
-} php_ns_context;
-
-/* ns_globals_struct is per-thread */
-
-typedef struct {
- Ns_Conn *conn;
- size_t data_avail;
-} ns_globals_struct;
-
-/*
- * php_ns_sapi_ub_write() writes data to the client connection.
- */
-
-static int
-php_ns_sapi_ub_write(const char *str, uint str_length)
-{
- int sent_bytes;
- NSLS_FETCH();
-
- sent_bytes = Ns_ConnWrite(NSG(conn), (void *) str, str_length);
-
- return sent_bytes;
-}
-
-/*
- * php_ns_sapi_header_handler() sets a HTTP reply header to be
- * sent to the client.
- */
-
-static int
-php_ns_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC)
-{
- char *header_name, *header_content;
- char *p;
- NSLS_FETCH();
-
- header_name = sapi_header->header;
- header_content = p = strchr(header_name, ':');
-
- if (p) {
- *p = '\0';
- do {
- header_content++;
- } while (*header_content == ' ');
-
- if (!strcasecmp(header_name, "Content-type")) {
- Ns_ConnSetTypeHeader(NSG(conn), header_content);
- } else {
- Ns_ConnSetHeaders(NSG(conn), header_name, header_content);
- }
-
- *p = ':';
- }
-
- sapi_free_header(sapi_header);
-
- return 0;
-}
-
-/*
- * php_ns_sapi_send_headers() flushes the headers to the client.
- * Called before real content is sent by PHP.
- */
-
-static int
-php_ns_sapi_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
-{
- NSLS_FETCH();
-
- if(SG(sapi_headers).send_default_content_type) {
- Ns_ConnSetRequiredHeaders(NSG(conn), "text/html", 0);
- }
-
- Ns_ConnFlushHeaders(NSG(conn), SG(sapi_headers).http_response_code);
-
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-/*
- * php_ns_sapi_read_post() reads a specified number of bytes from
- * the client. Used for POST/PUT requests.
- */
-
-static int
-php_ns_sapi_read_post(char *buf, uint count_bytes SLS_DC)
-{
- uint max_read;
- uint total_read = 0;
- NSLS_FETCH();
-
- max_read = MIN(NSG(data_avail), count_bytes);
-
- total_read = Ns_ConnRead(NSG(conn), buf, max_read);
-
- if(total_read == NS_ERROR) {
- total_read = -1;
- } else {
- NSG(data_avail) -= total_read;
- }
-
- return total_read;
-}
-
-/*
- * php_ns_sapi_read_cookies() returns the Cookie header from
- * the HTTP request header
- */
-
-static char *
-php_ns_sapi_read_cookies(SLS_D)
-{
- int i;
- char *http_cookie = NULL;
- NSLS_FETCH();
-
- i = Ns_SetIFind(NSG(conn->headers), "cookie");
- if(i != -1) {
- http_cookie = Ns_SetValue(NSG(conn->headers), i);
- }
-
- return http_cookie;
-}
-
-static void php_info_aolserver(ZEND_MODULE_INFO_FUNC_ARGS)
-{
- char buf[512];
- int uptime = Ns_InfoUptime();
- int i;
- NSLS_FETCH();
-
- PUTS("<table border=5 width=600>\n");
- php_info_print_table_row(2, "SAPI module version", "$Id$");
- php_info_print_table_row(2, "Build date", Ns_InfoBuildDate());
- php_info_print_table_row(2, "Config file path", Ns_InfoConfigFile());
- php_info_print_table_row(2, "Error Log path", Ns_InfoErrorLog());
- php_info_print_table_row(2, "Installation path", Ns_InfoHomePath());
- php_info_print_table_row(2, "Hostname of server", Ns_InfoHostname());
- php_info_print_table_row(2, "Source code label", Ns_InfoLabel());
- php_info_print_table_row(2, "Server platform", Ns_InfoPlatform());
- snprintf(buf, 511, "%s/%s", Ns_InfoServerName(), Ns_InfoServerVersion());
- php_info_print_table_row(2, "Server version", buf);
- snprintf(buf, 511, "%d day(s), %02d:%02d:%02d",
- uptime / 86400,
- (uptime / 3600) % 24,
- (uptime / 60) % 60,
- uptime % 60);
- php_info_print_table_row(2, "Server uptime", buf);
- PUTS("</table>");
-
- PUTS("<hr><h2>HTTP Headers Information</h2>");
- PUTS("<table border=5 width=\"600\">\n");
- PUTS("<tr><th colspan=2 bgcolor=\"" PHP_HEADER_COLOR "\">HTTP Request Headers</th></tr>\n");
- php_info_print_table_row(2, "HTTP Request", NSG(conn)->request->line);
-
- for (i = 0; i < Ns_SetSize(NSG(conn)->headers); i++) {
- php_info_print_table_row(2, Ns_SetKey(NSG(conn)->headers, i), Ns_SetValue(NSG(conn)->headers, i));
- }
-
- PUTS("<tr><th colspan=2 bgcolor=\"" PHP_HEADER_COLOR "\">HTTP Response Headers</th></tr>\n");
-
- for (i = 0; i < Ns_SetSize(NSG(conn)->outputheaders); i++) {
- php_info_print_table_row(2, Ns_SetKey(NSG(conn)->outputheaders, i), Ns_SetValue(NSG(conn)->outputheaders, i));
- }
-
- PUTS("</table>");
-}
-
-PHP_FUNCTION(getallheaders);
-
-static function_entry aolserver_functions[] = {
- PHP_FE(getallheaders, NULL)
- {0}
-};
-
-static zend_module_entry php_aolserver_module = {
- "AOLserver",
- aolserver_functions,
- NULL,
- NULL,
- NULL,
- NULL,
- php_info_aolserver,
- STANDARD_MODULE_PROPERTIES
-};
-
-PHP_FUNCTION(getallheaders)
-{
- int i;
- NSLS_FETCH();
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- for (i = 0; i < Ns_SetSize(NSG(conn->headers)); i++) {
- char *key = Ns_SetKey(NSG(conn->headers), i);
- char *value = Ns_SetValue(NSG(conn->headers), i);
-
- add_assoc_string(return_value, key, value, 1);
- }
-}
-
-static int
-php_ns_startup(sapi_module_struct *sapi_module)
-{
- if(php_module_startup(sapi_module) == FAILURE
- || zend_register_module(&php_aolserver_module) == FAILURE) {
- return FAILURE;
- } else {
- return SUCCESS;
- }
-}
-
-/* this structure is static (as in "it does not change") */
-
-static sapi_module_struct sapi_module = {
- "PHP Language",
-
- php_ns_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- php_ns_sapi_ub_write, /* unbuffered write */
-
- php_error, /* error handler */
-
- php_ns_sapi_header_handler, /* header handler */
- php_ns_sapi_send_headers, /* send headers handler */
- NULL, /* send header handler */
-
- php_ns_sapi_read_post, /* read POST data */
- php_ns_sapi_read_cookies, /* read Cookies */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-/*
- * php_ns_hash_environment() populates the php script environment
- * with a number of variables. HTTP_* variables are created for
- * the HTTP header data, so that a script can access these.
- */
-
-#define ADD_STRING(name) \
- MAKE_STD_ZVAL(pval); \
- pval->type = IS_STRING; \
- pval->value.str.len = strlen(buf); \
- pval->value.str.val = estrndup(buf, pval->value.str.len); \
- zend_hash_update(&EG(symbol_table), name, sizeof(name), \
- &pval, sizeof(zval *), NULL)
-
-static void
-php_ns_hash_environment(NSLS_D CLS_DC ELS_DC PLS_DC SLS_DC)
-{
- int i;
- char buf[NS_BUF_SIZE + 1];
- zval *pval;
- char *tmp;
-
- for(i = 0; i < Ns_SetSize(NSG(conn->headers)); i++) {
- char *key = Ns_SetKey(NSG(conn->headers), i);
- char *value = Ns_SetValue(NSG(conn->headers), i);
- char *p;
- char c;
- int buf_len;
-
- buf_len = snprintf(buf, NS_BUF_SIZE, "HTTP_%s", key);
- for(p = buf; (c = *p); p++) {
- c = toupper(c);
- if(c < 'A' || c > 'Z') {
- c = '_';
- }
- *p = c;
- }
-
- MAKE_STD_ZVAL(pval);
- pval->type = IS_STRING;
- pval->value.str.len = strlen(value);
- pval->value.str.val = estrndup(value, pval->value.str.len);
-
- zend_hash_update(&EG(symbol_table), buf, buf_len + 1, &pval, sizeof(zval *), NULL);
- }
-
- snprintf(buf, NS_BUF_SIZE, "%s/%s", Ns_InfoServerName(), Ns_InfoServerVersion());
- ADD_STRING("SERVER_SOFTWARE");
- snprintf(buf, NS_BUF_SIZE, "HTTP/%1.1f", NSG(conn)->request->version);
- ADD_STRING("SERVER_PROTOCOL");
-
- strncpy(buf, NSG(conn)->request->method, NS_BUF_SIZE);
- ADD_STRING("REQUEST_METHOD");
-
- if(NSG(conn)->request->query) {
- strncpy(buf, NSG(conn)->request->query, NS_BUF_SIZE);
- } else {
- buf[0] = '\0';
- }
- ADD_STRING("QUERY_STRING");
-
- strncpy(buf, Ns_InfoBuildDate(), NS_BUF_SIZE);
- ADD_STRING("SERVER_BUILDDATE");
-
- strncpy(buf, Ns_ConnPeer(NSG(conn)), NS_BUF_SIZE);
- ADD_STRING("REMOTE_ADDR");
-
- snprintf(buf, NS_BUF_SIZE, "%d", Ns_ConnPeerPort(NSG(conn)));
- ADD_STRING("REMOTE_PORT");
-
- snprintf(buf, NS_BUF_SIZE, "%d", Ns_ConnPort(NSG(conn)));
- ADD_STRING("SERVER_PORT");
-
- tmp = Ns_ConnHost(NSG(conn));
- if (tmp) {
- strncpy(buf, tmp, NS_BUF_SIZE);
- ADD_STRING("SERVER_NAME");
- }
-
- strncpy(buf, SG(request_info).path_translated, NS_BUF_SIZE);
- ADD_STRING("PATH_TRANSLATED");
-
- strncpy(buf, "CGI/1.1", NS_BUF_SIZE);
- ADD_STRING("GATEWAY_INTERFACE");
-
- MAKE_STD_ZVAL(pval);
- pval->type = IS_LONG;
- pval->value.lval = Ns_InfoBootTime();
- zend_hash_update(&EG(symbol_table), "SERVER_BOOTTIME", sizeof("SERVER_BOOTTIME"), &pval, sizeof(zval *), NULL);
-}
-
-/*
- * php_ns_module_main() is called by the per-request handler and
- * "executes" the script
- */
-
-static int
-php_ns_module_main(NSLS_D SLS_DC)
-{
- zend_file_handle file_handle;
- CLS_FETCH();
- ELS_FETCH();
- PLS_FETCH();
-
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = SG(request_info).path_translated;
- file_handle.free_filename = 0;
-
- if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC) == FAILURE) {
- return NS_ERROR;
- }
- php_ns_hash_environment(NSLS_C CLS_CC ELS_CC PLS_CC SLS_CC);
- php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
- php_request_shutdown(NULL);
-
- return NS_OK;
-}
-
-/*
- * php_ns_request_ctor() initializes the per-request data structure
- * and fills it with data provided by the web server
- */
-
-static void
-php_ns_request_ctor(NSLS_D SLS_DC)
-{
- char *server;
- Ns_DString ds;
- char *root;
- int index;
- char *tmp;
-
- server = Ns_ConnServer(NSG(conn));
-
- SG(request_info).query_string = NSG(conn->request->query);
-
- Ns_DStringInit(&ds);
- Ns_UrlToFile(&ds, server, NSG(conn->request->url));
-
- /* path_translated is the absolute path to the file */
- SG(request_info).path_translated = strdup(Ns_DStringValue(&ds));
- Ns_DStringFree(&ds);
- root = Ns_PageRoot(server);
- SG(request_info).request_uri = SG(request_info).path_translated + strlen(root);
- SG(request_info).request_method = NSG(conn)->request->method;
- SG(request_info).content_length = Ns_ConnContentLength(NSG(conn));
- index = Ns_SetIFind(NSG(conn)->headers, "content-type");
- SG(request_info).content_type = index == -1 ? NULL :
- Ns_SetValue(NSG(conn)->headers, index);
-
- tmp = Ns_ConnAuthUser(NSG(conn));
- if(tmp) {
- tmp = estrdup(tmp);
- }
- SG(request_info).auth_user = tmp;
-
- tmp = Ns_ConnAuthPasswd(NSG(conn));
- if(tmp) {
- tmp = estrdup(tmp);
- }
- SG(request_info).auth_password = tmp;
-
- NSG(data_avail) = SG(request_info).content_length;
-}
-
-/*
- * php_ns_request_dtor() destroys all data associated with
- * the per-request structure
- */
-
-static void
-php_ns_request_dtor(NSLS_D SLS_DC)
-{
- free(SG(request_info).path_translated);
-}
-
-/*
- * The php_ns_request_handler() is called per request and handles
- * everything for one request.
- */
-
-static int
-php_ns_request_handler(void *context, Ns_Conn *conn)
-{
- int status = NS_OK;
- SLS_FETCH();
- NSLS_FETCH();
-
- NSG(conn) = conn;
-
- php_ns_request_ctor(NSLS_C SLS_CC);
-
- status = php_ns_module_main(NSLS_C SLS_CC);
-
- php_ns_request_dtor(NSLS_C SLS_CC);
-
- return status;
-}
-
-/*
- * php_ns_config() fetches the configuration data.
- *
- * It understands the "map" and "php_value" command.
- */
-
-static void
-php_ns_config(php_ns_context *ctx)
-{
- int i;
- char *path;
- Ns_Set *set;
-
- path = Ns_ConfigPath(ctx->ns_server, ctx->ns_module, NULL);
- set = Ns_ConfigGetSection(path);
-
- for(i = 0; set && i < Ns_SetSize(set); i++) {
- char *key = Ns_SetKey(set, i);
- char *value = Ns_SetValue(set, i);
-
- if(!strcasecmp(key, "map")) {
- Ns_Log(Notice, "Registering PHP for \"%s\"", value);
- Ns_RegisterRequest(ctx->ns_server, "GET", value, php_ns_request_handler, NULL, ctx, 0);
- Ns_RegisterRequest(ctx->ns_server, "POST", value, php_ns_request_handler, NULL, ctx, 0);
- Ns_RegisterRequest(ctx->ns_server, "HEAD", value, php_ns_request_handler, NULL, ctx, 0);
- } else if(!strcasecmp(key, "php_value")) {
- char *val;
-
- val = strchr(value, ' ');
- if(val) {
- char *new_key;
-
- new_key = estrndup(value, val - value);
-
- do {
- val++;
- } while(*val == ' ');
-
- Ns_Log(Debug, "PHP configuration option '%s=%s'", new_key, val);
- php_alter_ini_entry(new_key, strlen(new_key) + 1, val,
- strlen(val) + 1, PHP_INI_SYSTEM);
-
- efree(new_key);
- }
- }
-
- }
-}
-
-/*
- * php_ns_server_shutdown() performs the last steps before the
- * server exists. Shutdowns basic services and frees memory
- */
-
-static void
-php_ns_server_shutdown(void *context)
-{
- php_ns_context *ctx = (php_ns_context *) context;
-
- ctx->sapi_module->shutdown(ctx->sapi_module);
- sapi_shutdown();
- reentrancy_shutdown();
- tsrm_shutdown();
-
- free(ctx->ns_module);
- free(ctx->ns_server);
- free(ctx);
-}
-
-/*
- * Ns_ModuleInit() is called by AOLserver once at startup
- *
- * This functions allocates basic structures and initializes
- * basic services.
- */
-
-int Ns_ModuleInit(char *server, char *module)
-{
- php_ns_context *ctx;
-
- tsrm_startup(1, 1, 0);
- reentrancy_startup();
- sapi_startup(&sapi_module);
- sapi_module.startup(&sapi_module);
-
- /* TSRM is used to allocate a per-thread structure */
- ns_globals_id = ts_allocate_id(sizeof(ns_globals_struct), NULL, NULL);
-
- /* the context contains data valid for all threads */
- ctx = malloc(sizeof *ctx);
- ctx->sapi_module = &sapi_module;
- ctx->ns_server = strdup(server);
- ctx->ns_module = strdup(module);
-
- /* read the configuration */
- php_ns_config(ctx);
-
- /* register shutdown handler */
- Ns_RegisterServerShutdown(server, php_ns_server_shutdown, ctx);
-
- return NS_OK;
-}
-
-#endif
diff --git a/sapi/aolserver/config.h.stub b/sapi/aolserver/config.h.stub
deleted file mode 100644
index 76f883d6d6..0000000000
--- a/sapi/aolserver/config.h.stub
+++ /dev/null
@@ -1 +0,0 @@
-#undef HAVE_AOLSERVER
diff --git a/sapi/aolserver/config.m4 b/sapi/aolserver/config.m4
deleted file mode 100644
index 64a77c4ff0..0000000000
--- a/sapi/aolserver/config.m4
+++ /dev/null
@@ -1,24 +0,0 @@
-dnl ## $Id$ -*- sh -*-
-
-RESULT=no
-AC_MSG_CHECKING(for AOLserver support)
-AC_ARG_WITH(aolserver,
-[ --with-aolserver=DIR],
-[
- if test ! -d $withval ; then
- AC_MSG_ERROR(You did not specify a directory)
- fi
- PHP_BUILD_THREAD_SAFE
- NS_DIR=$withval
- AC_ADD_INCLUDE($NS_DIR/include)
- AC_DEFINE(HAVE_AOLSERVER)
- PHP_SAPI=aolserver
- PHP_BUILD_SHARED
- INSTALL_IT="\$(SHELL) \$(srcdir)/install-sh -m 0755 $SAPI_SHARED $NS_DIR/root/bin/"
- RESULT=yes
-])
-AC_MSG_RESULT($RESULT)
-
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
diff --git a/sapi/aolserver/php.sym b/sapi/aolserver/php.sym
deleted file mode 100644
index b401ffd2b3..0000000000
--- a/sapi/aolserver/php.sym
+++ /dev/null
@@ -1,2 +0,0 @@
-Ns_ModuleVersion
-Ns_ModuleInit
diff --git a/sapi/apache/Makefile.am b/sapi/apache/Makefile.am
deleted file mode 100644
index 38404758dc..0000000000
--- a/sapi/apache/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-APACHE_INCLUDE=@APACHE_INCLUDE@
-INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend $(APACHE_INCLUDE)
-noinst_LTLIBRARIES=libphpsapi_apache.la
-libphpsapi_apache_la_SOURCES=sapi_apache.c mod_php4.c
diff --git a/sapi/apache/apMakefile.libdir b/sapi/apache/apMakefile.libdir
deleted file mode 100644
index 7b5254013a..0000000000
--- a/sapi/apache/apMakefile.libdir
+++ /dev/null
@@ -1,4 +0,0 @@
-This is a place-holder which indicates to Configure that it shouldn't
-provide the default targets when building the Makefile in this directory.
-Instead it'll just prepend all the important variable definitions, and
-copy the Makefile.tmpl onto the end.
diff --git a/sapi/apache/apMakefile.tmpl b/sapi/apache/apMakefile.tmpl
deleted file mode 100644
index c485d1785f..0000000000
--- a/sapi/apache/apMakefile.tmpl
+++ /dev/null
@@ -1,77 +0,0 @@
-##
-## Apache 1.3 Makefile template for PHP 4.0 Module
-## [src/modules/php4/Makefile.tmpl]
-##
-
-# the parametrized target
-LIB=libphp4.$(LIBEXT)
-
-# objects for building the static library
-OBJS=mod_php4.o
-OBJS_LIB=libmodphp4.a
-
-# objects for building the shared object library
-SHLIB_OBJS=mod_php4.so-o
-SHLIB_OBJS_LIB=libmodphp4.a
-
-# the general targets
-all: lib
-lib: $(LIB)
-
-# build the static library by merging the object files
-libphp4.a: $(OBJS) $(OBJS_LIB)
- cp $(OBJS_LIB) $@
- ar r $@ $(OBJS)
- $(RANLIB) $@
-
-# ugly hack to support older Apache-1.3 betas that don't set $LIBEXT
-libphp4.: $(OBJS) $(OBJS_LIB)
- cp $(OBJS_LIB) $@
- ar r $@ $(OBJS)
- $(RANLIB) $@
- cp libphp4. libphp4.a
-
-# build the shared object library by linking the object files
-libphp4.so: $(SHLIB_OBJS) $(SHLIB_OBJS_LIB)
- rm -f $@
- $(LD_SHLIB) $(LDFLAGS_SHLIB) -o $@ $(SHLIB_OBJS) $(SHLIB_OBJS_LIB) $(LIBS)
-
-# 1. extension .o for shared objects cannot be used here because
-# first these files aren't still shared objects and second we
-# have to use a different name to trigger the different
-# implicit Make rule
-# 2. extension -so.o (as used elsewhere) cannot be used because
-# the suffix feature of Make really wants just .x, so we use
-# extension .so-o
-.SUFFIXES: .o .so-o
-.c.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $<
-.c.so-o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(CFLAGS_SHLIB) $(SPACER) $< && mv $*.o $*.so-o
-
-# cleanup
-clean:
- -rm -f $(OBJS) $(SHLIB_OBJS) $(LIB)
-
-# We really don't expect end users to use this rule. It works only with
-# gcc, and rebuilds Makefile.tmpl. You have to re-run Configure after
-# using it.
-depend:
- cp Makefile.tmpl Makefile.tmpl.bak \
- && sed -ne '1,/^# DO NOT REMOVE/p' Makefile.tmpl > Makefile.new \
- && gcc -MM $(INCLUDES) $(CFLAGS) *.c >> Makefile.new \
- && sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' Makefile.new \
- > Makefile.tmpl \
- && rm Makefile.new
-
-#Dependencies
-
-$(OBJS): Makefile
-
-# DO NOT REMOVE
-mod_php4.o: mod_php4.c $(INCDIR)/httpd.h $(INCDIR)/conf.h \
- $(INCDIR)/alloc.h $(INCDIR)/buff.h \
- $(INCDIR)/http_config.h \
- $(INCDIR)/http_core.h $(INCDIR)/http_main.h \
- $(INCDIR)/http_protocol.h $(INCDIR)/http_request.h \
- $(INCDIR)/http_log.h $(INCDIR)/util_script.h mod_php4.h
diff --git a/sapi/apache/config.h.stub b/sapi/apache/config.h.stub
deleted file mode 100644
index e69de29bb2..0000000000
--- a/sapi/apache/config.h.stub
+++ /dev/null
diff --git a/sapi/apache/config.m4 b/sapi/apache/config.m4
deleted file mode 100644
index 626eaae52f..0000000000
--- a/sapi/apache/config.m4
+++ /dev/null
@@ -1,209 +0,0 @@
-dnl ## -*- sh -*-
-
-AC_MSG_CHECKING(for Apache module support via DSO through APXS)
-AC_ARG_WITH(apxs,
-[ --with-apxs[=FILE] Build shared Apache module. FILE is the optional
- pathname to the Apache apxs tool; defaults to "apxs".],
-[
- if test "$withval" = "yes"; then
- APXS=apxs
- else
- AC_EXPAND_PATH($withval, APXS)
- fi
- APXS_LDFLAGS="@SYBASE_LFLAGS@ @SYBASE_LIBS@ @SYBASE_CT_LFLAGS@ @SYBASE_CT_LIBS@"
- APXS_INCLUDEDIR=`$APXS -q INCLUDEDIR`
- if test -d "$APXS_INCLUDEDIR/xml" ; then
- XML_INCLUDE="$APXS_INCLUDEDIR/xml"
- fi
- AC_ADD_INCLUDE($APXS_INCLUDEDIR)
- if test -n "`$APXS -q CFLAGS | grep USE_HSREGEX`"; then
- APACHE_HAS_REGEX=yes
- fi
- PHP_EXTENSION(apache)
- PHP_SAPI=apache
- APACHE_INSTALL="$APXS -i -a -n php4 $SAPI_SHARED"
- PHP_BUILD_SHARED
- if test -z "`$APXS -q LD_SHLIB`" || test "`$APXS -q LIBEXECDIR`" = "modules"; then
- 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)
-],[
- AC_MSG_RESULT(no)
-])
-
-APACHE_INSTALL_FILES="\$(srcdir)/sapi/apache/mod_php4.* sapi/apache/libphp4.module"
-
-if test "$PHP_SAPI" != "apache"; then
-AC_MSG_CHECKING(for Apache module support)
-AC_ARG_WITH(apache,
-[ --with-apache[=DIR] Build Apache module. DIR is the top-level Apache
- build directory, defaults to /usr/local/etc/httpd.],
-[
- if test "$withval" = "yes"; then
- # Apache's default directory
- withval=/usr/local/apache
- fi
- if test "$withval" != "no"; then
- APACHE_MODULE=yes
- AC_EXPAND_PATH($withval, withval)
- # For Apache 1.2.x
- if test -f $withval/src/httpd.h; then
- APACHE_INCLUDE=-I$withval/src
- APACHE_TARGET=$withval/src
- 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
- AC_DEFINE(HAVE_AP_CONFIG_H)
- fi
- # For Apache 1.3.x
- elif test -f $withval/src/main/httpd.h; then
- APACHE_HAS_REGEX=1
- APACHE_INCLUDE="-I$withval/src/main -I$withval/src/os/unix -I$withval/src/ap"
- APACHE_TARGET=$withval/src/modules/php4
- if test ! -d $APACHE_TARGET; then
- mkdir $APACHE_TARGET
- fi
- 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
- AC_DEFINE(HAVE_AP_CONFIG_H)
- fi
- if test -f $withval/src/include/ap_compat.h; then
- AC_DEFINE(HAVE_AP_COMPAT_H)
- if test ! -f $withval/src/include/ap_config_auto.h; then
- AC_MSG_ERROR(Please run Apache\'s configure or src/Configure program once and try again)
- fi
- else
- if test -f $withval/src/include/compat.h; then
- AC_DEFINE(HAVE_OLD_COMPAT_H)
- fi
- fi
- # Also for Apache 1.3.x
- elif test -f $withval/src/include/httpd.h; then
- APACHE_HAS_REGEX=1
- APACHE_INCLUDE="-I$withval/src/include -I$withval/src/os/unix"
- APACHE_TARGET=$withval/src/modules/php4
- if test -d $withval/src/lib/expat-lite ; then
- XML_INCLUDE=$withval/src/lib/expat-lite
- fi
- if test ! -d $APACHE_TARGET; then
- mkdir $APACHE_TARGET
- fi
- 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
- AC_DEFINE(HAVE_AP_CONFIG_H)
- fi
- if test -f $withval/src/include/ap_compat.h; then
- AC_DEFINE(HAVE_AP_COMPAT_H)
- if test ! -f $withval/src/include/ap_config_auto.h; then
- AC_MSG_ERROR(Please run Apache\'s configure or src/Configure program once and try again)
- fi
- else
- if test -f $withval/src/include/compat.h; then
- AC_DEFINE(HAVE_OLD_COMPAT_H)
- fi
- fi
- # For StrongHold 2.2
- elif test -f $withval/apache/httpd.h; then
- APACHE_INCLUDE=-"I$withval/apache -I$withval/ssl/include"
- APACHE_TARGET=$withval/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"
- 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)
- fi
- if test -f $withval/src/ap_compat.h; then
- AC_DEFINE(HAVE_AP_COMPAT_H)
- if test ! -f $withval/src/include/ap_config_auto.h; then
- AC_MSG_ERROR(Please run Apache\'s configure or src/Configure program once and try again)
- fi
- else
- if test -f $withval/src/compat.h; then
- AC_DEFINE(HAVE_OLD_COMPAT_H)
- fi
- fi
- else
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(Invalid Apache directory - unable to find httpd.h under $withval)
- fi
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-
-INCLUDES="$INCLUDES $APACHE_INCLUDE"
-dnl## AC_SUBST(APACHE_INCLUDE)
-fi
-
-if test "x$APXS" != "x" -a "`uname -sv`" = "AIX 4" -a "$GCC" != "yes"; then
- APXS_EXP="-bE:sapi/apache/mod_php4.exp"
-fi
-
-AC_SUBST(APXS_EXP)
-AC_SUBST(APACHE_INCLUDE)
-AC_SUBST(APACHE_TARGET)
-AC_SUBST(APXS)
-AC_SUBST(APXS_LDFLAGS)
-AC_SUBST(APACHE_INSTALL)
-AC_SUBST(STRONGHOLD)
-
-AC_MSG_CHECKING(for mod_charset compatibility option)
-AC_ARG_WITH(mod_charset,
-[ --with-mod_charset Enable transfer tables for mod_charset (Rus Apache).],
-[
- AC_MSG_RESULT(yes)
- AC_DEFINE(USE_TRANSFER_TABLES)
-],[
- AC_MSG_RESULT(no)
-])
-
-if test "$with_regex" = "apache" && test -z "$APACHE_HAS_REGEX"; then
- with_regex=php
-fi
-
-if test -z "$with_regex" && test -n "$APACHE_HAS_REGEX"; then
- with_regex=apache
-fi
-
-if test -n "$APACHE_MODULE"; then
- if test "$with_regex" = "apache"; then
- APACHE_WANT_HSREGEX=yes
- else
- APACHE_WANT_HSREGEX=no
- fi
- AC_SUBST(APACHE_WANT_HSREGEX)
- PHP_EXTENSION(apache)
- PHP_OUTPUT(sapi/apache/libphp4.module)
- PHP_BUILD_STATIC
-fi
-
-if test -n "$APACHE_INSTALL"; then
- INSTALL_IT=$APACHE_INSTALL
-fi
-
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
diff --git a/sapi/apache/libphp4.module.in b/sapi/apache/libphp4.module.in
deleted file mode 100644
index 2513a7b48d..0000000000
--- a/sapi/apache/libphp4.module.in
+++ /dev/null
@@ -1,7 +0,0 @@
-Name: php4_module
-ConfigStart
- RULE_WANTHSREGEX=@APACHE_WANT_HSREGEX@
- LIBS="@NATIVE_RPATHS@ @PHP_LDFLAGS@ @PHP_LIBS@ @EXTRA_LIBS@ $LIBS"
- RULE_HIDE=yes
- CFLAGS="$CFLAGS -I@abs_srcdir@ -I@abs_srcdir@/libzend -I@abs_builddir@/libzend -I@abs_builddir@"
-ConfigEnd
diff --git a/sapi/apache/mod_php4.c b/sapi/apache/mod_php4.c
deleted file mode 100644
index 7eadee8d6d..0000000000
--- a/sapi/apache/mod_php4.c
+++ /dev/null
@@ -1,629 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_0.txt. |
- | 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. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | (with helpful hints from Dean Gaudet <dgaudet@arctic.org> |
- | PHP 4.0 patches by Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "zend.h"
-#include "php.h"
-
-#include "httpd.h"
-#include "http_config.h"
-#if MODULE_MAGIC_NUMBER > 19980712
-# include "ap_compat.h"
-#else
-# if MODULE_MAGIC_NUMBER > 19980324
-# include "compat.h"
-# endif
-#endif
-#include "http_core.h"
-#include "http_main.h"
-#include "http_protocol.h"
-#include "http_request.h"
-#include "http_log.h"
-
-#include "php_ini.h"
-#include "php_globals.h"
-#include "SAPI.h"
-#include "main.h"
-
-#include "zend_compile.h"
-#include "zend_execute.h"
-#include "zend_highlight.h"
-#include "zend_indent.h"
-
-#include "ext/standard/php_standard.h"
-
-#include "util_script.h"
-
-#include "php_version.h"
-#include "mod_php4.h"
-#if HAVE_MOD_DAV
-# include "mod_dav.h"
-#endif
-
-PHPAPI int apache_php_module_main(request_rec *r, int fd, int display_source_mode SLS_DC);
-void php_save_umask(void);
-void php_restore_umask(void);
-int sapi_apache_read_post(char *buffer, uint count_bytes SLS_DC);
-char *sapi_apache_read_cookies(SLS_D);
-int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC);
-int sapi_apache_send_headers(sapi_headers_struct *sapi_headers SLS_DC);
-int send_php(request_rec *r, int display_source_mode, char *filename);
-int send_parsed_php(request_rec * r);
-int send_parsed_php_source(request_rec * r);
-int php_xbithack_handler(request_rec * r);
-void php_init_handler(server_rec *s, pool *p);
-
-#if MODULE_MAGIC_NUMBER > 19961007
-#define CONST_PREFIX const
-#else
-#define CONST_PREFIX
-#endif
-CONST_PREFIX char *php_apache_value_handler_ex(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2, int mode);
-CONST_PREFIX char *php_apache_value_handler(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2);
-CONST_PREFIX char *php_apache_admin_value_handler(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2);
-CONST_PREFIX char *php_apache_flag_handler(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2);
-CONST_PREFIX char *php_apache_flag_handler_ex(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2, int mode);
-CONST_PREFIX char *php_apache_admin_flag_handler(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2);
-
-/* ### these should be defined in mod_php4.h or somewhere else */
-#define USE_PATH 1
-#define IGNORE_URL 2
-
-module MODULE_VAR_EXPORT php4_module;
-
-int saved_umask;
-static unsigned char apache_php_initialized;
-
-typedef struct _php_per_dir_entry {
- char *key;
- char *value;
- uint key_length;
- uint value_length;
- int type;
-} php_per_dir_entry;
-
-#if WIN32|WINNT
-/* popenf isn't working on Windows, use open instead*/
-# ifdef popenf
-# undef popenf
-# endif
-# define popenf(p,n,f,m) open((n),(f),(m))
-# ifdef pclosef
-# undef pclosef
-# endif
-# define pclosef(p,f) close(f)
-#else
-# define php3i_popenf(p,n,f,m) popenf((p),(n),(f),(m))
-#endif
-
-php_apache_info_struct php_apache_info; /* active config */
-
-/* some systems are missing these from their header files */
-
-void php_save_umask(void)
-{
- saved_umask = umask(077);
- umask(saved_umask);
-}
-
-
-static int zend_apache_ub_write(const char *str, uint str_length)
-{
- int ret;
- SLS_FETCH();
-
- if (SG(server_context)) {
- ret = rwrite(str, str_length, (request_rec *) SG(server_context));
- } else {
- ret = fwrite(str, 1, str_length, stdout);
- }
- if(ret != str_length) {
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- if(!PG(ignore_user_abort)) zend_bailout();
- }
- return ret;
-}
-
-
-int sapi_apache_read_post(char *buffer, uint count_bytes SLS_DC)
-{
- uint total_read_bytes=0, read_bytes;
- request_rec *r = (request_rec *) SG(server_context);
- void (*handler)(int);
-
- handler = signal(SIGPIPE, SIG_IGN);
- while (total_read_bytes<count_bytes) {
- hard_timeout("Read POST information", r); /* start timeout timer */
- read_bytes = get_client_block(r, buffer+total_read_bytes, count_bytes-total_read_bytes);
- reset_timeout(r);
- if (read_bytes<=0) {
- break;
- }
- total_read_bytes += read_bytes;
- }
- signal(SIGPIPE, handler);
- return total_read_bytes;
-}
-
-
-char *sapi_apache_read_cookies(SLS_D)
-{
- return (char *) table_get(((request_rec *) SG(server_context))->subprocess_env, "HTTP_COOKIE");
-}
-
-
-int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC)
-{
- char *header_name, *header_content, *p;
- request_rec *r = (request_rec *) SG(server_context);
-
- header_name = sapi_header->header;
-
- header_content = p = strchr(header_name, ':');
- if (!p) {
- return 0;
- }
-
- *p = 0;
- do {
- header_content++;
- } while (*header_content==' ');
-
- if (!strcasecmp(header_name, "Content-Type")) {
- r->content_type = pstrdup(r->pool, header_content);
- } else if (!strcasecmp(header_name, "Set-Cookie")) {
- table_add(r->headers_out, header_name, header_content);
- } else {
- table_set(r->headers_out, header_name, header_content);
- }
-
- *p = ':'; /* a well behaved header handler shouldn't change its original arguments */
-
- efree(sapi_header->header);
-
- return 0; /* don't use the default SAPI mechanism, Apache duplicates this functionality */
-}
-
-
-int sapi_apache_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
-{
- ((request_rec *) SG(server_context))->status = SG(sapi_headers).http_response_code;
- send_http_header((request_rec *) SG(server_context));
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-
-sapi_module_struct sapi_module = {
- "PHP Language", /* name */
-
- php_module_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- zend_apache_ub_write, /* unbuffered write */
-
- php_error, /* error handler */
-
- sapi_apache_header_handler, /* header handler */
- sapi_apache_send_headers, /* send headers handler */
- NULL, /* send header handler */
-
- sapi_apache_read_post, /* read POST data */
- sapi_apache_read_cookies, /* read Cookies */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-
-void php_restore_umask(void)
-{
- umask(saved_umask);
-}
-
-
-static void init_request_info(SLS_D)
-{
- request_rec *r = ((request_rec *) SG(server_context));
- char *content_length = (char *) table_get(r->subprocess_env, "CONTENT_LENGTH");
- const char *authorization=NULL;
- char *tmp;
-
- SG(request_info).query_string = r->args;
- SG(request_info).path_translated = r->filename;
- SG(request_info).request_uri = r->uri;
- SG(request_info).request_method = (char *)r->method;
- SG(request_info).content_type = (char *) table_get(r->subprocess_env, "CONTENT_TYPE");
- SG(request_info).content_length = (content_length ? atoi(content_length) : 0);
-
- if (r->headers_in) {
- authorization = table_get(r->headers_in, "Authorization");
- }
- if (authorization
-/* && !auth_type(r) */
- && !strcmp(getword(r->pool, &authorization, ' '), "Basic")) {
- tmp = uudecode(r->pool, authorization);
- SG(request_info).auth_user = getword_nulls_nc(r->pool, &tmp, ':');
- if (SG(request_info).auth_user) {
- SG(request_info).auth_user = estrdup(SG(request_info).auth_user);
- }
- SG(request_info).auth_password = tmp;
- if (SG(request_info).auth_password) {
- SG(request_info).auth_password = estrdup(SG(request_info).auth_password);
- }
- } else {
- SG(request_info).auth_user = NULL;
- SG(request_info).auth_password = NULL;
- }
-}
-
-
-static int php_apache_alter_ini_entries(php_per_dir_entry *per_dir_entry)
-{
- php_alter_ini_entry(per_dir_entry->key, per_dir_entry->key_length+1, per_dir_entry->value, per_dir_entry->value_length+1, per_dir_entry->type);
- return 0;
-}
-
-
-int send_php(request_rec *r, int display_source_mode, char *filename)
-{
- int fd, retval;
- HashTable *per_dir_conf;
- SLS_FETCH();
-
- if (setjmp(EG(bailout))!=0) {
- return OK;
- }
- per_dir_conf = (HashTable *) get_module_config(r->per_dir_config, &php4_module);
- zend_hash_apply((HashTable *) per_dir_conf, (int (*)(void *)) php_apache_alter_ini_entries);
-
- /* We don't accept OPTIONS requests, but take everything else */
- if (r->method_number == M_OPTIONS) {
- r->allowed |= (1 << METHODS) - 1;
- return DECLINED;
- }
-
- /* Make sure file exists */
- if (filename == NULL && r->finfo.st_mode == 0) {
- return NOT_FOUND;
- }
-
- /* If PHP parser engine has been turned off with an "engine off"
- * directive, then decline to handle this request
- */
- if (!php_apache_info.engine) {
- r->content_type = "text/html";
- r->allowed |= (1 << METHODS) - 1;
- return DECLINED;
- }
- if (filename == NULL) {
- filename = r->filename;
- }
- /* Open the file */
- if ((fd = popenf(r->pool, filename, O_RDONLY, 0)) == -1) {
- log_reason("file permissions deny server access", filename, r);
- return FORBIDDEN;
- }
-
- /* Apache 1.2 has a more complex mechanism for reading POST data */
-#if MODULE_MAGIC_NUMBER > 19961007
- if ((retval = setup_client_block(r, REQUEST_CHUNKED_ERROR)))
- return retval;
-#endif
-
- if (php_apache_info.last_modified) {
-#if MODULE_MAGIC_NUMBER < 19970912
- if ((retval = set_last_modified(r, r->finfo.st_mtime))) {
- return retval;
- }
-#else
- update_mtime (r, r->finfo.st_mtime);
- set_last_modified(r);
- set_etag(r);
-#endif
- }
- /* Assume output will be HTML. Individual scripts may change this
- further down the line */
- r->content_type = "text/html";
-
- /* Init timeout */
- hard_timeout("send", r);
-
- SG(server_context) = r;
-
- php_save_umask();
- chdir_file(filename);
- add_common_vars(r);
- add_cgi_vars(r);
-
- init_request_info(SLS_C);
- apache_php_module_main(r, fd, display_source_mode SLS_CC);
-
- /* Done, restore umask, turn off timeout, close file and return */
- php_restore_umask();
- kill_timeout(r);
- pclosef(r->pool, fd);
- return OK;
-}
-
-
-int send_parsed_php(request_rec * r)
-{
- return send_php(r, 0, NULL);
-}
-
-
-int send_parsed_php_source(request_rec * r)
-{
- return send_php(r, 1, NULL);
-}
-
-
-static int destroy_per_dir_entry(php_per_dir_entry *per_dir_entry)
-{
- free(per_dir_entry->key);
- free(per_dir_entry->value);
- return 1;
-}
-
-static void copy_per_dir_entry(php_per_dir_entry *per_dir_entry)
-{
- php_per_dir_entry tmp = *per_dir_entry;
-
- per_dir_entry->key = (char *) malloc(tmp.key_length+1);
- memcpy(per_dir_entry->key, tmp.key, tmp.key_length);
- per_dir_entry->key[per_dir_entry->key_length] = 0;
-
- per_dir_entry->value = (char *) malloc(tmp.value_length+1);
- memcpy(per_dir_entry->value, tmp.value, tmp.value_length);
- per_dir_entry->value[per_dir_entry->value_length] = 0;
-}
-
-
-static void php_destroy_per_dir_info(HashTable *per_dir_info)
-{
- zend_hash_destroy(per_dir_info);
- free(per_dir_info);
-}
-
-static void *php_create_dir(pool *p, char *dummy)
-{
- HashTable *per_dir_info;
-
- per_dir_info = (HashTable *) malloc(sizeof(HashTable));
- zend_hash_init(per_dir_info, 5, NULL, (int (*)(void *)) destroy_per_dir_entry, 1);
- register_cleanup(p, (void *) per_dir_info, (void (*)(void *)) php_destroy_per_dir_info, (void (*)(void *)) zend_hash_destroy);
-
- return per_dir_info;
-}
-
-
-static void *php_merge_dir(pool *p, void *basev, void *addv)
-{
- php_per_dir_entry tmp;
-
- zend_hash_merge((HashTable *) addv, (HashTable *) basev, (void (*)(void *)) copy_per_dir_entry, &tmp, sizeof(php_per_dir_entry), 0);
- return addv;
-}
-
-
-CONST_PREFIX char *php_apache_value_handler_ex(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2, int mode)
-{
- php_per_dir_entry per_dir_entry;
-
- if (!apache_php_initialized) {
- sapi_startup(&sapi_module);
- php_module_startup(&sapi_module);
- apache_php_initialized = 1;
- }
- per_dir_entry.type = mode;
-
- per_dir_entry.key_length = strlen(arg1);
- per_dir_entry.value_length = strlen(arg2);
-
- per_dir_entry.key = (char *) malloc(per_dir_entry.key_length+1);
- memcpy(per_dir_entry.key, arg1, per_dir_entry.key_length);
- per_dir_entry.key[per_dir_entry.key_length] = 0;
-
- per_dir_entry.value = (char *) malloc(per_dir_entry.value_length+1);
- memcpy(per_dir_entry.value, arg2, per_dir_entry.value_length);
- per_dir_entry.value[per_dir_entry.value_length] = 0;
-
- zend_hash_update((HashTable *) conf, per_dir_entry.key, per_dir_entry.key_length, &per_dir_entry, sizeof(php_per_dir_entry), NULL);
- return NULL;
-}
-
-
-CONST_PREFIX char *php_apache_value_handler(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2)
-{
- return php_apache_value_handler_ex(cmd, conf, arg1, arg2, PHP_INI_PERDIR);
-}
-
-
-CONST_PREFIX char *php_apache_admin_value_handler(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2)
-{
- return php_apache_value_handler_ex(cmd, conf, arg1, arg2, PHP_INI_SYSTEM);
-}
-
-
-CONST_PREFIX char *php_apache_flag_handler_ex(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2, int mode)
-{
- char bool_val[2];
-
- if (!strcasecmp(arg2, "On")) {
- bool_val[0] = '1';
- } else {
- bool_val[0] = '0';
- }
- bool_val[1] = 0;
-
- return php_apache_value_handler_ex(cmd, conf, arg1, bool_val, mode);
-}
-
-
-CONST_PREFIX char *php_apache_flag_handler(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2)
-{
- return php_apache_flag_handler_ex(cmd, conf, arg1, arg2, PHP_INI_PERDIR);
-}
-
-
-CONST_PREFIX char *php_apache_admin_flag_handler(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2)
-{
- return php_apache_flag_handler_ex(cmd, conf, arg1, arg2, PHP_INI_SYSTEM);
-}
-
-
-
-
-int php_xbithack_handler(request_rec * r)
-{
- php_apache_info_struct *conf;
-
- conf = (php_apache_info_struct *) get_module_config(r->per_dir_config, &php4_module);
- if (!(r->finfo.st_mode & S_IXUSR)) {
- r->allowed |= (1 << METHODS) - 1;
- return DECLINED;
- }
- if (conf->xbithack == 0) {
- r->allowed |= (1 << METHODS) - 1;
- return DECLINED;
- }
- return send_parsed_php(r);
-}
-
-static void apache_php_module_shutdown_wrapper(void)
-{
- apache_php_initialized = 0;
- sapi_module.shutdown(&sapi_module);
-}
-
-
-void php_init_handler(server_rec *s, pool *p)
-{
- register_cleanup(p, NULL, (void (*)(void *))apache_php_module_shutdown_wrapper, (void (*)(void *))php_module_shutdown_for_exec);
- if (!apache_php_initialized) {
- sapi_startup(&sapi_module);
- php_module_startup(&sapi_module);
- apache_php_initialized = 1;
- }
-#if MODULE_MAGIC_NUMBER >= 19980527
- if (PG(expose_php)) {
- ap_add_version_component("PHP/" PHP_VERSION);
- }
-#endif
-}
-
-
-#if HAVE_MOD_DAV
-
-extern int phpdav_mkcol_test_handler(request_rec *r);
-extern int phpdav_mkcol_create_handler(request_rec *r);
-
-/* conf is being read twice (both here and in send_php()) */
-int send_parsed_php_dav_script(request_rec *r)
-{
- php_apache_info_struct *conf;
-
- conf = (php_apache_info_struct *) get_module_config(r->per_dir_config,
- &php4_module);
- return send_php(r, 0, 0, conf->dav_script);
-}
-
-static int php_type_checker(request_rec *r)
-{
- php_apache_info_struct *conf;
-
- conf = (php_apache_info_struct *)get_module_config(r->per_dir_config,
- &php4_module);
-
- /* If DAV support is enabled, use mod_dav's type checker. */
- if (conf->dav_script) {
- dav_api_set_request_handler(r, send_parsed_php_dav_script);
- dav_api_set_mkcol_handlers(r, phpdav_mkcol_test_handler,
- phpdav_mkcol_create_handler);
- /* leave the rest of the request to mod_dav */
- return dav_api_type_checker(r);
- }
-
- return DECLINED;
-}
-
-#else /* HAVE_MOD_DAV */
-
-# define php_type_checker NULL
-
-#endif /* HAVE_MOD_DAV */
-
-
-handler_rec php_handlers[] =
-{
- {"application/x-httpd-php", send_parsed_php},
- {"application/x-httpd-php-source", send_parsed_php_source},
- {"text/html", php_xbithack_handler},
- {NULL}
-};
-
-
-command_rec php_commands[] =
-{
- {"php_value", php_apache_value_handler, NULL, OR_OPTIONS, TAKE2, "PHP Value Modifier"},
- {"php_flag", php_apache_flag_handler, NULL, OR_OPTIONS, TAKE2, "PHP Flag Modifier"},
- {"php_admin_value", php_apache_admin_value_handler, NULL, ACCESS_CONF|RSRC_CONF, TAKE2, "PHP Value Modifier (Admin)"},
- {"php_admin_flag", php_apache_admin_flag_handler, NULL, ACCESS_CONF|RSRC_CONF, TAKE2, "PHP Flag Modifier (Admin)"},
- {NULL}
-};
-
-
-
-module MODULE_VAR_EXPORT php4_module =
-{
- STANDARD_MODULE_STUFF,
- php_init_handler, /* initializer */
- php_create_dir, /* per-directory config creator */
- php_merge_dir, /* dir merger */
- NULL, /* per-server config creator */
- NULL, /* merge server config */
- php_commands, /* command table */
- php_handlers, /* handlers */
- NULL, /* filename translation */
- NULL, /* check_user_id */
- NULL, /* check auth */
- NULL, /* check access */
- php_type_checker, /* type_checker */
- NULL, /* fixups */
- NULL /* logger */
-#if MODULE_MAGIC_NUMBER >= 19970103
- ,NULL /* header parser */
-#endif
-#if MODULE_MAGIC_NUMBER >= 19970719
- ,NULL /* child_init */
-#endif
-#if MODULE_MAGIC_NUMBER >= 19970728
- ,NULL /* child_exit */
-#endif
-#if MODULE_MAGIC_NUMBER >= 19970902
- ,NULL /* post read-request */
-#endif
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/sapi/apache/mod_php4.exp b/sapi/apache/mod_php4.exp
deleted file mode 100644
index 2dca1256c2..0000000000
--- a/sapi/apache/mod_php4.exp
+++ /dev/null
@@ -1 +0,0 @@
-php4_module
diff --git a/sapi/apache/mod_php4.h b/sapi/apache/mod_php4.h
deleted file mode 100644
index 4fe749d2d6..0000000000
--- a/sapi/apache/mod_php4.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_0.txt. |
- | 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. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifndef _MOD_PHP4_H
-#define _MOD_PHP4_H
-
-#if !defined(WIN32) && !defined(WINNT)
-#ifndef MODULE_VAR_EXPORT
-#define MODULE_VAR_EXPORT
-#endif
-#endif
-
-typedef struct {
- long engine;
- long last_modified;
- char *dav_script;
- long xbithack;
-} php_apache_info_struct;
-
-extern php_apache_info_struct php_apache_info;
-
-#if MSVC5
-#define S_IXUSR _S_IEXEC
-#endif
-
-#endif /* _MOD_PHP4_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/sapi/apache/php.sym b/sapi/apache/php.sym
deleted file mode 100644
index 2dca1256c2..0000000000
--- a/sapi/apache/php.sym
+++ /dev/null
@@ -1 +0,0 @@
-php4_module
diff --git a/sapi/apache/sapi_apache.c b/sapi/apache/sapi_apache.c
deleted file mode 100644
index 724e87238c..0000000000
--- a/sapi/apache/sapi_apache.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_0.txt. |
- | 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. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | (with helpful hints from Dean Gaudet <dgaudet@arctic.org> |
- | PHP 4.0 patches by: |
- | Zeev Suraski <zeev@zend.com> |
- | Stig Bakken <ssb@fast.no> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "php.h"
-
-#include "httpd.h"
-#include "http_config.h"
-#if MODULE_MAGIC_NUMBER > 19980712
-# include "ap_compat.h"
-#else
-# if MODULE_MAGIC_NUMBER > 19980324
-# include "compat.h"
-# endif
-#endif
-#include "http_core.h"
-#include "http_main.h"
-#include "http_protocol.h"
-#include "http_request.h"
-#include "http_log.h"
-
-#include "zend.h"
-#include "php_ini.h"
-#include "php_globals.h"
-#include "SAPI.h"
-#include "main.h"
-#include "zend_compile.h"
-#include "zend_execute.h"
-#include "zend_highlight.h"
-#include "zend_indent.h"
-#include "ext/standard/php_standard.h"
-#include "util_script.h"
-#include "php_version.h"
-/*#include "mod_php4.h"*/
-
-PHPAPI int apache_php_module_main(request_rec *r, int fd, int display_source_mode SLS_DC)
-{
- zend_file_handle file_handle;
-#ifdef ZTS
- zend_compiler_globals cg;
- zend_executor_globals eg;
- php_core_globals pcg;
- zend_compiler_globals *compiler_globals=&cg;
- zend_executor_globals *executor_globals=&eg;
- php_core_globals *core_globals=&pcg;
-#endif
- SLS_FETCH();
-
- if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC) == FAILURE) {
- return FAILURE;
- }
- file_handle.type = ZEND_HANDLE_FD;
- file_handle.handle.fd = fd;
- file_handle.filename = SG(request_info).path_translated;
- file_handle.free_filename = 0;
-
- if (display_source_mode) {
- zend_syntax_highlighter_ini syntax_highlighter_ini;
-
- if (open_file_for_scanning(&file_handle CLS_CC)==SUCCESS) {
- php_get_highlight_struct(&syntax_highlighter_ini);
- zend_highlight(&syntax_highlighter_ini);
- return OK;
- } else {
- return NOT_FOUND;
- }
- } else {
- (void) php_execute_script(&file_handle CLS_CC ELS_CC);
- }
-
- php3_header(); /* Make sure headers have been sent */
- php_end_ob_buffering(1);
- return (OK);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/sapi/cgi/Makefile.am b/sapi/cgi/Makefile.am
deleted file mode 100644
index b4255563e5..0000000000
--- a/sapi/cgi/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-noinst_LTLIBRARIES=libphpsapi_cgi.la
-libphpsapi_cgi_la_SOURCES=cgi_main.c
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
deleted file mode 100644
index 1ffaba3d25..0000000000
--- a/sapi/cgi/cgi_main.c
+++ /dev/null
@@ -1,497 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_0.txt. |
- | 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. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Stig Bakken <ssb@fast.no> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include "php.h"
-#include "php_globals.h"
-
-#include "SAPI.h"
-
-#if CGI_BINARY
-
-#include <stdio.h>
-#include "php.h"
-#ifdef MSVC5
-#include "win32/time.h"
-#include "win32/signal.h"
-#include <process.h>
-#else
-#include "build-defs.h"
-#endif
-#if HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-#if HAVE_SETLOCALE
-#include <locale.h>
-#endif
-#include "zend.h"
-#include "php_ini.h"
-#include "php_globals.h"
-#include "main.h"
-#include "fopen-wrappers.h"
-#include "ext/standard/php_standard.h"
-#include "snprintf.h"
-#if WIN32|WINNT
-#include <io.h>
-#include <fcntl.h>
-#include "win32/syslog.h"
-#include "win32/php_registry.h"
-#else
-#include <syslog.h>
-#endif
-
-#include "zend_compile.h"
-#include "zend_execute.h"
-#include "zend_highlight.h"
-#include "zend_indent.h"
-
-
-#if MSVC5 || !defined(HAVE_GETOPT)
-#include "php_getopt.h"
-#endif
-
-PHPAPI extern char *php3_ini_path;
-
-#define PHP_MODE_STANDARD 1
-#define PHP_MODE_HIGHLIGHT 2
-#define PHP_MODE_INDENT 3
-
-PHPAPI extern char *optarg;
-PHPAPI extern int optind;
-
-
-static int zend_cgibin_ub_write(const char *str, uint str_length)
-{
- return fwrite(str, 1, str_length, stdout);
-}
-
-
-static void sapi_cgi_send_header(sapi_header_struct *sapi_header, void *server_context)
-{
- if (sapi_header) {
- PHPWRITE_H(sapi_header->header, sapi_header->header_len);
- }
- PHPWRITE_H("\r\n", 2);
-}
-
-
-static int sapi_cgi_read_post(char *buffer, uint count_bytes SLS_DC)
-{
- uint read_bytes=0, tmp_read_bytes;
-
- count_bytes = MIN(count_bytes, SG(request_info).content_length-SG(read_post_bytes));
- while (read_bytes < count_bytes) {
- tmp_read_bytes = read(0, buffer+read_bytes, count_bytes-read_bytes);
- if (tmp_read_bytes<=0) {
- break;
- }
- read_bytes += tmp_read_bytes;
- }
- return read_bytes;
-}
-
-
-static char *sapi_cgi_read_cookies(SLS_D)
-{
- return getenv("HTTP_COOKIE");
-}
-
-
-static sapi_module_struct sapi_module = {
- "PHP Language", /* name */
-
- php_module_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- zend_cgibin_ub_write, /* unbuffered write */
-
- php_error, /* error handler */
-
- NULL, /* header handler */
- NULL, /* send headers handler */
- sapi_cgi_send_header, /* send header handler */
-
- sapi_cgi_read_post, /* read POST data */
- sapi_cgi_read_cookies, /* read Cookies */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-
-static void php_cgi_usage(char *argv0)
-{
- char *prog;
-
- prog = strrchr(argv0, '/');
- if (prog) {
- prog++;
- } else {
- prog = "php";
- }
-
- php_printf("Usage: %s [-q] [-h]"
- " [-s]"
- " [-v] [-i] [-f <file>] | "
- "{<file> [args...]}\n"
- " -q Quiet-mode. Suppress HTTP Header output.\n"
- " -s Display colour syntax highlighted source.\n"
- " -f<file> Parse <file>. Implies `-q'\n"
- " -v Version number\n"
- " -c<path> Look for php.ini file in this directory\n"
-#if SUPPORT_INTERACTIVE
- " -a Run interactively\n"
-#endif
- " -d foo[=bar] Define INI entry foo with value 'bar'\n"
- " -e Generate extended information for debugger/profiler\n"
- " -i PHP information\n"
- " -h This help\n", prog);
-}
-
-
-static void init_request_info(SLS_D)
-{
- char *content_length = getenv("CONTENT_LENGTH");
-
- SG(request_info).request_method = getenv("REQUEST_METHOD");
- SG(request_info).query_string = getenv("QUERY_STRING");
- SG(request_info).request_uri = getenv("PATH_INFO");
- SG(request_info).path_translated = NULL; /* we have to update it later, when we have that information */
- SG(request_info).content_type = getenv("CONTENT_TYPE");
- SG(request_info).content_length = (content_length?atoi(content_length):0);
-
- /* CGI does not support HTTP authentication */
- SG(request_info).auth_user = NULL;
- SG(request_info).auth_password = NULL;
-}
-
-
-static void define_command_line_ini_entry(char *arg)
-{
- char *name, *value;
-
- name = arg;
- value = strchr(arg, '=');
- if (value) {
- *value = 0;
- value++;
- } else {
- value = "1";
- }
- php_alter_ini_entry(name, strlen(name), value, strlen(value), PHP_INI_SYSTEM);
-}
-
-
-int main(int argc, char *argv[])
-{
- int cgi = 0, c, i, len;
- zend_file_handle file_handle;
- char *s;
-/* temporary locals */
- int cgi_started=0;
- int behavior=PHP_MODE_STANDARD;
- int no_headers=0;
- int free_path_translated=0;
-#if SUPPORT_INTERACTIVE
- int interactive=0;
-#endif
-/* end of temporary locals */
-#ifdef ZTS
- zend_compiler_globals *compiler_globals;
- zend_executor_globals *executor_globals;
- php_core_globals *core_globals;
- sapi_globals_struct *sapi_globals;
-#endif
-
-
-#ifndef ZTS
- if (setjmp(EG(bailout))!=0) {
- return -1;
- }
-#endif
-
-#ifdef ZTS
- tsrm_startup(1,1,0);
-#endif
-
- sapi_startup(&sapi_module);
-
-#if WIN32|WINNT
- _fmode = _O_BINARY; /*sets default for file streams to binary */
- setmode(_fileno(stdin), O_BINARY); /* make the stdio mode be binary */
- setmode(_fileno(stdout), O_BINARY); /* make the stdio mode be binary */
- setmode(_fileno(stderr), O_BINARY); /* make the stdio mode be binary */
-#endif
-
-
- /* Make sure we detect we are a cgi - a bit redundancy here,
- but the default case is that we have to check only the first one. */
- if (getenv("SERVER_SOFTWARE")
- || getenv("SERVER_NAME")
- || getenv("GATEWAY_INTERFACE")
- || getenv("REQUEST_METHOD")) {
- cgi = 1;
- if (argc > 1)
- request_info.php_argv0 = strdup(argv[1]);
- else request_info.php_argv0 = NULL;
-#if FORCE_CGI_REDIRECT
- if (!getenv("REDIRECT_STATUS")) {
- PUTS("<b>Security Alert!</b> PHP CGI cannot be accessed directly.\n\
-\n\
-<P>This PHP CGI binary was compiled with force-cgi-redirect enabled. This\n\
-means that a page will only be served up if the REDIRECT_STATUS CGI variable is\n\
-set. This variable is set, for example, by Apache's Action directive redirect.\n\
-<P>You may disable this restriction by recompiling the PHP binary with the\n\
---disable-force-cgi-redirect switch. If you do this and you have your PHP CGI\n\
-binary accessible somewhere in your web tree, people will be able to circumvent\n\
-.htaccess security by loading files through the PHP parser. A good way around\n\
-this is to define doc_root in your php.ini file to something other than your\n\
-top-level DOCUMENT_ROOT. This way you can separate the part of your web space\n\n\
-which uses PHP from the normal part using .htaccess security. If you do not have\n\
-any .htaccess restrictions anywhere on your site you can leave doc_root undefined.\n\
-\n");
-
- /* remove that detailed explanation some time */
-
- return FAILURE;
- }
-#endif /* FORCE_CGI_REDIRECT */
- }
-
- if (php_module_startup(&sapi_module)==FAILURE) {
- return FAILURE;
- }
-#ifdef ZTS
- compiler_globals = ts_resource(compiler_globals_id);
- executor_globals = ts_resource(executor_globals_id);
- core_globals = ts_resource(core_globals_id);
- sapi_globals = ts_resource(sapi_globals_id);
- if (setjmp(EG(bailout))!=0) {
- return -1;
- }
-#endif
-
- init_request_info(SLS_C);
- SG(server_context) = (void *) 1; /* avoid server_context==NULL checks */
- CG(extended_info) = 0;
-
- if (!cgi) { /* never execute the arguments if you are a CGI */
- request_info.php_argv0 = NULL;
- while ((c = getopt(argc, argv, "c:d:qvisnaeh?vf:")) != -1) {
- switch (c) {
- case 'f':
- if (!cgi_started){
- if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
- php_module_shutdown();
- return FAILURE;
- }
- }
- if (no_headers) {
- SG(headers_sent) = 1;
- }
- cgi_started=1;
- SG(request_info).path_translated = estrdup(optarg);
- free_path_translated=1;
- /* break missing intentionally */
- case 'q':
- no_headers = 1;
- break;
- case 'v':
- if (!cgi_started) {
- if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
- php_module_shutdown();
- return FAILURE;
- }
- }
- if (no_headers) {
- SG(headers_sent) = 1;
- }
- php_printf("%s\n", PHP_VERSION);
- exit(1);
- break;
- case 'i':
- if (!cgi_started) {
- if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
- php_module_shutdown();
- return FAILURE;
- }
- }
- if (no_headers) {
- SG(headers_sent) = 1;
- }
- cgi_started=1;
- php_print_info(0xFFFFFFFF);
- exit(1);
- break;
- case 's':
- behavior=PHP_MODE_HIGHLIGHT;
- break;
- case 'n':
- behavior=PHP_MODE_INDENT;
- break;
- case 'c':
- php3_ini_path = strdup(optarg); /* intentional leak */
- break;
- case 'a':
-#if SUPPORT_INTERACTIVE
- printf("Interactive mode enabled\n\n");
- interactive=1;
-#else
- printf("Interactive mode not supported!\n\n");
-#endif
- break;
- case 'e':
- CG(extended_info) = 1;
- break;
- case 'h':
- case '?':
- php_output_startup();
- SG(headers_sent) = 1;
- php_cgi_usage(argv[0]);
- exit(1);
- break;
- case 'd':
- define_command_line_ini_entry(optarg);
- break;
- default:
- break;
- }
- }
- } /* not cgi */
-
-#if SUPPORT_INTERACTIVE
- EG(interactive) = interactive;
-#endif
-
- if (!cgi_started) {
- if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
- php_module_shutdown();
- return FAILURE;
- }
- }
- if (no_headers) {
- SG(headers_sent) = 1;
- }
- file_handle.filename = "-";
- file_handle.type = ZEND_HANDLE_FP;
- file_handle.handle.fp = stdin;
-
-
- if (!cgi) {
- if (!SG(request_info).query_string) {
- for (i = optind, len = 0; i < argc; i++)
- len += strlen(argv[i]) + 1;
-
- s = malloc(len + 1); /* leak - but only for command line version, so ok */
- *s = '\0'; /* we are pretending it came from the environment */
- for (i = optind, len = 0; i < argc; i++) {
- strcat(s, argv[i]);
- if (i < (argc - 1))
- strcat(s, "+");
- }
- SG(request_info).query_string = s;
- }
- if (!SG(request_info).path_translated && argc > optind)
- SG(request_info).path_translated = argv[optind];
- }
- /* If for some reason the CGI interface is not setting the
- PATH_TRANSLATED correctly, SG(request_info).path_translated is NULL.
- We still call php3_fopen_for_parser, because if you set doc_root
- or user_dir configuration directives, PATH_INFO is used to construct
- the filename as a side effect of php3_fopen_for_parser.
- */
- if(cgi) {
- SG(request_info).path_translated = getenv("PATH_TRANSLATED");
- }
- if (cgi || SG(request_info).path_translated) {
- file_handle.handle.fp = php3_fopen_for_parser();
- file_handle.filename = SG(request_info).path_translated;
- }
-
- if (cgi && !file_handle.handle.fp) {
- PUTS("No input file specified.\n");
-#if 0 /* this is here for debuging under windows */
- if (argc) {
- i = 0;
- php_printf("\nargc %d\n",argc);
- while (i <= argc) {
- php_printf("%s\n",argv[i]);
- i++;
- }
- }
-#endif
- php_request_shutdown((void *) 0);
- php_module_shutdown();
- return FAILURE;
- } else if (file_handle.handle.fp && file_handle.handle.fp!=stdin) {
- /* #!php support */
- c = fgetc(file_handle.handle.fp);
- if (c == '#') {
- while (c != 10 && c != 13) {
- c = fgetc(file_handle.handle.fp); /* skip to end of line */
- }
- CG(zend_lineno)++;
- } else {
- rewind(file_handle.handle.fp);
- }
- }
-
- file_handle.free_filename = 0;
- switch (behavior) {
- case PHP_MODE_STANDARD:
- php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
- break;
- case PHP_MODE_HIGHLIGHT: {
- zend_syntax_highlighter_ini syntax_highlighter_ini;
-
- if (open_file_for_scanning(&file_handle CLS_CC)==SUCCESS) {
- php_get_highlight_struct(&syntax_highlighter_ini);
- zend_highlight(&syntax_highlighter_ini);
- fclose(file_handle.handle.fp);
- }
- return 0;
- }
- break;
- case PHP_MODE_INDENT:
- open_file_for_scanning(&file_handle CLS_CC);
- zend_indent();
- fclose(file_handle.handle.fp);
- return 0;
- break;
- }
-
- php3_header(); /* Make sure headers have been sent */
- if (free_path_translated)
- efree(SG(request_info).path_translated);
- php_request_shutdown((void *) 0);
- php_module_shutdown();
-#ifdef ZTS
- tsrm_shutdown();
-#endif
- return SUCCESS;
-}
-
-
-#endif
diff --git a/sapi/cgi/config.h.in b/sapi/cgi/config.h.in
deleted file mode 100644
index e69de29bb2..0000000000
--- a/sapi/cgi/config.h.in
+++ /dev/null
diff --git a/sapi/cgi/config.m4 b/sapi/cgi/config.m4
deleted file mode 100644
index cd872d5cbc..0000000000
--- a/sapi/cgi/config.m4
+++ /dev/null
@@ -1,84 +0,0 @@
-
-if test "$PHP_SAPI" = "cgi"; then
-AC_MSG_CHECKING(whether to force Apache CGI redirect)
-AC_ARG_ENABLE(force-cgi-redirect,
-[ --enable-force-cgi-redirect
- Enable the security check for internal server
- redirects. You should use this if you are
- running the CGI version with Apache. ],
-[
- if test "$enableval" = "yes"; then
- AC_DEFINE(FORCE_CGI_REDIRECT, 1)
- AC_MSG_RESULT(yes)
- REDIRECT=1
- else
- AC_DEFINE(FORCE_CGI_REDIRECT, 0)
- AC_MSG_RESULT(no)
- REDIRECT=0
- fi
-],[
- AC_DEFINE(FORCE_CGI_REDIRECT, 0)
- AC_MSG_RESULT(no)
- REDIRECT=0
-])
-
-AC_MSG_CHECKING(whether to discard path_info + path_translated)
-AC_ARG_ENABLE(discard_path,
-[ --enable-discard-path If this is enabled, the PHP CGI binary
- can safely be placed outside of the
- web tree and people will not be able
- to circumvent .htaccess security. ],
-[
- if test "$enableval" = "yes"; then
- AC_DEFINE(DISCARD_PATH, 1)
- AC_MSG_RESULT(yes)
- DISCARD_PATH=1
- else
- AC_DEFINE(DISCARD_PATH, 0)
- AC_MSG_RESULT(no)
- DISCARD_PATH=0
- fi
-],[
- AC_DEFINE(DISCARD_PATH, 0)
- AC_MSG_RESULT(no)
- DISCARD_PATH=0
-])
-fi
-
-if test "$PHP_SAPI" = "cgi" ; then
- INSTALL_IT="\$(SHELL) \$(srcdir)/install-sh -m 0755 $SAPI_PROGRAM \$(bindir)/$SAPI_CGI"
-fi
-
-AC_MSG_CHECKING(for fhttpd module support)
-AC_ARG_WITH(fhttpd,
-[ --with-fhttpd[=DIR] Build fhttpd module. DIR is the fhttpd sources
- directory, defaults to /usr/local/src/fhttpd.],
-[
- if test "$withval" = "yes"; then
- # fhttpd source directory
- withval=/usr/local/src/fhttpd
- fi
- if test "$withval" != "no"; then
-# For fhttpd 0.3.x
- if test -f $withval/servproc.h; then
- FHTTPD_INCLUDE=-I$withval/
- FHTTPD_LIB=$withval/servproc.o
- FHTTPD_TARGET=$withval/
- PHP_BUILD_STATIC
- PHP_SAPI=cgi
- AC_DEFINE(FHTTPD)
- AC_MSG_RESULT(yes - fhttpd 0.3.x)
- else
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(Invalid fhttpd directory - unable to find servproc.h under $withval)
- fi
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-INCLUDES="$INCLUDES $FHTTPD_INCLUDE"
-dnl## AC_SUBST(FHTTPD_INCLUDE)
-AC_SUBST(FHTTPD_LIB)
-AC_SUBST(FHTTPD_TARGET)
diff --git a/sapi/cgi/php.sym b/sapi/cgi/php.sym
deleted file mode 100644
index e69de29bb2..0000000000
--- a/sapi/cgi/php.sym
+++ /dev/null
diff --git a/sapi/isapi/Makefile.am b/sapi/isapi/Makefile.am
deleted file mode 100644
index 804486ac9d..0000000000
--- a/sapi/isapi/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-noinst_LTLIBRARIES=libphpsapi_isapi.la
-libphpsapi_isapi_la_SOURCES=php4isapi.c
-
diff --git a/sapi/isapi/config.m4 b/sapi/isapi/config.m4
deleted file mode 100644
index 41fa1e1446..0000000000
--- a/sapi/isapi/config.m4
+++ /dev/null
@@ -1,28 +0,0 @@
-dnl ## $Id$ -*- sh -*-
-
-RESULT=no
-AC_MSG_CHECKING(for Zeus ISAPI support)
-AC_ARG_WITH(zeus,
-[ --with-zeus=DIR Build PHP as an ISAPI module for use with Zeus.],
-[
- if test "$withval" = "yes"; then
- ZEUSPATH=/usr/local/zeus # the default
- else
- ZEUSPATH=$withval
- fi
- if ! test -f "$ZEUSPATH/web/include/httpext.h"; then
- AC_MSG_ERROR(Unable to find httpext.h in $ZEUSPATH/web/include)
- fi
- PHP_BUILD_THREAD_SAFE
- AC_DEFINE(WITH_ZEUS)
- AC_ADD_INCLUDE($ZEUSPATH/web/include)
- PHP_SAPI=isapi
- PHP_BUILD_SHARED
- INSTALL_IT="\$(SHELL) \$(srcdir)/install-sh -m 0755 $SAPI_SHARED $ZEUSPATH/web/bin/"
- RESULT=yes
-])
-AC_MSG_RESULT($RESULT)
-
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
diff --git a/sapi/isapi/php.sym b/sapi/isapi/php.sym
deleted file mode 100644
index 34b50b851c..0000000000
--- a/sapi/isapi/php.sym
+++ /dev/null
@@ -1,5 +0,0 @@
-GetFilterVersion
-HttpFilterProc
-GetExtensionVersion
-HttpExtensionProc
-ZSLMain
diff --git a/sapi/isapi/php4isapi.c b/sapi/isapi/php4isapi.c
deleted file mode 100644
index 1fbb41382e..0000000000
--- a/sapi/isapi/php4isapi.c
+++ /dev/null
@@ -1,493 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_0.txt. |
- | 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. |
- +----------------------------------------------------------------------+
- | Authors: |
- | |
- +----------------------------------------------------------------------+
- */
-
-#if WIN32|WINNT
-# include <windows.h>
-#endif
-#include <httpext.h>
-#include <httpfilt.h>
-#include <httpext.h>
-#include "php.h"
-#include "main.h"
-#include "SAPI.h"
-#include "php_globals.h"
-#include "ext/standard/info.h"
-
-#ifdef WITH_ZEUS
-#include "zeus.h"
-#endif
-
-#define MAX_STATUS_LENGTH sizeof("xxxx LONGEST STATUS DESCRIPTION")
-#define ISAPI_SERVER_VAR_BUF_SIZE 1024
-#define ISAPI_POST_DATA_BUF 1024
-
-int IWasLoaded=0;
-
-static char *isapi_server_variables[] = {
- "ALL_HTTP",
- "APPL_MD_PATH",
- "APPL_PHYSICAL_PATH",
- "AUTH_PASSWORD",
- "AUTH_TYPE",
- "AUTH_USER",
- "CERT_COOKIE",
- "CERT_FLAGS",
- "CERT_ISSUER",
- "CERT_KEYSIZE",
- "CERT_SECRETKEYSIZE",
- "CERT_SERIALNUMBER",
- "CERT_SERVER_ISSUER",
- "CERT_SERVER_SUBJECT",
- "CERT_SUBJECT",
- "CONTENT_LENGTH",
- "CONTENT_TYPE",
- "LOGON_USER",
- "HTTP_COOKIE",
- "HTTPS",
- "HTTPS_KEYSIZE",
- "HTTPS_SECRETKEYSIZE",
- "HTTPS_SERVER_ISSUER",
- "HTTPS_SERVER_SUBJECT",
- "INSTANCE_ID",
- "INSTANCE_META_PATH",
- "PATH_INFO",
- "PATH_TRANSLATED",
- "QUERY_STRING",
- "REMOTE_ADDR",
- "REMOTE_HOST",
- "REMOTE_USER",
- "REQUEST_METHOD",
- "SCRIPT_NAME",
- "SERVER_NAME",
- "SERVER_PORT",
- "SERVER_PORT_SECURE",
- "SERVER_PROTOCOL",
- "SERVER_SOFTWARE",
- "URL",
- NULL
-};
-
-
-static void php_info_isapi(ZEND_MODULE_INFO_FUNC_ARGS)
-{
- char **p = isapi_server_variables;
- char variable_buf[ISAPI_SERVER_VAR_BUF_SIZE];
- DWORD variable_len;
- LPEXTENSION_CONTROL_BLOCK lpECB;
- SLS_FETCH();
-
- lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
-
- PUTS("<table border=5 width=\"600\">\n");
- php_info_print_table_header(2, "Server Variable", "Value");
- while (*p) {
- variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- if (lpECB->GetServerVariable(lpECB->ConnID, *p, variable_buf, &variable_len)
- && variable_buf[0]) {
- php_info_print_table_row(2, *p, variable_buf);
- } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
- char *tmp_variable_buf;
-
- tmp_variable_buf = (char *) emalloc(variable_len);
- if (lpECB->GetServerVariable(lpECB->ConnID, *p, tmp_variable_buf, &variable_len)
- && variable_buf[0]) {
- php_info_print_table_row(2, *p, tmp_variable_buf);
- }
- efree(tmp_variable_buf);
- }
- p++;
- }
-
- PUTS("</table>");
-}
-
-
-static zend_module_entry php_isapi_module = {
- "ISAPI",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- php_info_isapi,
- STANDARD_MODULE_PROPERTIES
-};
-
-
-static int zend_isapi_ub_write(const char *str, uint str_length)
-{
- DWORD num_bytes = str_length;
- LPEXTENSION_CONTROL_BLOCK ecb;
- SLS_FETCH();
-
- ecb = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
- ecb->WriteClient(ecb->ConnID, (char *) str, &num_bytes, HSE_IO_SYNC );
- return num_bytes;
-}
-
-
-static int sapi_isapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC)
-{
- return SAPI_HEADER_ADD;
-}
-
-
-
-static void accumulate_header_length(sapi_header_struct *sapi_header, uint *total_length)
-{
- *total_length += sapi_header->header_len+2;
-}
-
-
-static void concat_header(sapi_header_struct *sapi_header, char **combined_headers_ptr)
-{
- memcpy(*combined_headers_ptr, sapi_header->header, sapi_header->header_len);
- *combined_headers_ptr += sapi_header->header_len;
- **combined_headers_ptr = '\r';
- (*combined_headers_ptr)++;
- **combined_headers_ptr = '\n';
- (*combined_headers_ptr)++;
-}
-
-
-static int sapi_isapi_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
-{
- uint total_length = 2; /* account for the trailing \r\n */
- char *combined_headers, *combined_headers_ptr;
- LPEXTENSION_CONTROL_BLOCK lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
- HSE_SEND_HEADER_EX_INFO header_info;
- char status_buf[MAX_STATUS_LENGTH];
- sapi_header_struct default_content_type = { SAPI_DEFAULT_CONTENT_TYPE, sizeof(SAPI_DEFAULT_CONTENT_TYPE)-1 };
- PLS_FETCH();
-
- /* Obtain headers length */
- if (SG(sapi_headers).send_default_content_type) {
- accumulate_header_length(&default_content_type, (void *) &total_length);
- }
- zend_llist_apply_with_argument(&SG(sapi_headers).headers, (void (*)(void *, void *)) accumulate_header_length, (void *) &total_length);
-
- /* Generate headers */
- combined_headers = (char *) emalloc(total_length+1);
- combined_headers_ptr = combined_headers;
- if (SG(sapi_headers).send_default_content_type) {
- concat_header(&default_content_type, (void *) &combined_headers_ptr);
- }
- zend_llist_apply_with_argument(&SG(sapi_headers).headers, (void (*)(void *, void *)) concat_header, (void *) &combined_headers_ptr);
- *combined_headers_ptr++ = '\r';
- *combined_headers_ptr++ = '\n';
- *combined_headers_ptr = 0;
-
- switch (SG(sapi_headers).http_response_code) {
- case 200:
- header_info.pszStatus = "200 OK";
- break;
- case 302:
- header_info.pszStatus = "302 Moved Temporarily";
- break;
- case 401:
- header_info.pszStatus = "401 Authorization Required";
- break;
- default:
- snprintf(status_buf, MAX_STATUS_LENGTH, "%d Undescribed", SG(sapi_headers).http_response_code);
- header_info.pszStatus = status_buf;
- break;
- }
-#ifndef WITH_ZEUS
- header_info.cchStatus = strlen(header_info.pszStatus);
-#endif
- header_info.pszHeader = combined_headers;
- header_info.cchHeader = total_length;
- lpECB->dwHttpStatusCode = SG(sapi_headers).http_response_code;
-
- lpECB->ServerSupportFunction(lpECB->ConnID, HSE_REQ_SEND_RESPONSE_HEADER_EX, &header_info, NULL, NULL);
-
- efree(combined_headers);
- if (SG(sapi_headers).http_status_line) {
- efree(SG(sapi_headers).http_status_line);
- }
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-
-static int php_isapi_startup(sapi_module_struct *sapi_module)
-{
- if (php_module_startup(sapi_module)==FAILURE
- || zend_register_module(&php_isapi_module)==FAILURE) {
- return FAILURE;
- } else {
- return SUCCESS;
- }
-}
-
-
-
-static int sapi_isapi_read_post(char *buffer, uint count_bytes SLS_DC)
-{
- LPEXTENSION_CONTROL_BLOCK lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
- DWORD read_from_buf=0;
- DWORD read_from_input=0;
- DWORD total_read=0;
-
- if (SG(read_post_bytes) < lpECB->cbAvailable) {
- read_from_buf = MIN(lpECB->cbAvailable-SG(read_post_bytes), count_bytes);
- memcpy(buffer, lpECB->lpbData+SG(read_post_bytes), read_from_buf);
- total_read += read_from_buf;
- }
- if (read_from_buf<count_bytes
- && (SG(read_post_bytes)+read_from_buf) < lpECB->cbTotalBytes) {
- DWORD cbRead=0, cbSize;
-
- read_from_input = MIN(count_bytes-read_from_buf, lpECB->cbTotalBytes-SG(read_post_bytes)-read_from_buf);
- while (cbRead < read_from_input) {
- cbSize = read_from_input - cbRead;
- if (!lpECB->ReadClient(lpECB->ConnID, buffer+read_from_buf+cbRead, &cbSize) || cbSize==0) {
- break;
- }
- cbRead += cbSize;
- }
- total_read += cbRead;
- }
- SG(read_post_bytes) += total_read;
- return total_read;
-}
-
-
-static char *sapi_isapi_read_cookies(SLS_D)
-{
- LPEXTENSION_CONTROL_BLOCK lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
- char variable_buf[ISAPI_SERVER_VAR_BUF_SIZE];
- DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
-
- if (lpECB->GetServerVariable(lpECB->ConnID, "HTTP_COOKIE", variable_buf, &variable_len)) {
- return estrndup(variable_buf, variable_len);
- } else if (GetLastError()==ERROR_INSUFFICIENT_BUFFER) {
- char *tmp_variable_buf = (char *) emalloc(variable_len+1);
-
- if (lpECB->GetServerVariable(lpECB->ConnID, "HTTP_COOKIE", tmp_variable_buf, &variable_len)) {
- tmp_variable_buf[variable_len] = 0;
- return tmp_variable_buf;
- } else {
- efree(tmp_variable_buf);
- }
- }
- return NULL;
-}
-
-
-static sapi_module_struct sapi_module = {
- "PHP Language", /* name */
-
- php_isapi_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- zend_isapi_ub_write, /* unbuffered write */
-
- php_error, /* error handler */
-
- sapi_isapi_header_handler, /* header handler */
- sapi_isapi_send_headers, /* send headers handler */
- NULL, /* send header handler */
-
- sapi_isapi_read_post, /* read POST data */
- sapi_isapi_read_cookies, /* read Cookies */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-
-BOOL WINAPI GetFilterVersion(PHTTP_FILTER_VERSION pFilterVersion)
-{
- pFilterVersion->dwFilterVersion = HTTP_FILTER_REVISION;
- strcpy(pFilterVersion->lpszFilterDesc, sapi_module.name);
- pFilterVersion->dwFlags= (SF_NOTIFY_AUTHENTICATION | SF_NOTIFY_PREPROC_HEADERS);
- return TRUE;
-}
-
-
-DWORD WINAPI HttpFilterProc(PHTTP_FILTER_CONTEXT pfc, DWORD notificationType, LPVOID pvNotification)
-{
- SLS_FETCH();
-
- switch (notificationType) {
- case SF_NOTIFY_PREPROC_HEADERS:
- SG(request_info).auth_user = NULL;
- SG(request_info).auth_password = NULL;
- break;
- case SF_NOTIFY_AUTHENTICATION: {
- char *auth_user = ((HTTP_FILTER_AUTHENT *) pvNotification)->pszUser;
- char *auth_password = ((HTTP_FILTER_AUTHENT *) pvNotification)->pszPassword;
-
- if (auth_user && auth_user[0]) {
- SG(request_info).auth_user = estrdup(auth_user);
- }
- if (auth_password && auth_password[0]) {
- SG(request_info).auth_password = estrdup(auth_password);
- }
- auth_user[0] = 0;
- auth_password[0] = 0;
- return SF_STATUS_REQ_HANDLED_NOTIFICATION;
- }
- break;
- }
- return SF_STATUS_REQ_NEXT_NOTIFICATION;
-}
-
-
-static void init_request_info(sapi_globals_struct *sapi_globals, LPEXTENSION_CONTROL_BLOCK lpECB)
-{
- SG(request_info).request_method = lpECB->lpszMethod;
- SG(request_info).query_string = lpECB->lpszQueryString;
- SG(request_info).path_translated = lpECB->lpszPathTranslated;
- SG(request_info).request_uri = lpECB->lpszPathInfo;
- SG(request_info).content_type = lpECB->lpszContentType;
- SG(request_info).content_length = lpECB->cbTotalBytes;
- {
- char *path_end = strrchr(SG(request_info).path_translated, '\\');
-
- if (path_end) {
- *path_end = 0;
- chdir(SG(request_info).path_translated);
- *path_end = '\\';
- }
- }
-}
-
-
-BOOL WINAPI GetExtensionVersion(HSE_VERSION_INFO *pVer)
-{
- pVer->dwExtensionVersion = HSE_VERSION;
- lstrcpyn(pVer->lpszExtensionDesc, sapi_module.name, HSE_MAX_EXT_DLL_NAME_LEN);
- return TRUE;
-}
-
-
-static void hash_isapi_variables(ELS_D SLS_DC)
-{
- char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE];
- char *variable_buf;
- DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- char *variable;
- char *strtok_buf = NULL;
- LPEXTENSION_CONTROL_BLOCK lpECB;
-
- lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
-
- if (lpECB->GetServerVariable(lpECB->ConnID, "ALL_HTTP", static_variable_buf, &variable_len)) {
- variable_buf = static_variable_buf;
- } else {
- if (GetLastError()==ERROR_INSUFFICIENT_BUFFER) {
- variable_buf = (char *) emalloc(variable_len);
- if (!lpECB->GetServerVariable(lpECB->ConnID, "ALL_HTTP", variable_buf, &variable_len)) {
- efree(variable_buf);
- return;
- }
- } else {
- return;
- }
- }
- variable = strtok_r(variable_buf, "\r\n", &strtok_buf);
- while (variable) {
- char *colon = strchr(variable, ':');
-
- if (colon) {
- char *value = colon+1;
- zval *entry = (zval *) emalloc(sizeof(zval));
-
- while (*value==' ') {
- value++;
- }
- *colon = 0;
- INIT_PZVAL(entry);
- entry->value.str.len = strlen(value);
- entry->value.str.val = estrndup(value, entry->value.str.len);
- entry->type = IS_STRING;
- zend_hash_add(&EG(symbol_table), variable, strlen(variable)+1, &entry, sizeof(zval *), NULL);
- *colon = ':';
- }
- variable = strtok_r(NULL, "\r\n", &strtok_buf);
- }
- if (variable_buf!=static_variable_buf) {
- efree(variable_buf);
- }
-}
-
-
-DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB)
-{
- zend_file_handle file_handle;
- SLS_FETCH();
- CLS_FETCH();
- ELS_FETCH();
- PLS_FETCH();
-
- if (setjmp(EG(bailout))!=0) {
- return HSE_STATUS_ERROR;
- }
-
- init_request_info(sapi_globals, lpECB);
- SG(server_context) = lpECB;
-
- file_handle.filename = sapi_globals->request_info.path_translated;
- file_handle.free_filename = 0;
- file_handle.type = ZEND_HANDLE_FILENAME;
-
- php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC);
- hash_isapi_variables(ELS_C SLS_CC);
- php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
- if (SG(request_info).cookie_data) {
- efree(SG(request_info).cookie_data);
- }
- php_request_shutdown(NULL);
- return HSE_STATUS_SUCCESS;
-}
-
-
-
-__declspec(dllexport) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
-{
- switch (fdwReason) {
- case DLL_PROCESS_ATTACH:
- tsrm_startup(1, 1, 0);
- sapi_startup(&sapi_module);
- if (sapi_module.startup) {
- sapi_module.startup(&sapi_module);
- }
- IWasLoaded = 1;
- break;
- case DLL_THREAD_ATTACH:
- break;
- case DLL_THREAD_DETACH:
- ts_free_thread();
- break;
- case DLL_PROCESS_DETACH:
- if (sapi_module.shutdown) {
- sapi_module.shutdown(&sapi_module);
- }
- tsrm_shutdown();
- break;
- }
- return TRUE;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/sapi/isapi/php4isapi.def b/sapi/isapi/php4isapi.def
deleted file mode 100644
index 596023ef55..0000000000
--- a/sapi/isapi/php4isapi.def
+++ /dev/null
@@ -1,5 +0,0 @@
-EXPORTS
-HttpFilterProc
-GetFilterVersion
-HttpExtensionProc
-GetExtensionVersion
diff --git a/sapi/isapi/php4isapi.dsp b/sapi/isapi/php4isapi.dsp
deleted file mode 100644
index caef60e9af..0000000000
--- a/sapi/isapi/php4isapi.dsp
+++ /dev/null
@@ -1,106 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php4isapi" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php4isapi - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php4isapi.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php4isapi.mak" CFG="php4isapi - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php4isapi - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4isapi - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php4isapi - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\win32" /I "..\..\libzend" /I "..\.." /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "COMPILE_LIBZEND" /D "WIN32" /D "_MBCS" /D "ZTS" /D ZEND_DEBUG=1 /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"libcmt" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "php4isapi - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\libzend" /I "..\.." /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /libpath:"..\..\Release_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php4isapi - Win32 Debug_TS"
-# Name "php4isapi - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php4isapi.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php4isapi.def
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# End Target
-# End Project
diff --git a/sapi/roxen/Makefile.am b/sapi/roxen/Makefile.am
deleted file mode 100644
index 4c6d5de6b0..0000000000
--- a/sapi/roxen/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-noinst_LTLIBRARIES=libphpsapi_roxen.la
-libphpsapi_roxen_la_SOURCES=roxen.c
diff --git a/sapi/roxen/README b/sapi/roxen/README
deleted file mode 100644
index b12662f3e3..0000000000
--- a/sapi/roxen/README
+++ /dev/null
@@ -1,17 +0,0 @@
-Roxen PHP support. Early version. Don't expect to be able to get it to
-work. Requires Pike 0.7.79 and Roxen 1.4. Anything less won't work.
-
-The module is now thread safe, in a couple of different modes. First
-mode, the default, uses a process global PHP lock in the Roxen
-module. This means that all PHP-requests are serialized (ie only one
-script is executed at any one time). The second option is using ZTS
-(Zend Thread Safe mode). Unless --enable-roxen-zts is specified, this
-won't be used. For now this uses a global lock in the PHP interpreter
-so the end result is the same (only one concurrent script). In the
-future this might change though, but for now you are better off using
-the non-ZendThreadSafe version (which works fine with Roxen and
-threads).
-
-- The Author, David Hedbor <neotron@php.net>
-
-
diff --git a/sapi/roxen/config.h.stub b/sapi/roxen/config.h.stub
deleted file mode 100644
index 4128f3170f..0000000000
--- a/sapi/roxen/config.h.stub
+++ /dev/null
@@ -1,12 +0,0 @@
-
-/* Define this if you want to build the Roxen PHP module
- * It is currently VERY EXPERIMENTAL and not finished.
- */
-#undef HAVE_ROXEN
-
-
-/* Comment to use the Roxen "serializing" instead of PHP's ZTS.
- * It seems like the Roxen PHP-global mutex lock works better,
- * performance wise.
- */
-#undef ROXEN_USE_ZTS
diff --git a/sapi/roxen/config.m4 b/sapi/roxen/config.m4
deleted file mode 100644
index b2425b2156..0000000000
--- a/sapi/roxen/config.m4
+++ /dev/null
@@ -1,63 +0,0 @@
-dnl ## $Id$ -*- sh -*-
-
-RESULT=no
-AC_MSG_CHECKING(for Roxen/Pike support)
-AC_ARG_WITH(roxen,
-[ --with-roxen=DIR Build PHP as a Pike module. DIR is the base Roxen
- directory, normally /usr/local/roxen/server.],
-[
- if test ! -d $withval ; then
- AC_MSG_ERROR(You did not specify a directory)
- fi
- if test -f $withval/bin/roxen; then
- PIKE="$withval/bin/roxen"
- elif test -f $withval/bin/pike; then
- PIKE="$withval/bin/pike"
- else
- AC_MSG_ERROR(Couldn't find a pike in $withval/bin/)
- fi
- if $PIKE -e 'float v = __VERSION__ + (__BUILD__/10000.0); if(v < 0.7079) exit(1); exit(0);'; then
- PIKE_MODULE_DIR="`$PIKE --show-paths 2>&1| grep lib/modules | sed -e 's/.*: //'`"
- PIKE_INCLUDE_DIR="`echo $PIKE_MODULE_DIR | sed -e 's,lib/pike/modules,include/pike,' -e 's,lib/modules,include/pike,'`"
- if test -z "$PIKE_INCLUDE_DIR" -o -z "$PIKE_MODULE_DIR"; then
- AC_MSG_ERROR(Failed to figure out Pike module and include directories)
- fi
- else
- AC_MSG_ERROR(Roxen/PHP requires Pike 0.7.79 or newer)
- fi
- AC_ADD_INCLUDE($PIKE_INCLUDE_DIR)
- AC_DEFINE(HAVE_ROXEN)
- PHP_SAPI=roxen
- PHP_BUILD_SHARED
- INSTALL_IT="\$(SHELL) \$(srcdir)/install-sh -m 0755 $SAPI_SHARED $PIKE_MODULE_DIR/PHP4.so"
- RESULT="yes
- Pike binary used: $PIKE
- Pike include dir: $PIKE_INCLUDE_DIR
- Pike module directory: $PIKE_MODULE_DIR"
-])
-AC_MSG_RESULT($RESULT)
-
-if test "$RESULT" != "no" ; then
- RESULT=no
- AC_MSG_CHECKING(if Roxen should use ZTS)
- AC_ARG_ENABLE(roxen-zts,
- [ --enable-roxen-zts Build the Roxen module using Zend Thread Safety.
- This is not required to run the module in a threaded
- Roxen and it doesn't improve performance. PHP calls
- are normally made in a serialized mode.],
- [
- PHP_BUILD_THREAD_SAFE
- AC_DEFINE(ROXEN_USE_ZTS)
- RESULT="yes
- *** You have choosen to compile with PHP thread safety
- *** enabled. This is not a requirement for the Roxen
- *** PHP module, even if Roxen runs in multi-threaded mode.
- *** It will as a matter of fact make performance worse."
-
- ])
- AC_MSG_RESULT($RESULT)
-fi
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
- \ No newline at end of file
diff --git a/sapi/roxen/phpmod.pike b/sapi/roxen/phpmod.pike
deleted file mode 100644
index 35db7b4076..0000000000
--- a/sapi/roxen/phpmod.pike
+++ /dev/null
@@ -1,363 +0,0 @@
-/* Roxen PHP module based of the Roxen CGI module for Roxen 1.4. */
-
-#include <roxen.h>
-#include <module.h>
-inherit "module";
-inherit "roxenlib";
-
-constant cvs_version = "$Id$";
-constant thread_safe = 1;
-
-string trim( string what )
-{
- sscanf(what, "%*[ \t]%s", what);
- what = reverse(what);
- sscanf(what, "%*[ \t]%s", what);
- what = reverse(what);
- return what;
-}
-
-//#define PHP_DEBUG
-#ifdef PHP_DEBUG
-#define DWERROR(X) report_debug("Thr("+getpid()+"): "+X)
-#else /* !PHP_DEBUG */
-#define DWERROR(X)
-#endif /* PHP_DEBUG */
-
-array register_module()
-{
- return
- ({
- MODULE_FILE_EXTENSION | MODULE_PARSER,
- "PHP Script Support",
- "This module allows Roxen users to run PHP scripts, optionally in "
- "combination with RXML. ",
- });
-}
-
-class PHPScript
-{
- object interpretor;
- string command;
- string buffer="";
- // stderr is handled by run().
- mapping (string:string) environment;
- int blocking, written, close_when_done;
- object mid;
- void done() {
- if(strlen(buffer)) {
- close_when_done = 1;
- if(QUERY(rxml)) {
- buffer = parse_rxml(buffer, mid);
- write_callback();
- }
- } else
- destruct();
- }
-
- void destroy() {
- mid->do_not_disconnect = 0;
- // destruct(interpretor);
- mid->file = ([ "len": written, "raw":1 ]);
- // mid->do_log();
- }
- void write_callback()
- {
- DWERROR("PHP:Wrapper::write_callback()\n");
- if(!strlen(buffer))
- return;
- // int nelems = tofd->write( buffer );
- int nelems;
- array err = catch { nelems = mid->my_fd->write(buffer); };
- DWERROR(sprintf("PHP:Wrapper::write_callback(): write(%O) => %d\n",
- buffer, nelems));
- if( err || nelems < 0 )
- // if nelems == 0, network buffer is full. We still want to continue.
- {
- buffer="";
- close_when_done = -1;
- } else {
- written += nelems;
- buffer = buffer[nelems..];
- DWERROR(sprintf("Done: %d %d...\n", strlen(buffer), close_when_done));
- if(close_when_done && !strlen(buffer)) {
- destruct();
- }
- }
- }
-
- int write( string what )
- {
- DWERROR(sprintf("PHP:Wrapper::write(%O)\n", what));
- if(close_when_done == -1) // Remote closed
- return -1;
- if(buffer == "" )
- {
- buffer = what;
- if(!QUERY(rxml)) write_callback();
- } else
- buffer += what;
- return strlen(what);
- }
-
- void send_headers(int code, mapping headers)
- {
- DWERROR(sprintf("PHP:PHPWrapper::send_headers(%d,%O)\n", code, headers));
- string result = "", post="";
- string code = mid->errors[code||200];
- int ct_received = 0, sv_received = 0;
- if(headers)
- foreach(indices(headers), string header)
- {
- string value = headers[header];
- if(!header || !value)
- {
- // Heavy DWIM. For persons who forget about headers altogether.
- continue;
- }
- header = trim(header);
- value = trim(value);
- switch(lower_case( header ))
- {
- case "status":
- code = value;
- break;
-
- case "content-type":
- ct_received=1;
- result += header+": "+value+"\r\n";
- break;
-
- case "server":
- sv_received=1;
- result += header+": "+value+"\r\n";
- break;
-
- case "location":
- code = "302 Redirection";
- result += header+": "+value+"\r\n";
- break;
-
- default:
- result += header+": "+value+"\r\n";
- break;
- }
- }
- if(!sv_received)
- result += "Server: "+roxen.version()+"/PHP\r\n";
- if(!ct_received)
- result += "Content-Type: text/html\r\n";
- write("HTTP/1.0 "+code+"\r\n"+result+"\r\n");
- }
-
- PHPScript run()
- {
- DWERROR("PHP:PHPScript::run()\n");
- // if( QUERY(rxml) )
- // stdout = (wrapper = RXMLWrapper( stdout, mid ))->get_fd();
- mapping options = ([
- "env":environment,
- ]);
-#if 1
- if(!QUERY(rxml)) {
- mid->my_fd->set_blocking();
- options->my_fd = mid->my_fd;
- }
-#endif
- mid->my_fd->set_close_callback(done);
- interpretor->run(command, options, this_object(), done);
- return this_object();
- }
-
-
- void create( object id )
- {
- DWERROR("PHP:PHPScript()\n");
- interpretor = PHP4.Interpretor();
- mid = id;
-
-#ifndef THREADS
- if(id->misc->orig) // An <insert file=...> operation, and we have no threads.
- blocking = 1;
-#else
- if(id->misc->orig && this_thread() == roxen.backend_thread)
- blocking = 1;
- // An <insert file=...> and we are
- // currently in the backend thread.
-#endif
- if(!id->realfile)
- {
- id->realfile = id->conf->real_file( id->not_query, id );
- if(!id->realfile)
- error("No real file associated with "+id->not_query+
- ", thus it's not possible to run it as a PHP script.\n");
- }
- command = id->realfile;
-
- environment =(QUERY(env)?getenv():([]));
- environment |= global_env;
- environment |= build_env_vars( id->realfile, id, id->misc->path_info );
- environment |= build_roxen_env_vars(id);
- if(id->misc->ssi_env) environment |= id->misc->ssi_env;
- if(id->misc->is_redirected) environment["REDIRECT_STATUS"] = "1";
- if(id->rawauth && QUERY(rawauth))
- environment["HTTP_AUTHORIZATION"] = (string)id->rawauth;
- else
- m_delete(environment, "HTTP_AUTHORIZATION");
- if(QUERY(clearpass) && id->auth && id->realauth ) {
- environment["REMOTE_USER"] = (id->realauth/":")[0];
- environment["REMOTE_PASSWORD"] = (id->realauth/":")[1];
- } else {
- m_delete(environment, "REMOTE_PASSWORD");
- }
- if (id->rawauth) {
- environment["AUTH_TYPE"] = (id->rawauth/" ")[0];
- }
- // DWERROR(sprintf("%O\n", environment));
- // ffd = id->my_fd;
- }
-}
-
-mapping(string:string) global_env = ([]);
-void start(int n, object conf)
-{
- DWERROR("PHP:start()\n");
-
- module_dependencies(conf, ({ "pathinfo" }));
- if(conf)
- {
- string tmp=conf->query("MyWorldLocation");
- sscanf(tmp, "%*s//%s", tmp);
- sscanf(tmp, "%s:", tmp);
- sscanf(tmp, "%s/", tmp);
- global_env["SERVER_NAME"]=tmp;
- global_env["SERVER_SOFTWARE"]=roxen.version();
- global_env["GATEWAY_INTERFACE"]="PHP/1.1";
- global_env["SERVER_PROTOCOL"]="HTTP/1.0";
- global_env["SERVER_URL"]=conf->query("MyWorldLocation");
-
- array us = ({0,0});
- foreach(query("extra_env")/"\n", tmp)
- if(sscanf(tmp, "%s=%s", us[0], us[1])==2)
- global_env[us[0]] = us[1];
- }
-}
-mapping handle_file_extension(object o, string e, object id)
-{
- DWERROR("PHP:handle_file_extension()\n");
- id->do_not_disconnect = 1;
- PHPScript( id )->run();
- return http_pipe_in_progress();
-}
-/*
-** Variables et. al.
-*/
-array (string) query_file_extensions()
-{
- return QUERY(ext);
-}
-
-
-void create(object conf)
-{
- defvar("env", 0, "Pass environment variables", TYPE_FLAG,
- "If this is set, all environment variables roxen has will be "
- "passed to PHP scripts, not only those defined in the PHP/1.1 standard. "
- "This includes PATH. (For a quick test, try this script with "
- "and without this variable set:"
- "<pre>"
- "#!/bin/sh\n\n"
- "echo Content-type: text/plain\n"
- "echo ''\n"
- "env\n"
- "</pre>)");
-
- defvar("rxml", 0, "Parse RXML in PHP-scripts", TYPE_FLAG,
- "If this is set, the output from PHP-scripts handled by this "
- "module will be RXMl parsed. NOTE: No data will be returned to the "
- "client until the PHP-script is fully parsed.");
-
- defvar("extra_env", "", "Extra environment variables", TYPE_TEXT_FIELD,
- "Extra variables to be sent to the script, format:<pre>"
- "NAME=value\n"
- "NAME=value\n"
- "</pre>Please note that the standard variables will have higher "
- "priority.");
-
- defvar("ext",
- ({"php", "php3", "php4"
- }), "PHP-script extensions", TYPE_STRING_LIST,
- "All files ending with these extensions, will be parsed as "+
- "PHP-scripts.");
-
- defvar("rawauth", 0, "Raw user info", TYPE_FLAG|VAR_MORE,
- "If set, the raw, unparsed, user info will be sent to the script, "
- " in the HTTP_AUTHORIZATION environment variable. This is not "
- "recommended, but some scripts need it. Please note that this "
- "will give the scripts access to the password used.");
-
- defvar("clearpass", 0, "Send decoded password", TYPE_FLAG|VAR_MORE,
- "If set, the variable REMOTE_PASSWORD will be set to the decoded "
- "password value.");
-
- defvar( "cgi_tag", 1, "Provide the &lt;cgi&gt; tag", TYPE_FLAG,
- "If set, the &lt;cgi&gt; tag will be available" );
-}
-
-int|string tag_cgi( string tag, mapping args, object id )
-{
- DWERROR("PHP:tag_cgi()\n");
-
- if(!query("cgi_tag"))
- return 0;
-
- if(args->help)
- return ("<b>&lt;"+tag+" script=path [cache=seconds] [default-argument=value] "
- "[argument=value]&gt;:</b>");
-
- if(!args->cache)
- NOCACHE();
- else
- CACHE( (int)args->cache || 60 );
-
-
- object fid = id->clone_me();
- string file = args->script;
- if(!file)
- return "No 'script' argument to the PHP tag";
- fid->not_query = fix_relative( file, id );
- foreach(indices(args), string arg )
- {
- if(arg == "script")
- continue;
- if(arg == "cache")
- continue;
- if(arg[..7] == "default-")
- {
- if(!id->variables[arg[8..]])
- fid->variables[arg[8..]] = args[arg];
- }
- else
- fid->variables[arg] = args[arg];
- }
- fid->realfile=0;
- fid->method = "GET";
- mixed e = catch
- {
- string data=handle_file_extension( 0, "cgi", fid )->file->read();
- if(!sscanf(data, "%*s\r\n\r\n%s", data))
- sscanf(data, "%*s\n\n%s", data);
- return data;
- };
- return ("Failed to run PHP script: <font color=red><pre>"+
- (html_encode_string(describe_backtrace(e))/"\n")[0]+
- "</pre></font>");
-}
-
-
-mapping query_tag_callers()
-{
- return ([
- "cgi":tag_cgi,
- ]);
-}
diff --git a/sapi/roxen/roxen.c b/sapi/roxen/roxen.c
deleted file mode 100644
index 1ec54f3138..0000000000
--- a/sapi/roxen/roxen.c
+++ /dev/null
@@ -1,745 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_0.txt. |
- | 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: David Hedbor <neotron@php.net> |
- | Based on aolserver SAPI by Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-#ifdef HAVE_ROXEN
-
-#include "php_ini.h"
-#include "php_globals.h"
-#include "SAPI.h"
-#include "main.h"
-
-#include "php_version.h"
-
-#ifndef ZTS
-/* Only valid if thread safety is enabled. */
-#undef ROXEN_USE_ZTS
-#endif
-
-
-/* Pike Include Files
- *
- * conflicts with pike avoided by only using long names. Requires a new
- * Pike 0.7 since it was implemented for this interface only.
- *
- */
-#define NO_PIKE_SHORTHAND
-
-
-#include <fdlib.h>
-#include <program.h>
-#include <pike_types.h>
-#include <interpret.h>
-#include <module_support.h>
-#include <error.h>
-#include <array.h>
-#include <backend.h>
-#include <stralloc.h>
-#include <mapping.h>
-#include <object.h>
-#include <threads.h>
-#include <builtin_functions.h>
-#include <operators.h>
-
-/* php_roxen_request is per-request object storage */
-
-typedef struct {
- struct mapping *request_data;
- struct object *my_fd_obj;
- int my_fd;
- char *filename;
-} php_roxen_request;
-
-
-/* Defines to get to the data supplied when the script is started. */
-
-#ifdef ROXEN_USE_ZTS
-
-/* ZTS does work now, but it seems like it's faster using the "serialization"
- * method I previously used. Thus it's not used unless ROXEN_USE_ZTS is defined.
- */
-
-/* Per thread storage area id... */
-static int roxen_globals_id;
-
-# define GET_THIS() php_roxen_request *_request = ts_resource(roxen_globals_id);
-# define THIS _request
-#else
-static php_roxen_request *current_request = NULL;
-
-# define GET_THIS() current_request = ((php_roxen_request *)fp->current_storage)
-# define THIS current_request
-#endif
-
-/* File descriptor integer. Used to write directly to the FD without
- * passing Pike
- */
-#define MY_FD (THIS->my_fd)
-
-/* FD object. Really a PHPScript object from Pike which implements a couple
- * of functions to handle headers, writing and buffering.
- */
-#define MY_FD_OBJ ((struct object *)(THIS->my_fd_obj))
-
-/* Mapping with data supplied from the calling Roxen module. Contains
- * a mapping with headers, an FD object etc.
- */
-#define REQUEST_DATA ((struct mapping *)(THIS->request_data))
-
-
-#if defined(_REENTRANT) && !defined(ROXEN_USE_ZTS)
-/* Lock used to serialize the PHP execution. If ROXEN_USE_ZTS is defined, we
- * are using the PHP thread safe mechanism instead.
- */
-static PIKE_MUTEX_T roxen_php_execution_lock;
-# define PHP_INIT_LOCK() mt_init(&roxen_php_execution_lock)
-# define PHP_LOCK(X) fprintf(stderr, "*** php lock (thr_id=%d, glob=%d).\n", th_self(), current_thread);THREADS_ALLOW();mt_lock(&roxen_php_execution_lock);fprintf(stderr, "*** php locked.\n");THREADS_DISALLOW()
-# define PHP_UNLOCK(X) mt_unlock(&roxen_php_execution_lock);fprintf(stderr, "*** php unlocked (thr_id=%d, glob=%d).\n", th_self(), current_thread);
-# define PHP_DESTROY() mt_destroy(&roxen_php_execution_lock)
-#else /* !_REENTRANT */
-# define PHP_INIT_LOCK()
-# define PHP_LOCK(X) fprintf(stderr, "*** php lock (thr_id=%d).\n", th_self());
-# define PHP_UNLOCK(X) fprintf(stderr, "*** php unlock (thr_id=%d).\n", th_self());
-# define PHP_DESTROY()
-#endif /* _REENTRANT */
-
-extern int fd_from_object(struct object *o);
-static unsigned char roxen_php_initialized;
-
-/* This allows calling of pike functions from the PHP callbacks,
- * which requires the Pike interpretor to be locked.
- */
-#define THREAD_SAFE_RUN(COMMAND, what) do {\
- struct thread_state *state;\
- fprintf(stderr,"threads: %d disabled: %d id: %d\n",num_threads, threads_disabled, th_self());\
- if((state = thread_state_for_id(th_self()))!=NULL) {\
- if(!state->swapped) {\
- fprintf(stderr, "MT lock (%s).\n", what);\
- COMMAND;\
- fprintf(stderr, "MT locked done (%s).\n", what);\
- } else {\
- fprintf(stderr, "MT nonlock (%s).\n", what); \
- mt_lock(&interpreter_lock);\
- SWAP_IN_THREAD(state);\
- fprintf(stderr, "MT locked.\n", what); \
- COMMAND;\
- fprintf(stderr, "MT locked done.\n", what); \
- SWAP_OUT_THREAD(state);\
- mt_unlock(&interpreter_lock);\
- fprintf(stderr, "MT unlocked.\n", what); \
- }\
- }\
-} while(0)
-
-/* Toggle debug printouts, for now... */
-/*#define MUCH_DEBUG */
-#ifndef MUCH_DEBUG
-void no_fprintf(){}
-#define fprintf no_fprintf
-#endif
-
-struct program *php_program;
-
-
-/* To avoid executing a PHP script from a PHP callback, which would
- * create a deadlock, a global thread id is used. If the thread calling the
- * php-script is the same as the current thread, it fails.
- */
-static int current_thread = -1;
-
-
-/* Low level header lookup. Basically looks for the named header in the mapping
- * headers in the supplied options mapping.
- */
-
-static INLINE struct svalue *lookup_header(char *headername)
-{
- struct svalue *headers, *value;
- struct pike_string *sind;
-#ifdef ROXEN_USE_ZTS
- GET_THIS();
-#endif
- sind = make_shared_string("env");
- headers = low_mapping_string_lookup(REQUEST_DATA, sind);
- free_string(sind);
- if(!headers || headers->type != PIKE_T_MAPPING) return NULL;
- sind = make_shared_string(headername);
- value = low_mapping_string_lookup(headers->u.mapping, sind);
- free_string(sind);
- if(!value) return NULL;
- return value;
-}
-
-/* Lookup a header in the mapping and return the value as a string, or
- * return the default if it's missing
- */
-INLINE static char *lookup_string_header(char *headername, char *default_value)
-{
- struct svalue *head = NULL;
- THREAD_SAFE_RUN(head = lookup_header(headername), "header lookup");
- if(!head || head->type != PIKE_T_STRING) {
- fprintf(stderr, "Header lookup for %s: default (%s)\n", headername,
- default_value);
- return default_value;
- }
- fprintf(stderr, "Header lookup for %s: %s(%d)\n", headername,
- head->u.string->str, head->u.string->len);
- return head->u.string->str;
-}
-
-/* Lookup a header in the mapping and return the value as if it's an integer
- * and otherwise return the default.
- */
-INLINE static int lookup_integer_header(char *headername, int default_value)
-{
- struct svalue *head = NULL;
- THREAD_SAFE_RUN(head = lookup_header(headername), "header lookup");
- if(!head || head->type != PIKE_T_INT) {
- fprintf(stderr, "Header lookup for %s: default (%d)\n", headername,
- default_value);
- return default_value;
- }
- fprintf(stderr, "Header lookup for %s: %d \n", headername,
- head->u.integer);
- return head->u.integer;
-}
-
-/*
- * php_roxen_low_ub_write() writes data to the client connection. Might be
- * rewritten to do more direct IO to save CPU and the need to lock the *
- * interpretor for better threading.
- */
-
-static int
-php_roxen_low_ub_write(const char *str, uint str_length) {
- int sent_bytes = 0;
- struct pike_string *to_write = NULL;
-#ifdef ZTS
- PLS_FETCH();
-#endif
-#ifdef ROXEN_USE_ZTS
- GET_THIS();
-#endif
- if(!MY_FD_OBJ->prog) {
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- zend_bailout();
- return -1;
- }
- to_write = make_shared_binary_string(str, str_length);
- push_string(to_write);
- safe_apply(MY_FD_OBJ, "write", 1);
- if(sp[-1].type == PIKE_T_INT)
- sent_bytes = sp[-1].u.integer;
- pop_stack();
- if(sent_bytes != str_length) {
- /* This means the connection is closed. Dead. Gone. *sniff* */
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- zend_bailout();
- }
- fprintf(stderr, "low_write done.\n");
- return sent_bytes;
-}
-
-/*
- * php_roxen_sapi_ub_write() calls php_roxen_low_ub_write in a Pike thread
- * safe manner.
- */
-
-static int
-php_roxen_sapi_ub_write(const char *str, uint str_length)
-{
- int sent_bytes = 0, fd = MY_FD;
- if(fd)
- {
- for(sent_bytes=0;sent_bytes < str_length;)
- {
- int written;
- written = fd_write(fd, str + sent_bytes, str_length - sent_bytes);
- if(written < 0)
- {
- switch(errno)
- {
- default:
- /* This means the connection is closed. Dead. Gone. *sniff* */
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- zend_bailout();
- return sent_bytes;
- case EINTR:
- case EWOULDBLOCK:
- continue;
- }
-
- } else {
- sent_bytes += written;
- }
- }
- } else {
- THREAD_SAFE_RUN(sent_bytes = php_roxen_low_ub_write(str, str_length),
- "write");
- }
- fprintf(stderr, "write done.\n");
- return sent_bytes;
-}
-
-/* php_roxen_set_header() sets a header in the header mapping. Called in a
- * thread safe manner from php_roxen_sapi_header_handler.
- */
-static void php_roxen_set_header(char *header_name, char *value, char *p)
-{
- struct svalue hsval;
- struct pike_string *hval, *ind, *hind;
- struct mapping *headermap;
- struct svalue *s_headermap;
-#ifdef ROXEN_USE_ZTS
- GET_THIS();
-#endif
- hval = make_shared_string(value);
- ind = make_shared_string(" _headers");
- hind = make_shared_binary_string(header_name,
- (int)(p - header_name));
-
- s_headermap = low_mapping_string_lookup(REQUEST_DATA, ind);
- if(!s_headermap)
- {
- struct svalue mappie;
- mappie.type = PIKE_T_MAPPING;
- headermap = allocate_mapping(1);
- mappie.u.mapping = headermap;
- mapping_string_insert(REQUEST_DATA, ind, &mappie);
- free_mapping(headermap);
- } else
- headermap = s_headermap->u.mapping;
-
- hsval.type = PIKE_T_STRING;
- hsval.u.string = hval;
- mapping_string_insert(headermap, hind, &hsval);
-
- fprintf(stderr, "Setting header %s to %s\n", hind->str, value);
- free_string(hval);
- free_string(ind);
- free_string(hind);
-}
-
-/*
- * php_roxen_sapi_header_handler() sets a HTTP reply header to be
- * sent to the client.
- */
-static int
-php_roxen_sapi_header_handler(sapi_header_struct *sapi_header,
- sapi_headers_struct *sapi_headers SLS_DC)
-{
- char *header_name, *header_content, *p;
- header_name = sapi_header->header;
- header_content = p = strchr(header_name, ':');
-
- if(!p) return 0;
- do {
- header_content++;
- } while(*header_content == ' ');
- THREAD_SAFE_RUN(php_roxen_set_header(header_name, header_content, p), "header handler");
- efree(sapi_header->header);
- return 1;
-}
-
-/*
- * php_roxen_sapi_send_headers() flushes the headers to the client.
- * Called before real content is sent by PHP.
- */
-
-static int
-php_roxen_low_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
-{
- struct pike_string *ind;
- struct svalue *s_headermap;
-#ifdef ROXEN_USE_ZTS
- GET_THIS();
-#endif
- if(!MY_FD_OBJ->prog) {
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- zend_bailout();
- return SAPI_HEADER_SEND_FAILED;
- }
- ind = make_shared_string(" _headers");
- s_headermap = low_mapping_string_lookup(REQUEST_DATA, ind);
- free_string(ind);
- fprintf(stderr, "Send Headers (%d)...\n", SG(sapi_headers).http_response_code);
-
- push_int(SG(sapi_headers).http_response_code);
- if(s_headermap && s_headermap->type == PIKE_T_MAPPING)
- ref_push_mapping(s_headermap->u.mapping);
- else
- push_int(0);
- safe_apply(MY_FD_OBJ, "send_headers", 2);
- pop_stack();
-
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-static int
-php_roxen_sapi_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
-{
- int res = 0;
- THREAD_SAFE_RUN(res = php_roxen_low_send_headers(sapi_headers SLS_CC), "send headers");
- return res;
-}
-
-/*
- * php_roxen_sapi_read_post() reads a specified number of bytes from
- * the client. Used for POST/PUT requests.
- */
-
-INLINE static int php_roxen_low_read_post(char *buf, uint count_bytes)
-{
- uint total_read = 0;
-#ifdef ROXEN_USE_ZTS
- GET_THIS();
-#endif
- fprintf(stderr, "read post (%d bytes max)\n", count_bytes);
-
- if(!MY_FD_OBJ->prog) {
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- zend_bailout();
- return -1;
- }
-
- push_int(count_bytes);
- safe_apply(MY_FD_OBJ, "read_post", 1);
- if(sp[-1].type == T_STRING) {
- MEMCPY(buf, sp[-1].u.string->str, total_read = sp[-1].u.string->len);
- buf[total_read] = '\0';
- } else
- total_read = -1;
- pop_stack();
- return total_read;
-}
-
-static int
-php_roxen_sapi_read_post(char *buf, uint count_bytes SLS_DC)
-{
- uint total_read = 0;
- THREAD_SAFE_RUN(total_read = php_roxen_low_read_post(buf, count_bytes), "read post");
- return total_read;
-}
-
-/*
- * php_roxen_sapi_read_cookies() returns the Cookie header from
- * the HTTP request header
- */
-
-static char *
-php_roxen_sapi_read_cookies(SLS_D)
-{
- char *cookies;
- cookies = lookup_string_header("HTTP_COOKIE", NULL);
- return cookies;
-}
-
-static void php_info_roxen(ZEND_MODULE_INFO_FUNC_ARGS)
-{
-#if 0
- char buf[512];
-
- PUTS("<table border=5 width=600>\n");
- php_info_print_table_row(2, "SAPI module version", "$Id$");
- /* php_info_print_table_row(2, "Build date", Ns_InfoBuildDate());
- php_info_print_table_row(2, "Config file path", Ns_InfoConfigFile());
- php_info_print_table_row(2, "Error Log path", Ns_InfoErrorLog());
- php_info_print_table_row(2, "Installation path", Ns_InfoHomePath());
- php_info_print_table_row(2, "Hostname of server", Ns_InfoHostname());
- php_info_print_table_row(2, "Source code label", Ns_InfoLabel());
- php_info_print_table_row(2, "Server platform", Ns_InfoPlatform());
- snprintf(buf, 511, "%s/%s", Ns_InfoServerName(), Ns_InfoServerVersion());
- php_info_print_table_row(2, "Server version", buf);
- snprintf(buf, 511, "%d day(s), %02d:%02d:%02d",
- uptime / 86400,
- (uptime / 3600) % 24,
- (uptime / 60) % 60,
- uptime % 60);
- php_info_print_table_row(2, "Server uptime", buf);
- */
- PUTS("</table>");
-#endif
-}
-
-static zend_module_entry php_roxen_module = {
- "Roxen",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- php_info_roxen,
- STANDARD_MODULE_PROPERTIES
-};
-
-static int php_roxen_startup(sapi_module_struct *sapi_module)
-{
- if(php_module_startup(sapi_module) == FAILURE
- || zend_register_module(&php_roxen_module) == FAILURE) {
- return FAILURE;
- } else {
- return SUCCESS;
- }
-}
-
-/* this structure is static (as in "it does not change") */
-
-void pike_module_exit(void);
-
-static sapi_module_struct sapi_module = {
- "PHP Language",
-
- php_module_startup, /* startup */
- pike_module_exit, /* shutdown */
-
- php_roxen_sapi_ub_write, /* unbuffered write */
-
- php_error, /* error handler */
-
- php_roxen_sapi_header_handler, /* header handler */
- php_roxen_sapi_send_headers, /* send headers handler */
- NULL, /* send header handler */
-
- php_roxen_sapi_read_post, /* read POST data */
- php_roxen_sapi_read_cookies, /* read Cookies */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-/*
- * php_roxen_hash_environment() populates the php script environment
- * with a number of variables. HTTP_* variables are created for
- * the HTTP header data, so that a script can access these.
- */
-#define ADD_STRING(name) \
- MAKE_STD_ZVAL(pval); \
- pval->type = IS_STRING; \
- pval->value.str.len = strlen(buf); \
- pval->value.str.val = estrndup(buf, pval->value.str.len); \
- zend_hash_update(&EG(symbol_table), name, sizeof(name), \
- &pval, sizeof(zval *), NULL)
-
-static void
-php_roxen_hash_environment(CLS_D ELS_DC PLS_DC SLS_DC)
-{
- int i;
- char buf[512];
- zval *pval;
- struct svalue *headers;
- struct pike_string *sind;
- struct array *indices;
- struct svalue *ind, *val;
-#ifdef ROXEN_USE_ZTS
- GET_THIS();
-#endif
- sind = make_shared_string("env");
- headers = low_mapping_string_lookup(REQUEST_DATA, sind);
- free_string(sind);
- if(headers && headers->type == PIKE_T_MAPPING) {
- indices = mapping_indices(headers->u.mapping);
- for(i = 0; i < indices->size; i++) {
- ind = &indices->item[i];
- val = low_mapping_lookup(headers->u.mapping, ind);
- if(ind && ind->type == PIKE_T_STRING &&
- val && val->type == PIKE_T_STRING) {
- int buf_len;
- buf_len = MIN(511, ind->u.string->len);
- strncpy(buf, ind->u.string->str, buf_len);
- buf[buf_len] = '\0'; /* Terminate correctly */
- MAKE_STD_ZVAL(pval);
- pval->type = IS_STRING;
- pval->value.str.len = val->u.string->len;
- pval->value.str.val = estrndup(val->u.string->str, pval->value.str.len);
- /* fprintf(stderr, "Header: %s(%d)=%s\n", buf, buf_len, val->u.string->str);*/
-
- zend_hash_update(&EG(symbol_table), buf, buf_len + 1, &pval, sizeof(zval *), NULL);
- }
- }
- free_array(indices);
- }
-
- /*
- MAKE_STD_ZVAL(pval);
- pval->type = IS_LONG;
- pval->value.lval = Ns_InfoBootTime();
- zend_hash_update(&EG(symbol_table), "SERVER_BOOTTIME", sizeof("SERVER_BOOTTIME"), &pval, sizeof(zval *), NULL);
-
- fprintf(stderr, "Set up header environment.\n");
- */
-}
-
-/*
- * php_roxen_module_main() is called by the per-request handler and
- * "executes" the script
- */
-
-static int php_roxen_module_main(SLS_D)
-{
- int res;
- zend_file_handle file_handle;
-#ifdef ZTS
- CLS_FETCH();
- PLS_FETCH();
- ELS_FETCH();
-#ifdef ROXEN_USE_ZTS
- GET_THIS();
-#endif
-#endif
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = THIS->filename;
- file_handle.free_filename = 0;
- THREADS_ALLOW();
- fprintf(stderr, "Request Startup.\n");
- res = php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC);
- THREADS_DISALLOW();
- if(res == FAILURE) {
- return 0;
- }
- php_roxen_hash_environment(CLS_C ELS_CC PLS_CC SLS_CC);
- THREADS_ALLOW();
- fprintf(stderr, "Script Execute.\n");
- php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
- php_request_shutdown(NULL);
- THREADS_DISALLOW();
- return 1;
-}
-
-/*
- * The php_roxen_request_handler() is called per request and handles
- * everything for one request.
- */
-
-void f_php_roxen_request_handler(INT32 args)
-{
- struct object *my_fd_obj;
- struct mapping *request_data;
- struct svalue *done_callback, *raw_fd;
- struct pike_string *script, *ind;
- int status = 1;
- SLS_FETCH();
-#ifdef ROXEN_USE_ZTS
- GET_THIS();
-#endif
-
- if(current_thread == th_self())
- error("PHP4.Interpetor->run: Tried to run a PHP-script from a PHP "
- "callback!");
- get_all_args("PHP4.Interpretor->run", args, "%S%m%O%*", &script,
- &request_data, &my_fd_obj, &done_callback);
- if(done_callback->type != PIKE_T_FUNCTION)
- error("PHP4.Interpretor->run: Bad argument 4, expected function.\n");
- PHP_LOCK(THIS); /* Need to lock here or reusing the same object might cause
- * problems in changing stuff in that object */
-#ifndef ROXEN_USE_ZTS
- GET_THIS();
-#endif
- THIS->request_data = request_data;
- THIS->my_fd_obj = my_fd_obj;
- THIS->filename = script->str;
- current_thread = th_self();
- SG(request_info).query_string = lookup_string_header("QUERY_STRING", 0);;
- SG(server_context) = (void *)1; /* avoid server_context == NULL */
- /* path_translated is the absolute path to the file */
- SG(request_info).path_translated =
- lookup_string_header("PATH_TRANSLATED", NULL);
- SG(request_info).request_uri = lookup_string_header("DOCUMENT_URI", NULL);
- if(!SG(request_info).request_uri)
- SG(request_info).request_uri = lookup_string_header("SCRIPT_NAME", NULL);
- SG(request_info).request_method = lookup_string_header("REQUEST_METHOD", "GET");
- SG(request_info).content_length = lookup_integer_header("CONTENT_LENGTH", 0);
- SG(request_info).content_type = "text/html";
- SG(request_info).auth_user = NULL;
- SG(request_info).auth_password = NULL;
-
- ind = make_shared_binary_string("my_fd", 5);
- raw_fd = low_mapping_string_lookup(THIS->request_data, ind);
- if(raw_fd && raw_fd->type == PIKE_T_OBJECT)
- {
- int fd = fd_from_object(raw_fd->u.object);
- if(fd == -1)
- error("PHP4.Interpretor->run: my_fd object not open or not an FD.\n");
- THIS->my_fd = fd;
- } else
- THIS->my_fd = 0;
-
- status = php_roxen_module_main(SLS_C);
- current_thread = -1;
- PHP_UNLOCK(THIS);
-
- apply_svalue(done_callback, 0);
- pop_stack();
- pop_n_elems(args);
- push_int(status);
-
-}
-
-
-/* Clear the object global struct */
-static void clear_struct(struct object *o)
-{
- MEMSET(fp->current_storage, 0, sizeof(php_roxen_request));
-}
-
-
-/*
- * pike_module_init() is called by Pike once at startup
- *
- * This functions allocates basic structures
- */
-
-void pike_module_init()
-{
- if (!roxen_php_initialized) {
-#ifdef ZTS
- tsrm_startup(1, 1, 0);
-#ifdef ROXEN_USE_ZTS
- roxen_globals_id = ts_allocate_id(sizeof(php_roxen_request), NULL, NULL);
-#endif
-#endif
- sapi_startup(&sapi_module);
- php_roxen_startup(&sapi_module);
- roxen_php_initialized = 1;
- PHP_INIT_LOCK();
- }
- start_new_program(); /* Text */
- ADD_STORAGE(php_roxen_request);
- set_init_callback(clear_struct);
- pike_add_function("run", f_php_roxen_request_handler,
- "function(string,mapping,object,function:int)", 0);
- add_program_constant("Interpretor", (php_program = end_program()), 0);
-}
-
-/*
- * pike_module_exit() performs the last steps before the
- * server exists. Shutdowns basic services and frees memory
- */
-
-void pike_module_exit(void)
-{
- roxen_php_initialized = 0;
- sapi_module.shutdown(&sapi_module);
- if(php_program) free_program(php_program);
-#ifdef ZTS
- tsrm_shutdown();
-#endif
- PHP_DESTROY();
-}
-#endif
diff --git a/sapi/servlet/Makefile.am b/sapi/servlet/Makefile.am
deleted file mode 100644
index d729f60a4c..0000000000
--- a/sapi/servlet/Makefile.am
+++ /dev/null
@@ -1,28 +0,0 @@
-# $Id$
-
-SRC=servlet.c java.c
-
-CFLAGS=@CFLAGS@ @JAVA_CFLAGS@
-INCLUDES=@INCLUDES@ @JAVA_INCLUDE@ -I@top_srcdir@ -I@top_srcdir@/libzend
-noinst_LTLIBRARIES=libphpsapi_servlet.la
-libphpsapi_servlet_la_SOURCES=$(SRC)
-
-java.c : ../../ext/java/java.c
- @cp ../../ext/java/java.c .
-
-phplib_DATA=phpsrvlt.jar
-phpsrvlt.jar : servlet.java ../../ext/java/reflect.java
- @test -e net || mkdir net
- @test -e net/php || mkdir net/php
- @cp servlet.java net/php
- @cp ../../ext/java/reflect.java net/php
- javac net/php/reflect.java
- @echo library=php4>net/php/reflect.properties
- @echo library=php4>net/php/servlet.properties
- @test ! -f reflect.class || mv reflect.class net/php # bug in KJC javac
- javac -classpath .:@SERVLET_CLASSPATH@:@JAVA_CLASSPATH@ net/php/servlet.java
- @test ! -f servlet.class || mv servlet.class net/php # bug in KJC javac
- zip -q0 phpsrvlt.jar net/php/*.class net/php/*.properties
- @rm net/php/servlet.* net/php/reflect.*
- @rmdir net/php
- @rmdir net
diff --git a/sapi/servlet/README b/sapi/servlet/README
deleted file mode 100644
index de6782ecf9..0000000000
--- a/sapi/servlet/README
+++ /dev/null
@@ -1,52 +0,0 @@
-What is PHP4 sapi/servlet?
-
- PHP4 sapi/servlet builds upon the mechanism defined by ext/java to enable
- the entire PHP processor to be run as a servlet. The primary advanatage
- of this from a PHP perspective is that web servers which support servlets
- typically take great care in pooling and reusing JVMs.
-
- Notes:
-
- 1) While this code is intended to be able to run on any servlet engine,
- it has only been tested on Apache's Jakarta/tomcat to date. Bug
- reports, success stories and/or patches required to get this code
- to run on other engines would be appreciated.
-
- 2) This code clean compiles on Win32 and Linux, and is able to process
- phpinfo() commands. Most of the code is in place, but very little
- testing has been done on even such basic things as cookies and
- sessions. Treat this code as early alpha at this point.
-
- 3) Until overload resolution is addressed in php/java, much of the
- javax.servlet interfaces can not be directly called. For example,
- don't try to get the output stream from $response, and expect to
- be able to use println. For now, use PHP's "echo" instead.
-
- 4) PHP has a habit of changing the working directory. Sapi/servlet will
- eventually change it back, but while PHP is running the servlet engine
- may not be able to load any classes from the CLASSPATH which are
- specified using a relative directory syntax, or find the work directory used
- for administration and JSP compilation tasks.
-
-Build and execution instructions:
-
- Most of the configuration hassles associated with ext/java are associated
- with starting the JVM, and as such do not apply to sapi/servlet. In
- particular, no updates to php.ini are required on any operating system.
-
- Unix:
- Build:
- ./configure --with-servlet --with-java
- Execute:
- add phpsrvlet.jar to CLASSPATH
- add directory containing libphp4.so to LD_LIBRARY_PATH
- merge/overwrite build/tomcat/examples/WEB-INF/web.xml from sapi/servlet
-
- Win32:
- Build:
- add jdsk (or d:\build\tomcat\classes) to CLASSPATH
- build sapi\servlet\servlet.dsp
- Execute:
- add phpsrvlet.jar to CLASSPATH
- add directory containing php4ts.dll and phpsrvlt.dll to PATH
- merge/overwrite build\tomcat\examples\WEB-INF\web.xml from sapi\servlet
diff --git a/sapi/servlet/config.h.stub b/sapi/servlet/config.h.stub
deleted file mode 100644
index bd5601c02e..0000000000
--- a/sapi/servlet/config.h.stub
+++ /dev/null
@@ -1,3 +0,0 @@
-#ifndef SAPI_SERVLET
-#define SAPI_SERVLET 0
-#endif
diff --git a/sapi/servlet/config.m4 b/sapi/servlet/config.m4
deleted file mode 100644
index dc38d142b4..0000000000
--- a/sapi/servlet/config.m4
+++ /dev/null
@@ -1,40 +0,0 @@
-# $Id$
-# config.m4 for servlet sapi
-
-AC_MSG_CHECKING(for Servlet support)
-AC_ARG_WITH(servlet,
-[ --with-servlet[=DIR] Include servlet support. DIR is the base install
- directory for the JSDK. This SAPI prereqs the
- java extension must be built as a shared dl.],
-[
- if test "$withval" != "no"; then
-
- if test "$withval" = "yes"; then
- SERVLET_CLASSPATH=.
- else
- if test -f $withval/lib/jsdk.jar; then
- SERVLET_CLASSPATH=$withval/lib/jsdk.jar
- else
- if test -d $withval/javax; then
- SERVLET_CLASSPATH=$withval
- else
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(unable to find JSDK libraries)
- fi
- fi
- fi
-
- AC_DEFINE(SAPI_SERVLET)
- PHP_EXTENSION(servlet, "shared")
- PHP_SAPI=servlet
- PHP_BUILD_SHARED
- PHP_BUILD_THREAD_SAFE
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-
-AC_SUBST(SERVLET_CLASSPATH)
diff --git a/sapi/servlet/servlet.c b/sapi/servlet/servlet.c
deleted file mode 100644
index aada017b2b..0000000000
--- a/sapi/servlet/servlet.c
+++ /dev/null
@@ -1,380 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_0.txt. |
- | 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: Sam Ruby (rubys@us.ibm.com) |
- +----------------------------------------------------------------------+
-*/
-
-#include <jni.h>
-
-#include "dl/phpdl.h"
-#include "php.h"
-#include "php_globals.h"
-
-#include "SAPI.h"
-
-#include <stdio.h>
-#include "php.h"
-#if WIN32|WINNT
-#include "win32/time.h"
-#include "win32/signal.h"
-#include <process.h>
-#else
-#include "build-defs.h"
-#endif
-#if HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-#if HAVE_SETLOCALE
-#include <locale.h>
-#endif
-#include "zend.h"
-#include "php_ini.h"
-#include "php_globals.h"
-#include "main.h"
-#include "fopen-wrappers.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/php_dir.h"
-#include "snprintf.h"
-#if WIN32|WINNT
-#include <io.h>
-#include <fcntl.h>
-#include "win32/syslog.h"
-#include "win32/php_registry.h"
-#else
-#include <syslog.h>
-#endif
-
-#include "zend_compile.h"
-#include "zend_execute.h"
-#include "zend_highlight.h"
-#include "zend_indent.h"
-
-#if WIN32|WINNT || !defined(HAVE_GETOPT)
-#include "php_getopt.h"
-#endif
-
-PHPAPI extern char *php3_ini_path;
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setEnv
- (JNIEnv *newJenv, jclass self);
-
-PHPAPI extern char *optarg;
-PHPAPI extern int optind;
-
-typedef struct {
- JNIEnv *jenv;
- jobject servlet;
- char *cookies;
-} servlet_request;
-
-/***************************************************************************/
-
-/*
- * JNI convenience utilities
- */
-
-#define SETSTRING(target, source) \
- { const char *UTFString; \
- if (source) { \
- UTFString = (*jenv)->GetStringUTFChars(jenv, source, 0); \
- target = estrdup(UTFString); \
- (*jenv)->ReleaseStringUTFChars(jenv, source, UTFString); \
- } else { \
- target = 0; \
- } }
-
-#define FREESTRING(target) \
- { if (target) { efree(target); target=0; } }
-
-void ThrowIOException (JNIEnv *jenv, char *msg) {
- jclass iox = (*jenv)->FindClass (jenv, "java/io/IOException");
- (*jenv)->ThrowNew (jenv, iox, (msg?msg:"null") );
- printf("IOException: %s\n", msg);
-}
-
-void ThrowServletException (JNIEnv *jenv, char *msg) {
- jclass sx = (*jenv)->FindClass (jenv, "javax/servlet/ServletException");
- (*jenv)->ThrowNew (jenv, sx, msg);
- printf("ServletException: %s\n", msg);
-}
-
-/***************************************************************************/
-
-/*
- * sapi callbacks
- */
-
-static int zend_servlet_ub_write(const char *str, uint str_length)
-{
- SLS_FETCH();
- if (!SG(server_context)) {
- fprintf(stderr, str);
- return 0;
- }
-
- {
- JNIEnv *jenv = ((servlet_request*)SG(server_context))->jenv;
- jobject servlet = ((servlet_request*)SG(server_context))->servlet;
-
- jclass servletClass = (*jenv)->GetObjectClass(jenv, servlet);
- jmethodID write = (*jenv)->GetMethodID(jenv, servletClass, "write",
- "(Ljava/lang/String;)V");
- jstring arg=(*jenv)->NewStringUTF(jenv, str);
- (*jenv)->CallVoidMethod(jenv, servlet, write, arg);
- (*jenv)->DeleteLocalRef(jenv, arg);
- return str_length;
- }
-}
-
-
-static void sapi_servlet_send_header(sapi_header_struct *sapi_header, void *server_context)
-{
- SLS_FETCH();
- if (!sapi_header) return;
- if (!SG(server_context)) return;
-
- {
- JNIEnv *jenv = ((servlet_request*)SG(server_context))->jenv;
- jobject servlet = ((servlet_request*)SG(server_context))->servlet;
-
- jclass servletClass = (*jenv)->GetObjectClass(jenv, servlet);
- jmethodID header = (*jenv)->GetMethodID(jenv, servletClass, "header",
- "(Ljava/lang/String;)V");
- jstring arg=(*jenv)->NewStringUTF(jenv, sapi_header->header);
- (*jenv)->CallVoidMethod(jenv, servlet, header, arg);
- (*jenv)->DeleteLocalRef(jenv, arg);
- }
-}
-
-
-static int sapi_servlet_read_post(char *buffer, uint count_bytes SLS_DC)
-{
- JNIEnv *jenv = ((servlet_request*)SG(server_context))->jenv;
- jobject servlet = ((servlet_request*)SG(server_context))->servlet;
-
- jclass servletClass = (*jenv)->GetObjectClass(jenv, servlet);
- jmethodID readPost = (*jenv)->GetMethodID(jenv, servletClass, "readPost",
- "(I)Ljava/lang/String;");
- jstring post = (*jenv)->CallObjectMethod(jenv, servlet, readPost,
- count_bytes);
-
- const char *postAsUTF = (*jenv)->GetStringUTFChars(jenv, post, 0);
- uint read_bytes=(*jenv)->GetStringLength(jenv, post);
- if (read_bytes>count_bytes) read_bytes=count_bytes;
-
- memcpy(buffer, postAsUTF, count_bytes);
-
- (*jenv)->ReleaseStringUTFChars(jenv, post, postAsUTF);
-
- return read_bytes;
-}
-
-
-static char *sapi_servlet_read_cookies(SLS_D)
-{
- JNIEnv *jenv = ((servlet_request*)SG(server_context))->jenv;
- jobject servlet = ((servlet_request*)SG(server_context))->servlet;
-
- jclass servletClass = (*jenv)->GetObjectClass(jenv, servlet);
- jmethodID readCookies = (*jenv)->GetMethodID(jenv, servletClass,
- "readCookies", "()Ljava/lang/String;");
- jstring cookies = (*jenv)->CallObjectMethod(jenv, servlet, readCookies);
-
- SETSTRING( ((servlet_request*)SG(server_context))->cookies, cookies);
-
- return ((servlet_request*)SG(server_context))->cookies;
-}
-
-/***************************************************************************/
-
-/*
- * sapi maintenance
- */
-
-static sapi_module_struct sapi_module = {
- "PHP Language", /* name */
-
- php_module_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- zend_servlet_ub_write, /* unbuffered write */
-
- php_error, /* error handler */
-
- NULL, /* header handler */
- NULL, /* send headers handler */
- sapi_servlet_send_header, /* send header handler */
-
- sapi_servlet_read_post, /* read POST data */
- sapi_servlet_read_cookies, /* read Cookies */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-
-JNIEXPORT void JNICALL Java_net_php_servlet_startup
- (JNIEnv *jenv, jobject self)
-{
-
-#ifdef ZTS
- tsrm_startup(1,1,0);
-#else
- if (setjmp(EG(bailout))!=0) {
- ThrowServletException(jenv,"bailout");
- return;
- }
-#endif
-
- sapi_startup(&sapi_module);
-
- if (php_module_startup(&sapi_module)==FAILURE) {
- ThrowServletException(jenv,"module startup failure");
- return;
- }
-}
-
-
-JNIEXPORT void JNICALL Java_net_php_servlet_shutdown
- (JNIEnv *jenv, jobject self)
-{
- SLS_FETCH();
-
- php_module_shutdown();
-#ifdef ZTS
- tsrm_shutdown();
-#endif
- return;
-}
-
-/***************************************************************************/
-
-/*
- * define a Java object to PHP
- */
-
-JNIEXPORT jlong JNICALL Java_net_php_servlet_define
- (JNIEnv *jenv, jobject self, jstring name)
-{
- pval *pzval;
- jlong addr = 0;
- ELS_FETCH();
- const char *nameAsUTF = (*jenv)->GetStringUTFChars(jenv, name, 0);
-
- MAKE_STD_ZVAL(pzval);
- (pval*)(long)addr = pzval;
-
- zend_hash_add(&EG(symbol_table), (char*)nameAsUTF,
- strlen(nameAsUTF)+1, &pzval, sizeof(pval *), NULL);
- (*jenv)->ReleaseStringUTFChars(jenv, name, nameAsUTF);
-
- return addr;
-}
-
-/*
- * execute a script
- */
-
-JNIEXPORT void JNICALL Java_net_php_servlet_send
- (JNIEnv *jenv, jobject self,
- jstring requestMethod, jstring queryString,
- jstring pathInfo, jstring pathTranslated,
- jstring contentType, jint contentLength, jstring authUser)
-{
-
- zend_file_handle file_handle;
- char cwd[MAXPATHLEN+1];
- jlong addr = 0;
- SLS_FETCH();
- PLS_FETCH();
- CLS_FETCH();
- ELS_FETCH();
-
-#ifdef ZTS
- if (setjmp(EG(bailout))!=0) {
- ThrowServletException(jenv,"bailout");
- return;
- }
-#endif
-
- SG(server_context) = emalloc(sizeof(servlet_request));
- ((servlet_request*)SG(server_context))->jenv=jenv;
- ((servlet_request*)SG(server_context))->servlet=self;
- ((servlet_request*)SG(server_context))->cookies=0;
-
- CG(extended_info) = 0;
-
- /*
- * Initialize the request
- */
- SETSTRING( SG(request_info).auth_user, authUser );
- SETSTRING( SG(request_info).request_method, requestMethod );
- SETSTRING( SG(request_info).query_string, queryString );
- SETSTRING( SG(request_info).request_uri, pathInfo );
- SETSTRING( SG(request_info).content_type, contentType );
- SG(request_info).content_length = contentLength;
- SG(request_info).auth_password = NULL;
- if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
- ThrowServletException(jenv,"request startup failure");
- return;
- }
-
- /*
- * Parse the file
- */
- SETSTRING( SG(request_info).path_translated, pathTranslated );
- getcwd(cwd,MAXPATHLEN);
- file_handle.handle.fp = php3_fopen_for_parser();
- chdir(cwd);
- file_handle.filename = SG(request_info).path_translated;
- file_handle.free_filename = 0;
- file_handle.type = ZEND_HANDLE_FP;
-
- if (!file_handle.handle.fp) {
- php_request_shutdown((void *) 0);
- php_module_shutdown();
- ThrowIOException(jenv,file_handle.filename);
- return;
- }
-
- /*
- * Execute the request
- */
- Java_net_php_reflect_setEnv(jenv, 0);
- php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
-
- /*
- * Clean up
- */
- php3_header(); /* Make sure headers have been sent */
-
- FREESTRING(SG(request_info).request_method);
- FREESTRING(SG(request_info).query_string);
- FREESTRING(SG(request_info).request_uri);
- FREESTRING(SG(request_info).path_translated);
- FREESTRING(SG(request_info).content_type);
- FREESTRING(SG(request_info).auth_user);
- FREESTRING(((servlet_request*)SG(server_context))->cookies);
- efree(SG(server_context));
- SG(server_context)=0;
-
- php_request_shutdown((void *) 0);
-}
-
diff --git a/sapi/servlet/servlet.dsp b/sapi/servlet/servlet.dsp
deleted file mode 100644
index 4dca8ce049..0000000000
--- a/sapi/servlet/servlet.dsp
+++ /dev/null
@@ -1,271 +0,0 @@
-# Microsoft Developer Studio Project File - Name="servlet" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=servlet - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "servlet.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "servlet.mak" CFG="servlet - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "servlet - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "servlet - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "servlet - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "servlet - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "servlet - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\Release"
-# PROP BASE Intermediate_Dir "..\..\Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release"
-# PROP Intermediate_Dir "..\..\Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\libzend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php_java.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release/phpsrvlt.dll" /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Release"
-
-!ELSEIF "$(CFG)" == "servlet - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "..\..\Debug"
-# PROP BASE Intermediate_Dir "..\..\Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug"
-# PROP Intermediate_Dir "..\..\Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\libzend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /D ZEND_DEBUG=1 /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php_java.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug/phpsrvlt.dll" /pdbtype:sept /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Debug"
-
-!ELSEIF "$(CFG)" == "servlet - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "..\..\Debug_TS"
-# PROP BASE Intermediate_Dir "..\..\Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "..\..\Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\libzend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /FR /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\libzend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D ZEND_DEBUG=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /D "ZTS" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts.lib php_java.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/phpsrvlt.dll" /pdbtype:sept /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "servlet - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\Release_TS"
-# PROP BASE Intermediate_Dir "..\..\Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "..\..\Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\..\libzend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\libzend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /D "ZTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib php_java.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/phpsrvlt.dll" /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Release_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "servlet - Win32 Release"
-# Name "servlet - Win32 Debug"
-# Name "servlet - Win32 Debug_TS"
-# Name "servlet - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\servlet.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ext\java\java.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Java Files"
-
-# PROP Default_Filter "java"
-# Begin Source File
-
-SOURCE=.\servlet.java
-
-!IF "$(CFG)" == "servlet - Win32 Release"
-
-# Begin Custom Build
-OutDir=.\..\..\Release
-InputPath=.\servlet.java
-
-"$(OutDir)\phpsrvlt.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy $(InputPath) net\php > nul
- copy ..\..\ext\java\reflect.java net\php > nul
- echo library=phpsrvlt>net/php/reflect.properties
- echo library=phpsrvlt>net/php/servlet.properties
- $(JAVA_HOME)\bin\javac net\php\servlet.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\phpsrvlt.jar net\php\*.class net\php\*.properties
- erase net\php\servlet.*
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "servlet - Win32 Debug"
-
-# Begin Custom Build
-OutDir=.\..\..\Debug
-InputPath=.\servlet.java
-
-"$(OutDir)\phpsrvlt.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy $(InputPath) net\php > nul
- copy ..\..\ext\java\reflect.java net\php > nul
- echo library=phpsrvlt>net/php/reflect.properties
- echo library=phpsrvlt>net/php/servlet.properties
- $(JAVA_HOME)\bin\javac -g net\php\servlet.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\phpsrvlt.jar net\php\*.class net\php\*.properties
- erase net\php\servlet.*
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "servlet - Win32 Debug_TS"
-
-USERDEP__SERVL=".\servlet.java"
-# Begin Custom Build
-OutDir=.\..\..\Debug_TS
-InputPath=.\servlet.java
-
-"$(OutDir)\phpsrvlt.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy *.java net\php > nul
- copy ..\..\ext\java\reflect.java net\php > nul
- echo library=phpsrvlt>net/php/reflect.properties
- echo library=phpsrvlt>net/php/servlet.properties
- $(JAVA_HOME)\bin\javac -g net\php\servlet.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\phpsrvlt.jar net\php\*.class net\php\*.properties
- erase net\php\servlet.*
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "servlet - Win32 Release_TS"
-
-# Begin Custom Build
-OutDir=.\..\..\Release_TS
-InputPath=.\servlet.java
-
-"$(OutDir)\phpsrvlt.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy $(InputPath) net\php > nul
- copy ..\..\ext\java\reflect.java net\php > nul
- echo library=phpsrvlt>net/php/reflect.properties
- echo library=phpsrvlt>net/php/servlet.properties
- $(JAVA_HOME)\bin\javac net\php\servlet.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\phpsrvlt.jar net\php\*.class net\php\*.properties
- erase net\php\servlet.*
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\servlet.java
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\jtest.php
-# End Source File
-# End Target
-# End Project
diff --git a/sapi/servlet/servlet.java b/sapi/servlet/servlet.java
deleted file mode 100644
index 62be4f1d2c..0000000000
--- a/sapi/servlet/servlet.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_0.txt. |
- | 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: Sam Ruby (rubys@us.ibm.com) |
- +----------------------------------------------------------------------+
-*/
-
-package net.php;
-
-import java.io.IOException;
-import javax.servlet.*;
-import javax.servlet.http.*;
-
-public class servlet extends HttpServlet {
-
- char slash=System.getProperty("file.separator").charAt(0);
- HttpServletRequest request;
- HttpServletResponse response;
- ServletInputStream stream;
-
- /******************************************************************/
- /* native methods */
- /******************************************************************/
-
- static { reflect.loadLibrary("servlet"); }
- native void startup();
- native long define(String name);
- native void send(String requestMethod, String queryString,
- String pathInfo, String pathTranslated,
- String contentType, int contentLength, String authUser);
- native void shutdown();
-
- /******************************************************************/
- /* sapi callbacks */
- /******************************************************************/
-
- String readPost(int bytes) {
- try {
- if (stream == null) stream=request.getInputStream();
- byte[] data = new byte[bytes];
- int len = stream.read(data, 0, bytes);
- if (len <= 0) return "";
- return new String(data, 0, len);
- } catch (IOException e) {
- return "";
- }
- }
-
- String readCookies() {
- reflect.setResult(define("request"), request);
- reflect.setResult(define("response"), response);
- return request.getHeader("cookie");
- }
-
- void header(String data) {
- try {
- if (data.startsWith("Content-Type: ")) {
- response.setContentType(data.substring(data.indexOf(" ")+1));
- } else if (data.startsWith("Location: ")) {
- response.sendRedirect(data.substring(data.indexOf(" ")+1));
- } else {
- int colon = data.indexOf(": ");
- if (colon > 0) {
- response.addHeader(data.substring(0,colon),
- data.substring(colon+2));
- } else {
- response.getWriter().println(data);
- }
- }
- } catch (IOException e) {
- System.err.print(data);
- }
- }
-
- void write(String data) {
- try {
- response.getWriter().print(data);
- } catch (IOException e) {
- System.err.print(data);
- }
- }
-
- /******************************************************************/
- /* servlet interface */
- /******************************************************************/
-
- public void init(ServletConfig config) throws ServletException {
- super.init(config);
- startup();
- }
-
- public void service(HttpServletRequest request,
- HttpServletResponse response)
- throws ServletException
- {
- this.request=request;
- this.response=response;
- send(request.getMethod(), request.getQueryString(),
- request.getPathInfo(), getPathTranslated(),
- request.getContentType(), request.getContentLength(),
- request.getRemoteUser());
-
- try {
- if (stream != null) stream.close();
- } catch (IOException e) {
- throw new ServletException(e);
- }
- }
-
- public void destroy() {
- shutdown();
- super.destroy();
- }
-
- /******************************************************************/
- /* utility function */
- /******************************************************************/
-
- String getPathTranslated() {
- /* I have no idea why this has to be this hard... */
- String servletPath=request.getServletPath();
- String contextPath=getServletContext().getRealPath(servletPath);
- servletPath=servletPath.replace('/',slash);
- contextPath=contextPath.substring(0,contextPath.lastIndexOf(slash));
- return contextPath+servletPath;
- }
-}
diff --git a/sapi/servlet/web.xml b/sapi/servlet/web.xml
deleted file mode 100644
index b6113aa332..0000000000
--- a/sapi/servlet/web.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-
-<!DOCTYPE web-app
- PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
- "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
-
-<web-app>
- <servlet>
- <servlet-name>
- php
- </servlet-name>
- <servlet-class>
- net.php.servlet
- </servlet-class>
- </servlet>
- <servlet-mapping>
- <servlet-name>
- php
- </servlet-name>
- <url-pattern>
- *.php
- </url-pattern>
- </servlet-mapping>
-</web-app>