]> granicus.if.org Git - php/commitdiff
- Fix some issues with the ISAPI module, made it friendlier to non Win32 platforms
authorZeev Suraski <zeev@php.net>
Fri, 18 Feb 2000 17:59:44 +0000 (17:59 +0000)
committerZeev Suraski <zeev@php.net>
Fri, 18 Feb 2000 17:59:44 +0000 (17:59 +0000)
- Added .reg file for PWS setup
- Reordered some stuff in phpinfo()

NEWS
ext/standard/info.c
ext/standard/info.h
sapi/isapi/PWS-php4.reg [new file with mode: 0644]
sapi/isapi/php4isapi.c
tests/run.html [new file with mode: 0644]
tests/run.php [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 53bcb6b89562db6755b2343a93c1bbf0c2c7672e..6ab7607d871c82cb712b7f91a50755774ca4ceca 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,8 @@ PHP 4.0                                                                    NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 
 ?? ?? ????, Version 4.0 Beta 4
+- Made PHP work under Microsoft Personal Web Server, under both Windows NT
+  workstation and Windows 95 (Zeev)
 - Made multipart/form-data content obey to the variables_order directive (Zeev)
 - Updated the browscap module to work with PHP 4.0 (Zeev)
 - Recover gracefully in ISAPI after the client prematurely presses STOP (Andi)
index f4058636d349fc7175ec8eaf0d9ac383df7f7f91..2110753d970032e72d5343631a4a493a63e0d013 100644 (file)
@@ -274,30 +274,49 @@ void php_print_credits(int flag)
 
        PUTS("<h1>PHP 4.0 Credits</h1>\n");
 
+       if (flag & PHP_CREDITS_GROUP) {
+               /* Group */
+
+               PUTS("<table border=5 width=\"600\">\n");
+               php_info_print_table_header(1, "PHP Group");
+               php_info_print_table_row(1, "Thies C. Arntzen, Stig Bakken, Andi Gutmans, Rasmus Lerdorf, \
+                                       Sascha Schumann, Zeev Suraski, Jim Winstead, Andrei Zmievski");
+               PUTS("</table>\n");
+       }
+
        if (flag & PHP_CREDITS_GENERAL) {
                /* Language */
+
                PUTS("<table border=5 width=\"600\">\n");
                PUTS("<tr><th colspan=\"2\" bgcolor=\"" PHP_HEADER_COLOR "\">PHP 4.0 Authors</th></tr>\n");
                php_info_print_table_header(2, "Contribution", "Authors");
-               CREDIT_LINE("PHP Group", "Thies C. Arntzen, Stig Bakken, Andi Gutmans, Rasmus Lerdorf, \
-                                       Sascha Schumann, Zeev Suraski, Jim Winstead, Andrei Zmievski");
                CREDIT_LINE("Zend Scripting Language Engine", "Andi Gutmans, Zeev Suraski");
                CREDIT_LINE("Extension Module API", "Andi Gutmans, Zeev Suraski");
                CREDIT_LINE("UNIX Build and Modularization", "Stig Bakken, Sascha Schumann");
                CREDIT_LINE("Win32 Port", "Shane Caraveo, Zeev Suraski");
                CREDIT_LINE("Server API (SAPI) Abstraction Layer", "Andi Gutmans, Shane Caraveo, Zeev Suraski");
-               CREDIT_LINE("Apache SAPI Module", "Rasmus Lerdorf, Zeev Suraski");
-               CREDIT_LINE("ISAPI SAPI Module", "Andi Gutmans, Zeev Suraski");
-               CREDIT_LINE("CGI SAPI Module", "Rasmus Lerdorf, Stig Bakken");
-               CREDIT_LINE("AOLserver SAPI Module", "Sascha Schumann");
-               CREDIT_LINE("Servlet SAPI Module", "Sam Ruby");
-               CREDIT_LINE("Roxen SAPI Module", "David Hedbor");
-               CREDIT_LINE("thttpd SAPI Module", "Sascha Schumann");
+               PUTS("</table>\n");
+       }
+
+       if (flag & PHP_CREDITS_GENERAL) {
+               /* SAPI Modules */
+
+               PUTS("<table border=5 width=\"600\">\n");
+               PUTS("<tr><th colspan=\"2\" bgcolor=\"" PHP_HEADER_COLOR "\">SAPI Modules</th></tr>\n");
+               php_info_print_table_header(2, "Contribution", "Authors");
+               CREDIT_LINE("Apache", "Rasmus Lerdorf, Zeev Suraski");
+               CREDIT_LINE("ISAPI", "Andi Gutmans, Zeev Suraski");
+               CREDIT_LINE("CGI", "Rasmus Lerdorf, Stig Bakken");
+               CREDIT_LINE("AOLserver", "Sascha Schumann");
+               CREDIT_LINE("Java Servlet", "Sam Ruby");
+               CREDIT_LINE("Roxen", "David Hedbor");
+               CREDIT_LINE("thttpd", "Sascha Schumann");
                PUTS("</table>\n");
        }
 
        if (flag & PHP_CREDITS_MODULES) {
                /* Modules */
+
                PUTS("<table border=5 width=\"600\">\n");
                PUTS("<tr><th colspan=\"2\" bgcolor=\"" PHP_HEADER_COLOR "\">Module Authors</th></tr>\n");
                php_info_print_table_header(2, "Module", "Authors");
@@ -410,6 +429,13 @@ void register_phpinfo_constants(INIT_FUNC_ARGS)
        REGISTER_LONG_CONSTANT("INFO_VARIABLES", PHP_INFO_VARIABLES, CONST_PERSISTENT|CONST_CS);
        REGISTER_LONG_CONSTANT("INFO_LICENSE", PHP_INFO_LICENSE, CONST_PERSISTENT|CONST_CS);
        REGISTER_LONG_CONSTANT("INFO_ALL", PHP_INFO_ALL, CONST_PERSISTENT|CONST_CS);
+       REGISTER_LONG_CONSTANT("CREDITS_GROUP", PHP_CREDITS_GROUP, CONST_PERSISTENT|CONST_CS);
+       REGISTER_LONG_CONSTANT("CREDITS_GENERAL",       PHP_CREDITS_GENERAL, CONST_PERSISTENT|CONST_CS);
+       REGISTER_LONG_CONSTANT("CREDITS_SAPI",  PHP_CREDITS_SAPI, CONST_PERSISTENT|CONST_CS);
+       REGISTER_LONG_CONSTANT("CREDITS_MODULES",       PHP_CREDITS_MODULES, CONST_PERSISTENT|CONST_CS);
+       REGISTER_LONG_CONSTANT("CREDITS_DOCS",  PHP_CREDITS_DOCS, CONST_PERSISTENT|CONST_CS);
+       REGISTER_LONG_CONSTANT("CREDITS_FULLPAGE",      PHP_CREDITS_FULLPAGE, CONST_PERSISTENT|CONST_CS);
+       REGISTER_LONG_CONSTANT("CREDITS_ALL",   PHP_CREDITS_ALL, CONST_PERSISTENT|CONST_CS);
 }
 
 
index 72aadf72ee4744df42977b23cec7ed9f9b5e50b1..eaf7f38c6d67b8d309017f03b1a496873f9f671e 100644 (file)
 #define PHP_INFO_ALL                           0xFFFFFFFF
 
 
-#define PHP_CREDITS_GENERAL                    (1<<0)
-#define PHP_CREDITS_MODULES                    (1<<1)
-#define PHP_CREDITS_DOCS                       (1<<2)
-#define PHP_CREDITS_FULLPAGE           (1<<3)
+#define PHP_CREDITS_GROUP                      (1<<0)
+#define PHP_CREDITS_GENERAL                    (1<<1)
+#define PHP_CREDITS_SAPI                       (1<<2)
+#define PHP_CREDITS_MODULES                    (1<<3)
+#define PHP_CREDITS_DOCS                       (1<<4)
+#define PHP_CREDITS_FULLPAGE           (1<<5)
 #define PHP_CREDITS_ALL                                0xFFFFFFFF
 
 #define PHP_LOGO_GUID  "PHPE9568F34-D428-11d2-A769-00AA001ACF42"
diff --git a/sapi/isapi/PWS-php4.reg b/sapi/isapi/PWS-php4.reg
new file mode 100644 (file)
index 0000000..47804a9
--- /dev/null
@@ -0,0 +1,5 @@
+REGEDIT4
+
+[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w3svc\parameters\Script Map]
+".php"="[PUT PATH HERE]\\php4isapi.dll"
+
index 8e6999a74590b0626e37d771609655f8ea17a60e..3ffb4da617b660520f0c79311840eb4aa500f939 100644 (file)
    +----------------------------------------------------------------------+
  */
 
-#if WIN32|WINNT
+#ifdef PHP_WIN32
 # include <windows.h>
+# include <process.h>
+#else
+# define __try
+# define __except(val)
 #endif
+
 #include <httpext.h>
 #include <httpfilt.h>
 #include <httpext.h>
@@ -29,6 +34,7 @@
 #include "php_globals.h"
 #include "ext/standard/info.h"
 #include "php_variables.h"
+#include "php_ini.h"
 
 #ifdef WITH_ZEUS
 #include "zeus.h"
@@ -39,6 +45,7 @@
 #define ISAPI_POST_DATA_BUF 1024
 
 static zend_bool bFilterLoaded=0;
+static zend_bool bTerminateThreadsOnError=0;
 
 static char *isapi_server_variables[] = {
        "ALL_HTTP",
@@ -136,11 +143,10 @@ static int sapi_isapi_ub_write(const char *str, uint str_length)
        DWORD num_bytes = str_length;
        LPEXTENSION_CONTROL_BLOCK ecb;
        SLS_FETCH();
-       ELS_FETCH();
        
        ecb = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
        if (ecb->WriteClient(ecb->ConnID, (char *) str, &num_bytes, HSE_IO_SYNC ) == FALSE) {
-               longjmp(EG(bailout), 1);
+               zend_bailout();
        }
        return num_bytes;
 }
@@ -235,6 +241,7 @@ static int php_isapi_startup(sapi_module_struct *sapi_module)
                || zend_startup_module(&php_isapi_module)==FAILURE) {
                return FAILURE;
        } else {
+               bTerminateThreadsOnError = (zend_bool) INI_INT("isapi.terminate_threads_on_error");
                return SUCCESS;
        }
 }
@@ -486,6 +493,16 @@ BOOL WINAPI GetExtensionVersion(HSE_VERSION_INFO *pVer)
 }
 
 
+static void my_endthread()
+{
+#ifdef PHP_WIN32
+       if (bTerminateThreadsOnError) {
+               _endthread();
+       }
+#endif
+}
+
+
 DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB)
 {
        zend_file_handle file_handle;
@@ -514,6 +531,7 @@ DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB)
                        efree(SG(request_info).cookie_data);
                }
        } __except(EXCEPTION_EXECUTE_HANDLER) {
+#ifdef PHP_WIN32
                if (_exception_code()==EXCEPTION_STACK_OVERFLOW) {
                        LPBYTE lpPage;
                        static SYSTEM_INFO si;
@@ -533,28 +551,30 @@ DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB)
 
                        /* Free pages below current page */
                        if (!VirtualFree(mi.AllocationBase, (LPBYTE)lpPage - (LPBYTE) mi.AllocationBase, MEM_DECOMMIT)) {
-                               ExitThread(0);
+                               _endthread();
                        }
 
                        /* Restore the guard page */
                        if (!VirtualProtect(lpPage, si.dwPageSize, PAGE_GUARD | PAGE_READWRITE, &dwOldProtect)) {
-                               ExitThread(0);
+                               _endthread();
                        }
 
                        CG(unclean_shutdown)=1;
                        php_isapi_report_exception("Stack overflow", sizeof("Stack overflow")-1 SLS_CC);
                } else if (_exception_code()==EXCEPTION_ACCESS_VIOLATION) {
                        php_isapi_report_exception("Access violation", sizeof("Access violation")-1 SLS_CC);
-                       ExitThread(0);
+                       my_endthread();
                } else {
-                       ExitThread(0);
+                       php_isapi_report_exception("Unknown fatal exception", sizeof("Unknown fatal exception")-1 SLS_CC);
+                       my_endthread();
                }
+#endif
        }
 
        __try {
                php_request_shutdown(NULL);
        } __except(EXCEPTION_EXECUTE_HANDLER) {
-               ExitThread(0);
+               my_endthread();
        }
 
        return HSE_STATUS_SUCCESS;
diff --git a/tests/run.html b/tests/run.html
new file mode 100644 (file)
index 0000000..281e9e5
--- /dev/null
@@ -0,0 +1,11 @@
+<html>
+<body>
+<form action="run.php" method="POST">
+
+<textarea name="code" cols=50 rows=20>
+</textarea><br>
+<input type="submit" value="Go!">
+</form>
+
+</body>
+</html>
diff --git a/tests/run.php b/tests/run.php
new file mode 100644 (file)
index 0000000..a6792b5
--- /dev/null
@@ -0,0 +1,17 @@
+<?
+if (!isset($code)) {
+       exit("No code submitted.");
+}
+?>
+<html>
+<body>
+Executing:<br>
+<?
+highlight_string("<?php \n$code\n?>");
+?>
+<hr width="40%">
+<?
+eval($code);
+?>
+</body>
+</html>
\ No newline at end of file