summaryrefslogtreecommitdiff
path: root/sapi/aolserver
diff options
context:
space:
mode:
Diffstat (limited to 'sapi/aolserver')
-rw-r--r--sapi/aolserver/CREDITS2
-rw-r--r--sapi/aolserver/README69
-rw-r--r--sapi/aolserver/aolserver.c625
-rw-r--r--sapi/aolserver/config.m431
-rw-r--r--sapi/aolserver/config.w3216
-rw-r--r--sapi/aolserver/php.sym2
-rw-r--r--sapi/aolserver/php5aolserver.dsp135
7 files changed, 880 insertions, 0 deletions
diff --git a/sapi/aolserver/CREDITS b/sapi/aolserver/CREDITS
new file mode 100644
index 0000000..8f9a4af
--- /dev/null
+++ b/sapi/aolserver/CREDITS
@@ -0,0 +1,2 @@
+AOLserver
+Sascha Schumann
diff --git a/sapi/aolserver/README b/sapi/aolserver/README
new file mode 100644
index 0000000..80c186e
--- /dev/null
+++ b/sapi/aolserver/README
@@ -0,0 +1,69 @@
+AOLserver README ($Id$)
+
+To compile PHP 4.0 as a module for AOLserver, you need:
+
+- installed AOLserver 3.1 or later
+ (see the note below for AOLserver 3.0)
+
+NOTE: You should not use this module in production. PHP is not 100% stable
+ yet in threaded mode. To increase reliability enable the Global Lock
+ by removing #define NO_GLOBAL_LOCK in main/main.c. Also don't use
+ php_value as it will lead to races in a sub-system (use an ini file
+ instead).
+
+
+1.) Configuring AOLserver
+
+Read doc/install.txt in the source distribution
+
+It usually boils down to changing the INST/PREFIX variable in
+include/Makefile.global and running make all install.
+
+2.) Configuring PHP
+
+$ ./configure \
+ --with-aolserver=/path/to/installed/aolserver \
+ <other options>
+
+NOTE: If you are still using AOLserver 3.0, you need to retain the
+ AOLserver source code and pass another option to PHP:
+
+ --with-aolserver-src=/path/to/source/distribution
+
+3.) Compiling and Installing PHP
+
+$ make install
+
+4.) Changing nsd.tcl
+
+a) New section
+
+Add a new section to pass options to PHP (required):
+
+ns_section "ns/server/${servername}/module/php"
+
+You can use the following commands in this section:
+
+The 'map' command will cause AOLserver to pass all requests to *.php to
+the PHP module (can be specified multiple times). Example:
+
+ns_param map *.php
+
+The 'php_value "name val"' command assigns the configuration option name
+the value val (can be used multiple times). Example:
+
+ns_param php_value "session.auto_start 1"
+
+b) Enabling PHP
+
+Then enable the PHP module:
+
+ns_section "ns/server/${servername}/modules"
+...
+ns_param php ${bindir}/libphp5.so
+
+
+=============================================================================
+This has been tested with AOLserver release 3.0.
+
+AOLserver support has been written by Sascha Schumann <sascha@schumann.cx>.
diff --git a/sapi/aolserver/aolserver.c b/sapi/aolserver/aolserver.c
new file mode 100644
index 0000000..3dcbc8d
--- /dev/null
+++ b/sapi/aolserver/aolserver.c
@@ -0,0 +1,625 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2013 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.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 SECTION(name) PUTS("<h2>" name "</h2>\n")
+
+#define NS_BUF_SIZE 511
+
+#include "php_ini.h"
+#include "php_globals.h"
+#include "SAPI.h"
+#include "php_main.h"
+#include "php_variables.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 NSG(v) TSRMG(ns_globals_id, ns_globals_struct *, v)
+
+/* 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;
+
+/* TSRM id */
+
+static int ns_globals_id;
+
+/* global context */
+
+static php_ns_context *global_context;
+
+static void php_ns_config(php_ns_context *ctx, char global);
+
+/*
+ * php_ns_sapi_ub_write() writes data to the client connection.
+ */
+
+static int
+php_ns_sapi_ub_write(const char *str, uint str_length TSRMLS_DC)
+{
+ int n;
+ uint sent = 0;
+
+ while (str_length > 0) {
+ n = Ns_ConnWrite(NSG(conn), (void *) str, str_length);
+
+ if (n == -1)
+ php_handle_aborted_connection();
+
+ str += n;
+ sent += n;
+ str_length -= n;
+ }
+
+ return sent;
+}
+
+/*
+ * 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 TSRMLS_DC)
+{
+ char *header_name, *header_content;
+ char *p;
+
+ 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 TSRMLS_DC)
+{
+ 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 TSRMLS_DC)
+{
+ uint max_read;
+ uint total_read = 0;
+
+ 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(TSRMLS_D)
+{
+ int i;
+ char *http_cookie = NULL;
+
+ 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;
+
+ php_info_print_table_start();
+ 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);
+ php_info_print_table_end();
+
+ SECTION("HTTP Headers Information");
+ php_info_print_table_start();
+ php_info_print_table_colspan_header(2, "HTTP Request Headers");
+ 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));
+ }
+
+ php_info_print_table_colspan_header(2, "HTTP Response Headers");
+ 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));
+ }
+ php_info_print_table_end();
+}
+
+PHP_FUNCTION(getallheaders);
+
+/* {{{ arginfo */
+ZEND_BEGIN_ARG_INFO(arginfo_aolserver_getallheaders, 0)
+ZEND_END_ARG_INFO()
+/* }}} */
+
+static const zend_function_entry aolserver_functions[] = {
+ PHP_FE(getallheaders, arginfo_aolserver_getallheaders)
+ {NULL, NULL, NULL}
+};
+
+static zend_module_entry php_aolserver_module = {
+ STANDARD_MODULE_HEADER,
+ "AOLserver",
+ aolserver_functions,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ php_info_aolserver,
+ NULL,
+ STANDARD_MODULE_PROPERTIES
+};
+
+PHP_FUNCTION(getallheaders)
+{
+ int i;
+
+ array_init(return_value);
+
+ 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, &php_aolserver_module, 1) == FAILURE) {
+ return FAILURE;
+ } else {
+ return SUCCESS;
+ }
+}
+
+
+/*
+ * php_ns_sapi_register_variables() 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_STRINGX(name, buf) \
+ php_register_variable(name, buf, track_vars_array TSRMLS_CC)
+
+#define ADD_STRING(name) \
+ ADD_STRINGX(name, buf)
+
+static void
+php_ns_sapi_register_variables(zval *track_vars_array TSRMLS_DC)
+{
+ int i;
+ char buf[NS_BUF_SIZE + 1];
+ 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;
+
+ snprintf(buf, NS_BUF_SIZE, "HTTP_%s", key);
+
+ for(p = buf + 5; (c = *p); p++) {
+ c = toupper(c);
+ if(c < 'A' || c > 'Z') {
+ c = '_';
+ }
+ *p = c;
+ }
+
+ ADD_STRINGX(buf, value);
+ }
+
+ 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");
+
+ ADD_STRINGX("REQUEST_METHOD", NSG(conn)->request->method);
+
+ if(NSG(conn)->request->query)
+ ADD_STRINGX("QUERY_STRING", NSG(conn)->request->query);
+
+ ADD_STRINGX("SERVER_BUILDDATE", Ns_InfoBuildDate());
+
+ ADD_STRINGX("REMOTE_ADDR", Ns_ConnPeer(NSG(conn)));
+
+ 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)
+ ADD_STRINGX("SERVER_NAME", tmp);
+
+ ADD_STRINGX("PATH_TRANSLATED", SG(request_info).path_translated);
+ ADD_STRINGX("REQUEST_URI", SG(request_info).request_uri);
+ ADD_STRINGX("PHP_SELF", SG(request_info).request_uri);
+
+ ADD_STRINGX("GATEWAY_INTERFACE", "CGI/1.1");
+
+ snprintf(buf, NS_BUF_SIZE, "%d", Ns_InfoBootTime());
+ ADD_STRING("SERVER_BOOTTIME");
+}
+
+
+
+/* this structure is static (as in "it does not change") */
+
+static sapi_module_struct aolserver_sapi_module = {
+ "aolserver",
+ "AOLserver",
+
+ php_ns_startup, /* startup */
+ php_module_shutdown_wrapper, /* shutdown */
+
+ NULL, /* activate */
+ NULL, /* deactivate */
+
+ php_ns_sapi_ub_write, /* unbuffered write */
+ NULL, /* flush */
+ NULL, /* get uid */
+ NULL, /* getenv */
+
+ 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 */
+
+ php_ns_sapi_register_variables,
+ NULL, /* Log message */
+ NULL, /* Get request time */
+ NULL, /* child terminate */
+
+ STANDARD_SAPI_MODULE_PROPERTIES
+};
+
+/*
+ * php_ns_module_main() is called by the per-request handler and
+ * "executes" the script
+ */
+
+static int
+php_ns_module_main(TSRMLS_D)
+{
+ zend_file_handle file_handle;
+
+ file_handle.type = ZEND_HANDLE_FILENAME;
+ file_handle.filename = SG(request_info).path_translated;
+ file_handle.free_filename = 0;
+ file_handle.opened_path = NULL;
+
+ php_ns_config(global_context, 0);
+ if (php_request_startup(TSRMLS_C) == FAILURE) {
+ return NS_ERROR;
+ }
+
+ php_execute_script(&file_handle TSRMLS_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(TSRMLS_D)
+{
+ char *server;
+ Ns_DString ds;
+ char *root;
+ int index;
+ char *tmp;
+
+ server = Ns_ConnServer(NSG(conn));
+
+#define safe_strdup(x) ((x)?strdup((x)):NULL)
+ SG(request_info).query_string = safe_strdup(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 = safe_strdup(Ns_DStringValue(&ds));
+ Ns_DStringFree(&ds);
+ root = Ns_PageRoot(server);
+ SG(request_info).request_uri = strdup(SG(request_info).path_translated + strlen(root));
+ SG(request_info).request_method = NSG(conn)->request->method;
+ if(NSG(conn)->request->version > 1.0) SG(request_info).proto_num = 1001;
+ else SG(request_info).proto_num = 1000;
+ 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);
+ SG(sapi_headers).http_response_code = 200;
+
+ 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(TSRMLS_D)
+{
+ free(SG(request_info).path_translated);
+ if (SG(request_info).query_string)
+ free(SG(request_info).query_string);
+ free(SG(request_info).request_uri);
+}
+
+/*
+ * 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;
+ TSRMLS_FETCH();
+
+ NSG(conn) = conn;
+
+ SG(server_context) = global_context;
+
+ php_ns_request_ctor(TSRMLS_C);
+
+ status = php_ns_module_main(TSRMLS_C);
+
+ php_ns_request_dtor(TSRMLS_C);
+
+ 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, char global)
+{
+ int i;
+ char *path;
+ Ns_Set *set;
+
+ path = Ns_ConfigGetPath(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 (global && !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);
+
+ /*
+ * Deactivated for now. The ini system will cause random crashes when
+ * accessed from here (since there are no locks to protect the global
+ * known_directives)
+ */
+
+ } else if (!global && !strcasecmp(key, "php_value")) {
+ Ns_Log(Notice, "php_value has been deactivated temporarily. Please use a php.ini file to pass directives to PHP. Thanks.");
+#if 0
+ 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);
+ zend_alter_ini_entry(new_key, strlen(new_key) + 1, val,
+ strlen(val) + 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
+
+ efree(new_key);
+ }
+#endif
+ }
+
+ }
+}
+
+/*
+ * php_ns_server_shutdown() performs the last steps before the
+ * server exits. 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();
+ 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, NULL);
+ sapi_startup(&aolserver_sapi_module);
+ sapi_module.startup(&aolserver_sapi_module);
+
+ /* TSRM is used to allocate a per-thread structure */
+ ts_allocate_id(&ns_globals_id, sizeof(ns_globals_struct), NULL, NULL);
+
+ /* the context contains data valid for all threads */
+ ctx = malloc(sizeof *ctx);
+ ctx->sapi_module = &aolserver_sapi_module;
+ ctx->ns_server = strdup(server);
+ ctx->ns_module = strdup(module);
+
+ /* read the configuration */
+ php_ns_config(ctx, 1);
+
+ global_context = ctx;
+
+ /* register shutdown handler */
+ Ns_RegisterServerShutdown(server, php_ns_server_shutdown, ctx);
+
+ return NS_OK;
+}
+
+#endif
diff --git a/sapi/aolserver/config.m4 b/sapi/aolserver/config.m4
new file mode 100644
index 0000000..a193bfd
--- /dev/null
+++ b/sapi/aolserver/config.m4
@@ -0,0 +1,31 @@
+dnl
+dnl $Id$
+dnl
+
+PHP_ARG_WITH(aolserver,,
+[ --with-aolserver=DIR Specify path to the installed AOLserver], no, no)
+
+AC_MSG_CHECKING([for AOLserver support])
+
+if test "$PHP_AOLSERVER" != "no"; then
+ if test -d "$PHP_AOLSERVER/include"; then
+ PHP_AOLSERVER_SRC=$PHP_AOLSERVER
+ fi
+ if test -z "$PHP_AOLSERVER_SRC" || test ! -d $PHP_AOLSERVER_SRC/include; then
+ AC_MSG_ERROR(Please specify the path to the source distribution of AOLserver using --with-aolserver-src=DIR)
+ fi
+ if test ! -d $PHP_AOLSERVER/bin ; then
+ AC_MSG_ERROR(Please specify the path to the root of AOLserver using --with-aolserver=DIR)
+ fi
+ PHP_BUILD_THREAD_SAFE
+ PHP_ADD_INCLUDE($PHP_AOLSERVER_SRC/include)
+ AC_DEFINE(HAVE_AOLSERVER,1,[Whether you have AOLserver])
+ PHP_SELECT_SAPI(aolserver, shared, aolserver.c)
+ INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)$PHP_AOLSERVER/bin/"
+fi
+
+AC_MSG_RESULT([$PHP_AOLSERVER])
+
+dnl ## Local Variables:
+dnl ## tab-width: 4
+dnl ## End:
diff --git a/sapi/aolserver/config.w32 b/sapi/aolserver/config.w32
new file mode 100644
index 0000000..75b4361
--- /dev/null
+++ b/sapi/aolserver/config.w32
@@ -0,0 +1,16 @@
+// vim:ft=javascript
+// $Id$
+
+ARG_WITH('aolserver', 'Build AOLserver support', 'no');
+
+if (PHP_AOLSERVER != "no") {
+ if (PHP_ZTS == "no") {
+ WARNING("AOLSERVER module requires an --enable-zts build of PHP");
+ } else {
+ if (CHECK_HEADER_ADD_INCLUDE("ns.h", "CFLAGS_AOLSERVER", PHP_AOLSERVER) && CHECK_LIB("nsd.lib", "aolserver", PHP_AOLSERVER)) {
+ SAPI('aolserver', 'aolserver.c', 'php' + PHP_VERSION + 'aolserver.so', '/D XP_WIN32 ');
+ } else {
+ WARNING("sapi/aolserver not enabled: Could not find libraries/headers");
+ }
+ }
+}
diff --git a/sapi/aolserver/php.sym b/sapi/aolserver/php.sym
new file mode 100644
index 0000000..b401ffd
--- /dev/null
+++ b/sapi/aolserver/php.sym
@@ -0,0 +1,2 @@
+Ns_ModuleVersion
+Ns_ModuleInit
diff --git a/sapi/aolserver/php5aolserver.dsp b/sapi/aolserver/php5aolserver.dsp
new file mode 100644
index 0000000..dd6ad71
--- /dev/null
+++ b/sapi/aolserver/php5aolserver.dsp
@@ -0,0 +1,135 @@
+# Microsoft Developer Studio Project File - Name="php5aolserver" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=php5aolserver - 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 "php5aolserver.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 "php5aolserver.mak" CFG="php5aolserver - Win32 Debug_TS"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "php5aolserver - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "php5aolserver - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "php5aolserver - Win32 Debug_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)" == "php5aolserver - 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 "PHP5AOLSERVER_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\..\..\php_build\nsapi30\include\\" /I "..\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\tsrm" /D ZEND_DEBUG=0 /D "NDEBUG" /D "PHP5AOLSERVER_EXPORTS" /D "PHP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WIN32" /D "_MBCS" /D "HAVE_AOLSERVER" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /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 nsd.lib php5ts.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 /base:"0x62000000" /version:4.0 /dll /machine:I386 /out:"../../Release_TS/php5aolserver.so" /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Release_TS" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\Zend\Release_TS"
+
+!ELSEIF "$(CFG)" == "php5aolserver - Win32 Release_TS_inline"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release_TS_inline"
+# PROP BASE Intermediate_Dir "Release_TS_inline"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\..\Release_TS_inline"
+# PROP Intermediate_Dir "Release_TS_inline"
+# 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 "PHP5AOLSERVER_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\..\..\php_build\nsapi30\include\\" /I "..\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\tsrm" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "NDEBUG" /D "PHPAOLSERVER_EXPORTS" /D "PHP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WIN32" /D "_MBCS" /D "HAVE_AOLSERVER" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /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 nsd.lib php5ts.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 /base:"0x62000000" /version:4.0 /dll /machine:I386 /out:"../../Release_TS_inline/php5aolserver.so" /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Release_TS_inline" /libpath:"..\..\TSRM\Release_TS_inline" /libpath:"..\..\Zend\Release_TS_inline"
+
+!ELSEIF "$(CFG)" == "php5aolserver - 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 /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP5AOLSERVER_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "..\..\..\php_build\nsapi30\include\\" /I "..\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\tsrm" /D "_DEBUG" /D ZEND_DEBUG=1 /D "PHP5AOLSERVER_EXPORTS" /D "PHP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WIN32" /D "_MBCS" /D "HAVE_AOLSERVER" /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /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 nsd.lib php5ts_debug.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 /base:"0x62000000" /version:4.0 /dll /debug /machine:I386 /out:"..\..\Debug_TS/php5aolserver.so" /pdbtype:sept /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Debug_TS" /libpath:"..\..\TSRM\Debug_TS" /libpath:"..\..\Zend\Debug_TS"
+
+!ENDIF
+
+# Begin Target
+
+# Name "php5aolserver - Win32 Release_TS"
+# Name "php5aolserver - Win32 Release_TS_inline"
+# Name "php5aolserver - Win32 Debug_TS"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\aolserver.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project