[PHP-DEV] Zeus support for PHP4 From: Ben Mansell (ben <email protected>)
Date: 03/27/00

Hello,

Here's a patch to PHP that enables it to compile and run using the Zeus
Web Server (version 3.3.6 and later). With this patch, the ISAPI module
will be built correctly with Zeus on most UNIX-like platforms.

I would greatly appreciate it if someone could check through this patch
to ensure that it won't break any other parts of PHP (such as ISAPI on
IIS) and, if it looks OK, please can it be added to the source?

I'd also be interested in hearing from any Zeus users who would be
willing to test out the PHP-4 with ISAPI support. If you are interested
in being a tester, please mail me!

Thanks,

Ben Mansell

diff -u -r php-old/ChangeLog php-4.0b4pl1/ChangeLog
--- php-old/ChangeLog Mon Feb 21 02:09:03 2000
+++ php-4.0b4pl1/ChangeLog Thu Mar 23 17:53:23 2000
@@ -1,3 +1,10 @@
+2000-03-23 Ben Mansell <ben <email protected>>
+
+ * sapi/isapi/php4isapi.c: Update to build with Zeus Web Server
+
+ * INSTALL
+ README.Zeus: Instructions for building PHP with Zeus
+
 2000-02-20 MySQL Team <mysql-all <email protected>>
 
     * ext/mysql/libmysql/.cvsignore
diff -u -r php-old/INSTALL php-4.0b4pl1/INSTALL
--- php-old/INSTALL Sun Dec 12 08:38:10 1999
+++ php-4.0b4pl1/INSTALL Thu Mar 23 15:43:06 2000
@@ -7,6 +7,8 @@
 an Apache module for Apache 1.3.x with MySQL support. A more verbose
 explanation follows.
 
+INSTALLATION WITH THE ZEUS WEB SERVER:
+--Please see the 'README.Zeus' file included in this distribution
 
 QUICK INSTALL
 
diff -u -r php-old/README.Zeus php-4.0b4pl1/README.Zeus
--- /dev/null Mon Mar 27 15:30:28 2000
+++ php-4.0b4pl1/README.Zeus Thu Mar 23 17:59:39 2000
@@ -0,0 +1,51 @@
+Using PHP4 with the Zeus Web Server
+-----------------------------------
+
+Zeus fully supports running PHP in combination with our webserver. A
+significant improvement in PHP 4 is that you can now run PHP as an
+ISAPI module, giving great performance benefits over traditional CGI
+code.
+
+Note that you will need to be running at least version 3.3.6 of the
+webserver. If you are running an earlier version, please see our
+website (http://www.zeus.com) for upgrade instructions.
+
+
+To build the ISAPI version of PHP, start the configuration with:
+
+./configure --with-zeus=/usr/local/zeus
+
+Obviously, replace /usr/local/zeus with the location of where you have
+installed Zeus on your machine. For PHP to build successfully, you
+need to have 3.3.6 already installed, because the code relies on the
+presence of header files provided with the latest version.
+
+
+Configuring the webserver
+-------------------------
+
+After running 'make' and 'make install', you will have a 'libphp4.so'
+file. Copy this file into a directory reserved for ISAPI
+binaries. Now, perform the following steps for each virtual server
+that you wish to run PHP on:
+
+1) On the Admin server, go to 'edit server->path mapping'
+2) Add an alias to the directory with libphp4.so in it, mapped to
+ /isapi/ (or a location of your choice). Make sure you set the alias
+ type to ISAPI.
+3) Click 'update'
+4) Add a handler for file extension .php to be run by /isapi/libphp4.so
+5) Click 'update', then go back to the previous page.
+6) Click on the 'module configuration' button, ensure that ISAPI
+ support is ticked.
+7) Click on the ISAPI link. At the bottom of the page, click the
+ checkbox for running ISAPI extensions 'out of process'.
+8) Click 'update'. Then restart the virtual server. Done!
+
+
+For more information and help with Zeus, please visit our website:
+
+http://www.zeus.com
+
+
+
diff -u -r php-old/sapi/isapi/php4isapi.c php-4.0b4pl1/sapi/isapi/php4isapi.c
--- php-old/sapi/isapi/php4isapi.c Sat Feb 19 23:41:25 2000
+++ php-4.0b4pl1/sapi/isapi/php4isapi.c Wed Mar 22 12:14:39 2000
@@ -20,9 +20,12 @@
 #ifdef PHP_WIN32
 # include <windows.h>
 # include <process.h>
+# define SEPARATOR '\\'
 #else
 # define __try
 # define __except(val)
+# define __declspec(foo)
+# define SEPARATOR '/'
 #endif
 
 #include <httpext.h>
@@ -37,7 +40,9 @@
 #include "php_ini.h"
 
 #ifdef WITH_ZEUS
-#include "zeus.h"
+#include "httpext.h"
+#include <errno.h>
+#define GetLastError() errno
 #endif
 
 #define MAX_STATUS_LENGTH sizeof("xxxx LONGEST STATUS DESCRIPTION")
@@ -218,9 +223,7 @@
                         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;
@@ -450,12 +453,12 @@
         SG(request_info).content_type = lpECB->lpszContentType;
         SG(request_info).content_length = lpECB->cbTotalBytes;
         {
- char *path_end = strrchr(SG(request_info).path_translated, '\\');
+ char *path_end = strrchr(SG(request_info).path_translated, SEPARATOR);
 
                 if (path_end) {
                         *path_end = 0;
                         chdir(SG(request_info).path_translated);
- *path_end = '\\';
+ *path_end = SEPARATOR;
                 }
         }
         if (!bFilterLoaded) { /* we don't have valid ISAPI Filter information */
@@ -488,7 +491,11 @@
 BOOL WINAPI GetExtensionVersion(HSE_VERSION_INFO *pVer)
 {
         pVer->dwExtensionVersion = HSE_VERSION;
+#ifdef WITH_ZEUS
+ strncpy( pVer->lpszExtensionDesc, sapi_module.name, HSE_MAX_EXT_DLL_NAME_LEN);
+#else
         lstrcpyn(pVer->lpszExtensionDesc, sapi_module.name, HSE_MAX_EXT_DLL_NAME_LEN);
+#endif
         return TRUE;
 }

-- 
Ben Mansell, <ben <email protected>>                       Zeus Technology Ltd
Download the world's fastest webserver!   Universally Serving the Net
T:+44(0)1223 525000 F:+44(0)1223 525100           http://www.zeus.com
Newton House,  Cambridge Business Park,  Cambridge,  CB4 0WZ, ENGLAND

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>