From f4983c0d3f56c2074458e4840db36643b2fec59b Mon Sep 17 00:00:00 2001 From: foobar Date: Sat, 17 Jan 2004 13:00:38 +0000 Subject: - Renamed all *php4* files to *php5*, changed all php4/PHP4 to php5/PHP5 --- sapi/activescript/README | 2 +- sapi/activescript/classfactory.cpp | 4 +- sapi/activescript/config.w32 | 4 +- sapi/activescript/php4activescript.c | 152 ---- sapi/activescript/php4activescript.def | 5 - sapi/activescript/php4activescript.dsp | 185 ---- sapi/activescript/php4activescript.h | 25 - sapi/activescript/php4as_classfactory.h | 52 -- sapi/activescript/php4as_scriptengine.h | 235 ----- sapi/activescript/php5activescript.c | 152 ++++ sapi/activescript/php5activescript.def | 5 + sapi/activescript/php5activescript.dsp | 185 ++++ sapi/activescript/php5activescript.h | 25 + sapi/activescript/php5as_classfactory.h | 52 ++ sapi/activescript/php5as_scriptengine.h | 235 +++++ sapi/activescript/scriptengine.cpp | 6 +- sapi/aolserver/README | 2 +- sapi/aolserver/php4aolserver.dsp | 135 --- sapi/aolserver/php5aolserver.dsp | 135 +++ sapi/apache/config.w32 | 2 +- sapi/apache/php4apache.dsp | 151 ---- sapi/apache/php5apache.dsp | 151 ++++ sapi/apache2handler/php4apache2.dsp | 146 --- sapi/apache2handler/php5apache2.dsp | 146 +++ sapi/apache_hooks/apMakefile.tmpl | 24 +- sapi/apache_hooks/config.m4 | 42 +- sapi/apache_hooks/config.w32 | 4 +- sapi/apache_hooks/libphp4.module.in | 11 - sapi/apache_hooks/libphp5.module.in | 11 + sapi/apache_hooks/mod_php4.c | 1474 ------------------------------- sapi/apache_hooks/mod_php4.exp | 1 - sapi/apache_hooks/mod_php4.h | 81 -- sapi/apache_hooks/mod_php5.c | 1474 +++++++++++++++++++++++++++++++ sapi/apache_hooks/mod_php5.exp | 1 + sapi/apache_hooks/mod_php5.h | 81 ++ sapi/apache_hooks/php.sym | 2 +- sapi/apache_hooks/php4apache_hooks.dsp | 151 ---- sapi/apache_hooks/php5apache_hooks.dsp | 151 ++++ sapi/apache_hooks/php_apache_http.h | 2 +- sapi/caudium/caudium.c | 10 +- sapi/caudium/config.m4 | 4 +- sapi/cgi/README.FastCGI | 2 +- sapi/continuity/capi.c | 2 +- sapi/embed/php4embed.dsp | 100 --- sapi/embed/php5embed.dsp | 100 +++ sapi/isapi/config.m4 | 2 +- sapi/isapi/config.w32 | 4 +- sapi/isapi/php4isapi.c | 949 -------------------- sapi/isapi/php4isapi.def | 5 - sapi/isapi/php4isapi.dsp | 165 ---- sapi/isapi/php5isapi.c | 949 ++++++++++++++++++++ sapi/isapi/php5isapi.def | 5 + sapi/isapi/php5isapi.dsp | 165 ++++ sapi/isapi/stresstest/notes.txt | 2 +- sapi/isapi/stresstest/stresstest.cpp | 2 +- sapi/nsapi/php4nsapi.dsp | 135 --- sapi/nsapi/php5nsapi.dsp | 135 +++ sapi/pi3web/README | 26 +- sapi/pi3web/config.m4 | 2 +- sapi/pi3web/config.w32 | 2 +- sapi/pi3web/php4pi3web.dsp | 136 --- sapi/pi3web/php5pi3web.dsp | 136 +++ sapi/pi3web/pi3web_sapi.c | 6 +- sapi/pi3web/pi3web_sapi.h | 8 +- sapi/roxen/README | 4 +- sapi/roxen/TODO | 12 +- sapi/roxen/config.m4 | 2 +- sapi/roxen/roxen.c | 8 +- sapi/thttpd/config.m4 | 4 +- sapi/thttpd/thttpd_patch | 2 +- sapi/tux/README | 16 +- sapi/tux/config.m4 | 2 +- sapi/webjames/README | 2 +- 73 files changed, 4403 insertions(+), 4403 deletions(-) delete mode 100644 sapi/activescript/php4activescript.c delete mode 100644 sapi/activescript/php4activescript.def delete mode 100644 sapi/activescript/php4activescript.dsp delete mode 100644 sapi/activescript/php4activescript.h delete mode 100644 sapi/activescript/php4as_classfactory.h delete mode 100644 sapi/activescript/php4as_scriptengine.h create mode 100644 sapi/activescript/php5activescript.c create mode 100644 sapi/activescript/php5activescript.def create mode 100644 sapi/activescript/php5activescript.dsp create mode 100644 sapi/activescript/php5activescript.h create mode 100644 sapi/activescript/php5as_classfactory.h create mode 100644 sapi/activescript/php5as_scriptengine.h delete mode 100644 sapi/aolserver/php4aolserver.dsp create mode 100644 sapi/aolserver/php5aolserver.dsp delete mode 100644 sapi/apache/php4apache.dsp create mode 100644 sapi/apache/php5apache.dsp delete mode 100644 sapi/apache2handler/php4apache2.dsp create mode 100644 sapi/apache2handler/php5apache2.dsp delete mode 100644 sapi/apache_hooks/libphp4.module.in create mode 100644 sapi/apache_hooks/libphp5.module.in delete mode 100644 sapi/apache_hooks/mod_php4.c delete mode 100644 sapi/apache_hooks/mod_php4.exp delete mode 100644 sapi/apache_hooks/mod_php4.h create mode 100644 sapi/apache_hooks/mod_php5.c create mode 100644 sapi/apache_hooks/mod_php5.exp create mode 100644 sapi/apache_hooks/mod_php5.h delete mode 100755 sapi/apache_hooks/php4apache_hooks.dsp create mode 100755 sapi/apache_hooks/php5apache_hooks.dsp delete mode 100644 sapi/embed/php4embed.dsp create mode 100644 sapi/embed/php5embed.dsp delete mode 100644 sapi/isapi/php4isapi.c delete mode 100644 sapi/isapi/php4isapi.def delete mode 100644 sapi/isapi/php4isapi.dsp create mode 100644 sapi/isapi/php5isapi.c create mode 100644 sapi/isapi/php5isapi.def create mode 100644 sapi/isapi/php5isapi.dsp delete mode 100644 sapi/nsapi/php4nsapi.dsp create mode 100644 sapi/nsapi/php5nsapi.dsp delete mode 100644 sapi/pi3web/php4pi3web.dsp create mode 100644 sapi/pi3web/php5pi3web.dsp (limited to 'sapi') diff --git a/sapi/activescript/README b/sapi/activescript/README index b033110332..70f49821d8 100644 --- a/sapi/activescript/README +++ b/sapi/activescript/README @@ -19,7 +19,7 @@ Installation. Build and install it somewhere; then register the engine like this: - regsvr32 php4activescript.dll + regsvr32 php5activescript.dll Usage. ====== diff --git a/sapi/activescript/classfactory.cpp b/sapi/activescript/classfactory.cpp index 4bcdafefdb..ecdd6f63a3 100644 --- a/sapi/activescript/classfactory.cpp +++ b/sapi/activescript/classfactory.cpp @@ -32,8 +32,8 @@ HINSTANCE module_handle; #include #include "TSRM.h" -#include "php4as_classfactory.h" -#include "php4as_scriptengine.h" +#include "php5as_classfactory.h" +#include "php5as_scriptengine.h" volatile LONG TPHPClassFactory::factory_count = 0; volatile LONG TPHPClassFactory::object_count = 0; diff --git a/sapi/activescript/config.w32 b/sapi/activescript/config.w32 index 9c2a3aa2d7..1448cb2398 100644 --- a/sapi/activescript/config.w32 +++ b/sapi/activescript/config.w32 @@ -8,6 +8,6 @@ if (PHP_ACTIVESCRIPT == "yes") { ERROR("ActiveScript module requires an --enable-zts build of PHP"); } - SAPI('activescript', 'classfactory.cpp php4activescript.c scriptengine.cpp', 'php' + PHP_VERSION + 'activescript.dll', '/D PHP4ISAPI_EXPORTS'); - ADD_FLAG('LDFLAGS_ACTIVESCRIPT', 'oleaut32.lib ole32.lib user32.lib advapi32.lib /DEF:' + configure_module_dirname + '\\php4activescript.def'); + SAPI('activescript', 'classfactory.cpp php5activescript.c scriptengine.cpp', 'php' + PHP_VERSION + 'activescript.dll', '/D PHP5ISAPI_EXPORTS'); + ADD_FLAG('LDFLAGS_ACTIVESCRIPT', 'oleaut32.lib ole32.lib user32.lib advapi32.lib /DEF:' + configure_module_dirname + '\\php5activescript.def'); } diff --git a/sapi/activescript/php4activescript.c b/sapi/activescript/php4activescript.c deleted file mode 100644 index 8ce96f1a8f..0000000000 --- a/sapi/activescript/php4activescript.c +++ /dev/null @@ -1,152 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2004 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 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_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: Wez Furlong | - +----------------------------------------------------------------------+ - */ -/* $Id$ */ - -#include "php.h" -#include "php_main.h" -#include "SAPI.h" -#include "php_globals.h" -#include "ext/standard/info.h" -#include "php_variables.h" -#include "php_ini.h" -#include "php4activescript.h" - -/* SAPI definitions and DllMain */ - -static int php_activescript_startup(sapi_module_struct *sapi_module) -{ - if (php_module_startup(sapi_module, &php_activescript_module, 1) == FAILURE) { - return FAILURE; - } else { - return SUCCESS; - } -} - -static int sapi_activescript_ub_write(const char *str, uint str_length TSRMLS_DC) -{ - /* In theory, this is a blackhole. In practice, I want to see the output - * in the debugger! */ - - char buf[1024]; - uint l, a = str_length; - - while(a) { - l = a; - if (l > sizeof(buf) - 1) - l = sizeof(buf) - 1; - memcpy(buf, str, l); - buf[l] = 0; - OutputDebugString(buf); - a -= l; - } - - return str_length; -} - -static void sapi_activescript_register_server_variables(zval *track_vars_array TSRMLS_DC) -{ -} - -static char *sapi_activescript_read_cookies(TSRMLS_D) -{ - return NULL; -} - -static int sapi_activescript_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC) -{ - return SAPI_HEADER_ADD; -} - -static int sapi_activescript_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) -{ - return SAPI_HEADER_SENT_SUCCESSFULLY; -} - -zend_module_entry php_activescript_module = { - STANDARD_MODULE_HEADER, - "ActiveScript", - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - STANDARD_MODULE_PROPERTIES -}; - - -sapi_module_struct activescript_sapi_module = { - "activescript", /* name */ - "Active Script", /* pretty name */ - - php_activescript_startup, /* startup */ - php_module_shutdown_wrapper, /* shutdown */ - - NULL, /* activate */ - NULL, /* deactivate */ - - sapi_activescript_ub_write, /* unbuffered write */ - NULL, /* flush */ - NULL, /* get uid */ - NULL, /* getenv */ - - zend_error, /* error handler */ - - sapi_activescript_header_handler, /* header handler */ - sapi_activescript_send_headers, /* send headers handler */ - NULL, /* send header handler */ - - NULL, /* read POST data */ - sapi_activescript_read_cookies, /* read Cookies */ - - sapi_activescript_register_server_variables, /* register server variables */ - NULL, /* Log message */ - - STANDARD_SAPI_MODULE_PROPERTIES -}; - -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) -{ - switch (fdwReason) { - case DLL_PROCESS_ATTACH: - module_handle = hinstDLL; - - tsrm_startup(128, 1, TSRM_ERROR_LEVEL_CORE, "C:\\TSRM.log"); - - sapi_startup(&activescript_sapi_module); - if (activescript_sapi_module.startup) { - activescript_sapi_module.startup(&sapi_module); - } - break; - case DLL_THREAD_ATTACH: - break; - case DLL_THREAD_DETACH: - ts_free_thread(); - break; - case DLL_PROCESS_DETACH: - if (activescript_sapi_module.shutdown) { - activescript_sapi_module.shutdown(&sapi_module); - } - tsrm_shutdown(); - break; - } - return TRUE; -} - - diff --git a/sapi/activescript/php4activescript.def b/sapi/activescript/php4activescript.def deleted file mode 100644 index f111b68db7..0000000000 --- a/sapi/activescript/php4activescript.def +++ /dev/null @@ -1,5 +0,0 @@ -EXPORTS -DllCanUnloadNow PRIVATE -DllGetClassObject PRIVATE -DllRegisterServer PRIVATE -DllUnregisterServer PRIVATE diff --git a/sapi/activescript/php4activescript.dsp b/sapi/activescript/php4activescript.dsp deleted file mode 100644 index cbfafa1272..0000000000 --- a/sapi/activescript/php4activescript.dsp +++ /dev/null @@ -1,185 +0,0 @@ -# Microsoft Developer Studio Project File - Name="php4activescript" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=php4activescript - 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 "php4activescript.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 "php4activescript.mak" CFG="php4activescript - Win32 Debug_TS" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "php4activescript - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "php4activescript - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "php4activescript - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "php4activescript - Win32 Release_TSDbg" (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)" == "php4activescript - 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 "PHP4ISAPI_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /Ze /W3 /Gm /GX /ZI /Od /Ob0 /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "_DEBUG" /D "COMPILE_LIBZEND" /D ZEND_DEBUG=1 /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /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 wsock32.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 php4ts_debug.lib /nologo /version:4.0 /dll /debug /machine:I386 /nodefaultlib:"libcmt" /pdbtype:sept /libpath:"..\..\Debug_TS" - -!ELSEIF "$(CFG)" == "php4activescript - 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 "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /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 /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS" - -!ELSEIF "$(CFG)" == "php4activescript - Win32 Release_TS_inline" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "php4activescript___Win32_Release_TS_inline" -# PROP BASE Intermediate_Dir "php4activescript___Win32_Release_TS_inline" -# PROP BASE Ignore_Export_Lib 0 -# 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 /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /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 CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /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 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" -# 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 /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS_inline" - -!ELSEIF "$(CFG)" == "php4activescript - Win32 Release_TSDbg" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "php4activescript___Win32_Release_TSDbg" -# PROP BASE Intermediate_Dir "php4activescript___Win32_Release_TSDbg" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\Release_TSDbg" -# PROP Intermediate_Dir "Release_TSDbg" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /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 wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS" -# 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 /version:4.0 /dll /debug /machine:I386 /libpath:"..\..\Release_TSDbg" - -!ENDIF - -# Begin Target - -# Name "php4activescript - Win32 Debug_TS" -# Name "php4activescript - Win32 Release_TS" -# Name "php4activescript - Win32 Release_TS_inline" -# Name "php4activescript - Win32 Release_TSDbg" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\classfactory.cpp -# End Source File -# Begin Source File - -SOURCE=.\php4activescript.c -# End Source File -# Begin Source File - -SOURCE=.\php4activescript.def -# End Source File -# Begin Source File - -SOURCE=.\scriptengine.cpp -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\php4activescript.h -# End Source File -# Begin Source File - -SOURCE=.\php4as_classfactory.h -# End Source File -# Begin Source File - -SOURCE=.\php4as_scriptengine.h -# End Source File -# End Group -# End Target -# End Project diff --git a/sapi/activescript/php4activescript.h b/sapi/activescript/php4activescript.h deleted file mode 100644 index ba8be9b51e..0000000000 --- a/sapi/activescript/php4activescript.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2004 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 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_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: Wez Furlong | - +----------------------------------------------------------------------+ - */ -/* $Id$ */ - -extern zend_module_entry php_activescript_module; -extern sapi_module_struct activescript_sapi_module; -extern HINSTANCE module_handle; -extern void activescript_error_func(int type, const char *error_msg, ...); -extern void activescript_error_handler(int type, const char *error_filename, - const uint error_lineno, const char *format, va_list args); diff --git a/sapi/activescript/php4as_classfactory.h b/sapi/activescript/php4as_classfactory.h deleted file mode 100644 index 2f1695fa0c..0000000000 --- a/sapi/activescript/php4as_classfactory.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2004 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 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_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: Wez Furlong | - +----------------------------------------------------------------------+ - */ -/* $Id$ */ - -/* IClassFactory Implementation */ - -#include - -// {A0AD8E7A-95EC-4819-986F-78D93895F2AE} -DEFINE_GUID(CLSID_PHPActiveScriptEngine, -0xa0ad8e7a, 0x95ec, 0x4819, 0x98, 0x6f, 0x78, 0xd9, 0x38, 0x95, 0xf2, 0xae); - -class TPHPClassFactory: - public IClassFactory -{ -protected: - volatile LONG m_refcount; - - static volatile LONG factory_count; - static volatile LONG object_count; - -public: /* IUnknown */ - STDMETHODIMP QueryInterface(REFIID iid, void **ppvObject); - STDMETHODIMP_(DWORD) AddRef(void); - STDMETHODIMP_(DWORD) Release(void); -public: /* IClassFactory */ - STDMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppvObject); - STDMETHODIMP LockServer(BOOL fLock); - - TPHPClassFactory(); - ~TPHPClassFactory(); - - static void AddToObjectCount(void); - static void RemoveFromObjectCount(void); - static int CanUnload(void); -}; - diff --git a/sapi/activescript/php4as_scriptengine.h b/sapi/activescript/php4as_scriptengine.h deleted file mode 100644 index fd5fd522a8..0000000000 --- a/sapi/activescript/php4as_scriptengine.h +++ /dev/null @@ -1,235 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2004 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 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_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: Wez Furlong | - +----------------------------------------------------------------------+ - */ -/* $Id$ */ - -#include -#include "zend.h" -#include - -/* Definitions for thread messages */ -enum { - PHPSE_STATE_CHANGE = WM_USER + 20, - PHPSE_INIT_NEW, - PHPSE_PARSE_SCRIPT, - PHPSE_ADD_SCRIPTLET, - PHPSE_CLOSE, - PHPSE_CLONE, - PHPSE_ENTER, - PHPSE_LEAVE, - PHPSE_TERMINATE, - PHPSE_PARSE_PROC, - PHPSE_EXEC_PROC, - PHPSE_ADD_NAMED_ITEM, - PHPSE_SET_SITE, - PHPSE_ADD_TYPELIB, - PHPSE_TRIGGER_ERROR, - PHPSE_GET_DISPATCH, - PHPSE_DUMMY_TICK, -}; - -struct php_active_script_get_dispatch_info { - LPCOLESTR pstrItemName; - DWORD dispatch; -}; - -struct php_active_script_add_named_item_info { - LPCOLESTR pstrName; - DWORD dwFlags; - IUnknown *punk; - ITypeInfo *ptyp; - IDispatch *pdisp; - DWORD marshal; -}; - -struct php_active_script_add_scriptlet_info { - /* [in] */ LPCOLESTR pstrDefaultName; - /* [in] */ LPCOLESTR pstrCode; - /* [in] */ LPCOLESTR pstrItemName; - /* [in] */ LPCOLESTR pstrSubItemName; - /* [in] */ LPCOLESTR pstrEventName; - /* [in] */ LPCOLESTR pstrDelimiter; - /* [in] */ DWORD dwSourceContextCookie; - /* [in] */ ULONG ulStartingLineNumber; - /* [in] */ DWORD dwFlags; - /* [out] */ BSTR *pbstrName; - /* [out] */ EXCEPINFO *pexcepinfo; -}; - -struct php_active_script_parse_info { - /* [in] */ LPCOLESTR pstrCode; - /* [in] */ LPCOLESTR pstrItemName; - /* [in] */ IUnknown *punkContext; - /* [in] */ LPCOLESTR pstrDelimiter; - /* [in] */ DWORD dwSourceContextCookie; - /* [in] */ ULONG ulStartingLineNumber; - /* [in] */ DWORD dwFlags; - /* [out] */ VARIANT *pvarResult; - /* [out] */ EXCEPINFO *pexcepinfo; -}; - -struct php_active_script_parse_proc_info { - /* [in] */ LPCOLESTR pstrCode; - /* [in] */ LPCOLESTR pstrFormalParams; - /* [in] */ LPCOLESTR pstrProcedureName; - /* [in] */ LPCOLESTR pstrItemName; - /* [in] */ IUnknown *punkContext; - /* [in] */ LPCOLESTR pstrDelimiter; - /* [in] */ DWORD dwSourceContextCookie; - /* [in] */ ULONG ulStartingLineNumber; - /* [in] */ DWORD dwFlags; - DWORD dispcookie; -}; - -struct php_active_script_add_tlb_info { - /* [in] */ const GUID * rguidTypeLib; - /* [in] */ DWORD dwMajor; - /* [in] */ DWORD dwMinor; - /* [in] */ DWORD dwFlags; -}; - -class TPHPScriptingEngine: - public IActiveScript, - public IActiveScriptParse, - public IActiveScriptParseProcedure -{ -public: - volatile LONG m_refcount; - IActiveScriptSite *m_pass; - SCRIPTSTATE m_scriptstate; - MUTEX_T m_mutex; - HashTable m_script_dispatchers; - HANDLE m_engine_thread_handle; - - HANDLE m_sync_thread_msg; - HRESULT m_sync_thread_ret; - - /* This is hacky, but only used when the host queries us for a script dispatch */ - void *** m_tsrm_hack; - - void add_to_global_namespace(IDispatch *disp, DWORD flags, char *name TSRMLS_DC); - - THREAD_T m_enginethread, m_basethread; - HashTable m_frags; - ULONG m_lambda_count; - IActiveScriptSite *m_pass_eng; - - jmp_buf *m_err_trap; - int m_in_main, m_stop_main; - - HRESULT SendThreadMessage(LONG msg, WPARAM wparam, LPARAM lparam); - - void engine_thread_func(void); - HRESULT engine_thread_handler(LONG msg, WPARAM wParam, LPARAM lParam, int *handled TSRMLS_DC); - -public: /* IUnknown */ - STDMETHODIMP QueryInterface(REFIID iid, void **ppvObject); - STDMETHODIMP_(DWORD) AddRef(void); - STDMETHODIMP_(DWORD) Release(void); -public: /* IActiveScript */ - STDMETHODIMP SetScriptSite( - /* [in] */ IActiveScriptSite *pass); - - STDMETHODIMP GetScriptSite( - /* [in] */ REFIID riid, - /* [iid_is][out] */ void **ppvObject); - - STDMETHODIMP SetScriptState( - /* [in] */ SCRIPTSTATE ss); - - STDMETHODIMP GetScriptState( - /* [out] */ SCRIPTSTATE *pssState); - - STDMETHODIMP Close( void); - - STDMETHODIMP AddNamedItem( - /* [in] */ LPCOLESTR pstrName, - /* [in] */ DWORD dwFlags); - - STDMETHODIMP AddTypeLib( - /* [in] */ REFGUID rguidTypeLib, - /* [in] */ DWORD dwMajor, - /* [in] */ DWORD dwMinor, - /* [in] */ DWORD dwFlags); - - STDMETHODIMP GetScriptDispatch( - /* [in] */ LPCOLESTR pstrItemName, - /* [out] */ IDispatch **ppdisp); - - STDMETHODIMP GetCurrentScriptThreadID( - /* [out] */ SCRIPTTHREADID *pstidThread); - - STDMETHODIMP GetScriptThreadID( - /* [in] */ DWORD dwWin32ThreadId, - /* [out] */ SCRIPTTHREADID *pstidThread); - - STDMETHODIMP GetScriptThreadState( - /* [in] */ SCRIPTTHREADID stidThread, - /* [out] */ SCRIPTTHREADSTATE *pstsState); - - STDMETHODIMP InterruptScriptThread( - /* [in] */ SCRIPTTHREADID stidThread, - /* [in] */ const EXCEPINFO *pexcepinfo, - /* [in] */ DWORD dwFlags); - - STDMETHODIMP Clone( - /* [out] */ IActiveScript **ppscript); - -public: /* IActiveScriptParse */ - STDMETHODIMP InitNew( void); - - STDMETHODIMP AddScriptlet( - /* [in] */ LPCOLESTR pstrDefaultName, - /* [in] */ LPCOLESTR pstrCode, - /* [in] */ LPCOLESTR pstrItemName, - /* [in] */ LPCOLESTR pstrSubItemName, - /* [in] */ LPCOLESTR pstrEventName, - /* [in] */ LPCOLESTR pstrDelimiter, - /* [in] */ DWORD dwSourceContextCookie, - /* [in] */ ULONG ulStartingLineNumber, - /* [in] */ DWORD dwFlags, - /* [out] */ BSTR *pbstrName, - /* [out] */ EXCEPINFO *pexcepinfo); - - STDMETHODIMP ParseScriptText( - /* [in] */ LPCOLESTR pstrCode, - /* [in] */ LPCOLESTR pstrItemName, - /* [in] */ IUnknown *punkContext, - /* [in] */ LPCOLESTR pstrDelimiter, - /* [in] */ DWORD dwSourceContextCookie, - /* [in] */ ULONG ulStartingLineNumber, - /* [in] */ DWORD dwFlags, - /* [out] */ VARIANT *pvarResult, - /* [out] */ EXCEPINFO *pexcepinfo); -public: /* IActiveScriptParseProcedure */ - STDMETHODIMP ParseProcedureText( - /* [in] */ LPCOLESTR pstrCode, - /* [in] */ LPCOLESTR pstrFormalParams, - /* [in] */ LPCOLESTR pstrProcedureName, - /* [in] */ LPCOLESTR pstrItemName, - /* [in] */ IUnknown *punkContext, - /* [in] */ LPCOLESTR pstrDelimiter, - /* [in] */ DWORD dwSourceContextCookie, - /* [in] */ ULONG ulStartingLineNumber, - /* [in] */ DWORD dwFlags, - /* [out] */ IDispatch **ppdisp); -public: - TPHPScriptingEngine(); - ~TPHPScriptingEngine(); - -}; - diff --git a/sapi/activescript/php5activescript.c b/sapi/activescript/php5activescript.c new file mode 100644 index 0000000000..6aa4b41495 --- /dev/null +++ b/sapi/activescript/php5activescript.c @@ -0,0 +1,152 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2004 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.0 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_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: Wez Furlong | + +----------------------------------------------------------------------+ + */ +/* $Id$ */ + +#include "php.h" +#include "php_main.h" +#include "SAPI.h" +#include "php_globals.h" +#include "ext/standard/info.h" +#include "php_variables.h" +#include "php_ini.h" +#include "php5activescript.h" + +/* SAPI definitions and DllMain */ + +static int php_activescript_startup(sapi_module_struct *sapi_module) +{ + if (php_module_startup(sapi_module, &php_activescript_module, 1) == FAILURE) { + return FAILURE; + } else { + return SUCCESS; + } +} + +static int sapi_activescript_ub_write(const char *str, uint str_length TSRMLS_DC) +{ + /* In theory, this is a blackhole. In practice, I want to see the output + * in the debugger! */ + + char buf[1024]; + uint l, a = str_length; + + while(a) { + l = a; + if (l > sizeof(buf) - 1) + l = sizeof(buf) - 1; + memcpy(buf, str, l); + buf[l] = 0; + OutputDebugString(buf); + a -= l; + } + + return str_length; +} + +static void sapi_activescript_register_server_variables(zval *track_vars_array TSRMLS_DC) +{ +} + +static char *sapi_activescript_read_cookies(TSRMLS_D) +{ + return NULL; +} + +static int sapi_activescript_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC) +{ + return SAPI_HEADER_ADD; +} + +static int sapi_activescript_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) +{ + return SAPI_HEADER_SENT_SUCCESSFULLY; +} + +zend_module_entry php_activescript_module = { + STANDARD_MODULE_HEADER, + "ActiveScript", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + STANDARD_MODULE_PROPERTIES +}; + + +sapi_module_struct activescript_sapi_module = { + "activescript", /* name */ + "Active Script", /* pretty name */ + + php_activescript_startup, /* startup */ + php_module_shutdown_wrapper, /* shutdown */ + + NULL, /* activate */ + NULL, /* deactivate */ + + sapi_activescript_ub_write, /* unbuffered write */ + NULL, /* flush */ + NULL, /* get uid */ + NULL, /* getenv */ + + zend_error, /* error handler */ + + sapi_activescript_header_handler, /* header handler */ + sapi_activescript_send_headers, /* send headers handler */ + NULL, /* send header handler */ + + NULL, /* read POST data */ + sapi_activescript_read_cookies, /* read Cookies */ + + sapi_activescript_register_server_variables, /* register server variables */ + NULL, /* Log message */ + + STANDARD_SAPI_MODULE_PROPERTIES +}; + +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + switch (fdwReason) { + case DLL_PROCESS_ATTACH: + module_handle = hinstDLL; + + tsrm_startup(128, 1, TSRM_ERROR_LEVEL_CORE, "C:\\TSRM.log"); + + sapi_startup(&activescript_sapi_module); + if (activescript_sapi_module.startup) { + activescript_sapi_module.startup(&sapi_module); + } + break; + case DLL_THREAD_ATTACH: + break; + case DLL_THREAD_DETACH: + ts_free_thread(); + break; + case DLL_PROCESS_DETACH: + if (activescript_sapi_module.shutdown) { + activescript_sapi_module.shutdown(&sapi_module); + } + tsrm_shutdown(); + break; + } + return TRUE; +} + + diff --git a/sapi/activescript/php5activescript.def b/sapi/activescript/php5activescript.def new file mode 100644 index 0000000000..f111b68db7 --- /dev/null +++ b/sapi/activescript/php5activescript.def @@ -0,0 +1,5 @@ +EXPORTS +DllCanUnloadNow PRIVATE +DllGetClassObject PRIVATE +DllRegisterServer PRIVATE +DllUnregisterServer PRIVATE diff --git a/sapi/activescript/php5activescript.dsp b/sapi/activescript/php5activescript.dsp new file mode 100644 index 0000000000..51438287ff --- /dev/null +++ b/sapi/activescript/php5activescript.dsp @@ -0,0 +1,185 @@ +# Microsoft Developer Studio Project File - Name="php5activescript" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=php5activescript - 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 "php5activescript.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 "php5activescript.mak" CFG="php5activescript - Win32 Debug_TS" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "php5activescript - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "php5activescript - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "php5activescript - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "php5activescript - Win32 Release_TSDbg" (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)" == "php5activescript - 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 "PHP5ISAPI_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /Ze /W3 /Gm /GX /ZI /Od /Ob0 /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "_DEBUG" /D "COMPILE_LIBZEND" /D ZEND_DEBUG=1 /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /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 wsock32.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 php5ts_debug.lib /nologo /version:4.0 /dll /debug /machine:I386 /nodefaultlib:"libcmt" /pdbtype:sept /libpath:"..\..\Debug_TS" + +!ELSEIF "$(CFG)" == "php5activescript - 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 "PHP5ISAPI_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /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 php5ts.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS" + +!ELSEIF "$(CFG)" == "php5activescript - Win32 Release_TS_inline" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "php5activescript___Win32_Release_TS_inline" +# PROP BASE Intermediate_Dir "php5activescript___Win32_Release_TS_inline" +# PROP BASE Ignore_Export_Lib 0 +# 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 /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /FR /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /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 wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386 /libpath:"..\..\Release_TS" +# 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 php5ts.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS_inline" + +!ELSEIF "$(CFG)" == "php5activescript - Win32 Release_TSDbg" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "php5activescript___Win32_Release_TSDbg" +# PROP BASE Intermediate_Dir "php5activescript___Win32_Release_TSDbg" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\..\Release_TSDbg" +# PROP Intermediate_Dir "Release_TSDbg" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /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 wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS" +# 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 php5ts.lib /nologo /version:4.0 /dll /debug /machine:I386 /libpath:"..\..\Release_TSDbg" + +!ENDIF + +# Begin Target + +# Name "php5activescript - Win32 Debug_TS" +# Name "php5activescript - Win32 Release_TS" +# Name "php5activescript - Win32 Release_TS_inline" +# Name "php5activescript - Win32 Release_TSDbg" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\classfactory.cpp +# End Source File +# Begin Source File + +SOURCE=.\php5activescript.c +# End Source File +# Begin Source File + +SOURCE=.\php5activescript.def +# End Source File +# Begin Source File + +SOURCE=.\scriptengine.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\php5activescript.h +# End Source File +# Begin Source File + +SOURCE=.\php5as_classfactory.h +# End Source File +# Begin Source File + +SOURCE=.\php5as_scriptengine.h +# End Source File +# End Group +# End Target +# End Project diff --git a/sapi/activescript/php5activescript.h b/sapi/activescript/php5activescript.h new file mode 100644 index 0000000000..ba8be9b51e --- /dev/null +++ b/sapi/activescript/php5activescript.h @@ -0,0 +1,25 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2004 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.0 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_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: Wez Furlong | + +----------------------------------------------------------------------+ + */ +/* $Id$ */ + +extern zend_module_entry php_activescript_module; +extern sapi_module_struct activescript_sapi_module; +extern HINSTANCE module_handle; +extern void activescript_error_func(int type, const char *error_msg, ...); +extern void activescript_error_handler(int type, const char *error_filename, + const uint error_lineno, const char *format, va_list args); diff --git a/sapi/activescript/php5as_classfactory.h b/sapi/activescript/php5as_classfactory.h new file mode 100644 index 0000000000..2f1695fa0c --- /dev/null +++ b/sapi/activescript/php5as_classfactory.h @@ -0,0 +1,52 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2004 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.0 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_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: Wez Furlong | + +----------------------------------------------------------------------+ + */ +/* $Id$ */ + +/* IClassFactory Implementation */ + +#include + +// {A0AD8E7A-95EC-4819-986F-78D93895F2AE} +DEFINE_GUID(CLSID_PHPActiveScriptEngine, +0xa0ad8e7a, 0x95ec, 0x4819, 0x98, 0x6f, 0x78, 0xd9, 0x38, 0x95, 0xf2, 0xae); + +class TPHPClassFactory: + public IClassFactory +{ +protected: + volatile LONG m_refcount; + + static volatile LONG factory_count; + static volatile LONG object_count; + +public: /* IUnknown */ + STDMETHODIMP QueryInterface(REFIID iid, void **ppvObject); + STDMETHODIMP_(DWORD) AddRef(void); + STDMETHODIMP_(DWORD) Release(void); +public: /* IClassFactory */ + STDMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppvObject); + STDMETHODIMP LockServer(BOOL fLock); + + TPHPClassFactory(); + ~TPHPClassFactory(); + + static void AddToObjectCount(void); + static void RemoveFromObjectCount(void); + static int CanUnload(void); +}; + diff --git a/sapi/activescript/php5as_scriptengine.h b/sapi/activescript/php5as_scriptengine.h new file mode 100644 index 0000000000..fd5fd522a8 --- /dev/null +++ b/sapi/activescript/php5as_scriptengine.h @@ -0,0 +1,235 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2004 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.0 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_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: Wez Furlong | + +----------------------------------------------------------------------+ + */ +/* $Id$ */ + +#include +#include "zend.h" +#include + +/* Definitions for thread messages */ +enum { + PHPSE_STATE_CHANGE = WM_USER + 20, + PHPSE_INIT_NEW, + PHPSE_PARSE_SCRIPT, + PHPSE_ADD_SCRIPTLET, + PHPSE_CLOSE, + PHPSE_CLONE, + PHPSE_ENTER, + PHPSE_LEAVE, + PHPSE_TERMINATE, + PHPSE_PARSE_PROC, + PHPSE_EXEC_PROC, + PHPSE_ADD_NAMED_ITEM, + PHPSE_SET_SITE, + PHPSE_ADD_TYPELIB, + PHPSE_TRIGGER_ERROR, + PHPSE_GET_DISPATCH, + PHPSE_DUMMY_TICK, +}; + +struct php_active_script_get_dispatch_info { + LPCOLESTR pstrItemName; + DWORD dispatch; +}; + +struct php_active_script_add_named_item_info { + LPCOLESTR pstrName; + DWORD dwFlags; + IUnknown *punk; + ITypeInfo *ptyp; + IDispatch *pdisp; + DWORD marshal; +}; + +struct php_active_script_add_scriptlet_info { + /* [in] */ LPCOLESTR pstrDefaultName; + /* [in] */ LPCOLESTR pstrCode; + /* [in] */ LPCOLESTR pstrItemName; + /* [in] */ LPCOLESTR pstrSubItemName; + /* [in] */ LPCOLESTR pstrEventName; + /* [in] */ LPCOLESTR pstrDelimiter; + /* [in] */ DWORD dwSourceContextCookie; + /* [in] */ ULONG ulStartingLineNumber; + /* [in] */ DWORD dwFlags; + /* [out] */ BSTR *pbstrName; + /* [out] */ EXCEPINFO *pexcepinfo; +}; + +struct php_active_script_parse_info { + /* [in] */ LPCOLESTR pstrCode; + /* [in] */ LPCOLESTR pstrItemName; + /* [in] */ IUnknown *punkContext; + /* [in] */ LPCOLESTR pstrDelimiter; + /* [in] */ DWORD dwSourceContextCookie; + /* [in] */ ULONG ulStartingLineNumber; + /* [in] */ DWORD dwFlags; + /* [out] */ VARIANT *pvarResult; + /* [out] */ EXCEPINFO *pexcepinfo; +}; + +struct php_active_script_parse_proc_info { + /* [in] */ LPCOLESTR pstrCode; + /* [in] */ LPCOLESTR pstrFormalParams; + /* [in] */ LPCOLESTR pstrProcedureName; + /* [in] */ LPCOLESTR pstrItemName; + /* [in] */ IUnknown *punkContext; + /* [in] */ LPCOLESTR pstrDelimiter; + /* [in] */ DWORD dwSourceContextCookie; + /* [in] */ ULONG ulStartingLineNumber; + /* [in] */ DWORD dwFlags; + DWORD dispcookie; +}; + +struct php_active_script_add_tlb_info { + /* [in] */ const GUID * rguidTypeLib; + /* [in] */ DWORD dwMajor; + /* [in] */ DWORD dwMinor; + /* [in] */ DWORD dwFlags; +}; + +class TPHPScriptingEngine: + public IActiveScript, + public IActiveScriptParse, + public IActiveScriptParseProcedure +{ +public: + volatile LONG m_refcount; + IActiveScriptSite *m_pass; + SCRIPTSTATE m_scriptstate; + MUTEX_T m_mutex; + HashTable m_script_dispatchers; + HANDLE m_engine_thread_handle; + + HANDLE m_sync_thread_msg; + HRESULT m_sync_thread_ret; + + /* This is hacky, but only used when the host queries us for a script dispatch */ + void *** m_tsrm_hack; + + void add_to_global_namespace(IDispatch *disp, DWORD flags, char *name TSRMLS_DC); + + THREAD_T m_enginethread, m_basethread; + HashTable m_frags; + ULONG m_lambda_count; + IActiveScriptSite *m_pass_eng; + + jmp_buf *m_err_trap; + int m_in_main, m_stop_main; + + HRESULT SendThreadMessage(LONG msg, WPARAM wparam, LPARAM lparam); + + void engine_thread_func(void); + HRESULT engine_thread_handler(LONG msg, WPARAM wParam, LPARAM lParam, int *handled TSRMLS_DC); + +public: /* IUnknown */ + STDMETHODIMP QueryInterface(REFIID iid, void **ppvObject); + STDMETHODIMP_(DWORD) AddRef(void); + STDMETHODIMP_(DWORD) Release(void); +public: /* IActiveScript */ + STDMETHODIMP SetScriptSite( + /* [in] */ IActiveScriptSite *pass); + + STDMETHODIMP GetScriptSite( + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + STDMETHODIMP SetScriptState( + /* [in] */ SCRIPTSTATE ss); + + STDMETHODIMP GetScriptState( + /* [out] */ SCRIPTSTATE *pssState); + + STDMETHODIMP Close( void); + + STDMETHODIMP AddNamedItem( + /* [in] */ LPCOLESTR pstrName, + /* [in] */ DWORD dwFlags); + + STDMETHODIMP AddTypeLib( + /* [in] */ REFGUID rguidTypeLib, + /* [in] */ DWORD dwMajor, + /* [in] */ DWORD dwMinor, + /* [in] */ DWORD dwFlags); + + STDMETHODIMP GetScriptDispatch( + /* [in] */ LPCOLESTR pstrItemName, + /* [out] */ IDispatch **ppdisp); + + STDMETHODIMP GetCurrentScriptThreadID( + /* [out] */ SCRIPTTHREADID *pstidThread); + + STDMETHODIMP GetScriptThreadID( + /* [in] */ DWORD dwWin32ThreadId, + /* [out] */ SCRIPTTHREADID *pstidThread); + + STDMETHODIMP GetScriptThreadState( + /* [in] */ SCRIPTTHREADID stidThread, + /* [out] */ SCRIPTTHREADSTATE *pstsState); + + STDMETHODIMP InterruptScriptThread( + /* [in] */ SCRIPTTHREADID stidThread, + /* [in] */ const EXCEPINFO *pexcepinfo, + /* [in] */ DWORD dwFlags); + + STDMETHODIMP Clone( + /* [out] */ IActiveScript **ppscript); + +public: /* IActiveScriptParse */ + STDMETHODIMP InitNew( void); + + STDMETHODIMP AddScriptlet( + /* [in] */ LPCOLESTR pstrDefaultName, + /* [in] */ LPCOLESTR pstrCode, + /* [in] */ LPCOLESTR pstrItemName, + /* [in] */ LPCOLESTR pstrSubItemName, + /* [in] */ LPCOLESTR pstrEventName, + /* [in] */ LPCOLESTR pstrDelimiter, + /* [in] */ DWORD dwSourceContextCookie, + /* [in] */ ULONG ulStartingLineNumber, + /* [in] */ DWORD dwFlags, + /* [out] */ BSTR *pbstrName, + /* [out] */ EXCEPINFO *pexcepinfo); + + STDMETHODIMP ParseScriptText( + /* [in] */ LPCOLESTR pstrCode, + /* [in] */ LPCOLESTR pstrItemName, + /* [in] */ IUnknown *punkContext, + /* [in] */ LPCOLESTR pstrDelimiter, + /* [in] */ DWORD dwSourceContextCookie, + /* [in] */ ULONG ulStartingLineNumber, + /* [in] */ DWORD dwFlags, + /* [out] */ VARIANT *pvarResult, + /* [out] */ EXCEPINFO *pexcepinfo); +public: /* IActiveScriptParseProcedure */ + STDMETHODIMP ParseProcedureText( + /* [in] */ LPCOLESTR pstrCode, + /* [in] */ LPCOLESTR pstrFormalParams, + /* [in] */ LPCOLESTR pstrProcedureName, + /* [in] */ LPCOLESTR pstrItemName, + /* [in] */ IUnknown *punkContext, + /* [in] */ LPCOLESTR pstrDelimiter, + /* [in] */ DWORD dwSourceContextCookie, + /* [in] */ ULONG ulStartingLineNumber, + /* [in] */ DWORD dwFlags, + /* [out] */ IDispatch **ppdisp); +public: + TPHPScriptingEngine(); + ~TPHPScriptingEngine(); + +}; + diff --git a/sapi/activescript/scriptengine.cpp b/sapi/activescript/scriptengine.cpp index bf6de9329d..7853af1637 100644 --- a/sapi/activescript/scriptengine.cpp +++ b/sapi/activescript/scriptengine.cpp @@ -42,13 +42,13 @@ extern "C" { #include "php_globals.h" #include "php_variables.h" #include "php_ini.h" -#include "php4activescript.h" +#include "php5activescript.h" #include "ext/com_dotnet/php_com_dotnet.h" #include "ext/com_dotnet/php_com_dotnet_internal.h" } #include "php_ticks.h" -#include "php4as_scriptengine.h" -#include "php4as_classfactory.h" +#include "php5as_scriptengine.h" +#include "php5as_classfactory.h" #include /* {{{ trace */ diff --git a/sapi/aolserver/README b/sapi/aolserver/README index 0a725a10bc..80c186ea5d 100644 --- a/sapi/aolserver/README +++ b/sapi/aolserver/README @@ -60,7 +60,7 @@ Then enable the PHP module: ns_section "ns/server/${servername}/modules" ... -ns_param php ${bindir}/libphp4.so +ns_param php ${bindir}/libphp5.so ============================================================================= diff --git a/sapi/aolserver/php4aolserver.dsp b/sapi/aolserver/php4aolserver.dsp deleted file mode 100644 index 1d5a79598c..0000000000 --- a/sapi/aolserver/php4aolserver.dsp +++ /dev/null @@ -1,135 +0,0 @@ -# Microsoft Developer Studio Project File - Name="php4aolserver" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=php4aolserver - 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 "php4aolserver.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 "php4aolserver.mak" CFG="php4aolserver - Win32 Debug_TS" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "php4aolserver - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "php4aolserver - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "php4aolserver - 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)" == "php4aolserver - 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 "PHP4AOLSERVER_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 "PHP4AOLSERVER_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 php4ts.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/php4aolserver.so" /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Release_TS" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\Zend\Release_TS" - -!ELSEIF "$(CFG)" == "php4aolserver - 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 "PHP4AOLSERVER_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 php4ts.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/php4aolserver.so" /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Release_TS_inline" /libpath:"..\..\TSRM\Release_TS_inline" /libpath:"..\..\Zend\Release_TS_inline" - -!ELSEIF "$(CFG)" == "php4aolserver - 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 "PHP4AOLSERVER_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 "PHP4AOLSERVER_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 php4ts_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/php4aolserver.so" /pdbtype:sept /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Debug_TS" /libpath:"..\..\TSRM\Debug_TS" /libpath:"..\..\Zend\Debug_TS" - -!ENDIF - -# Begin Target - -# Name "php4aolserver - Win32 Release_TS" -# Name "php4aolserver - Win32 Release_TS_inline" -# Name "php4aolserver - 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 diff --git a/sapi/aolserver/php5aolserver.dsp b/sapi/aolserver/php5aolserver.dsp new file mode 100644 index 0000000000..dd6ad71c53 --- /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 diff --git a/sapi/apache/config.w32 b/sapi/apache/config.w32 index 1dde452f7d..83ceb1a4db 100644 --- a/sapi/apache/config.w32 +++ b/sapi/apache/config.w32 @@ -17,7 +17,7 @@ if (PHP_APACHE != "no") { // headers SAPI('apache', 'mod_php5.c sapi_apache.c php_apache.c', 'php' + PHP_VERSION + 'apache.dll', - '/D APACHEPHP4_EXPORTS /D APACHE_READDIR_H /I win32'); + '/D APACHEPHP5_EXPORTS /D APACHE_READDIR_H /I win32'); } else { WARNING("Could not find apache libraries/headers"); } diff --git a/sapi/apache/php4apache.dsp b/sapi/apache/php4apache.dsp deleted file mode 100644 index b6e20851b1..0000000000 --- a/sapi/apache/php4apache.dsp +++ /dev/null @@ -1,151 +0,0 @@ -# Microsoft Developer Studio Project File - Name="php4apache" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=php4apache - Win32 Release_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 "php4apache.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 "php4apache.mak" CFG="php4apache - Win32 Release_TS" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "php4apache - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "php4apache - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "php4apache - Win32 Release_TS_inline" (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)" == "php4apache - 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 "APACHEPHP4_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\includes" /I "..\..\main" /I "..\..\TSRM" /I "..\..\regex" /I "C:\Program Files\Apache Group\Apache\include" /D ZEND_DEBUG=0 /D "NDEBUG" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP4_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /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 php4ts.lib ApacheCore.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:"0x60000000" /version:4.0 /dll /machine:I386 /libpath:"..\..\..\php_build\release" /libpath:"..\..\Release_TS" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\Zend\Release_TS" /libpath:"C:\Program Files\Apache Group\Apache\libexec" - -!ELSEIF "$(CFG)" == "php4apache - Win32 Debug_TS" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Debug_TS" -# PROP BASE Intermediate_Dir "Debug_TS" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\Debug_TS" -# PROP Intermediate_Dir "Debug_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 "APACHEPHP4_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\includes" /I "..\..\main" /I "..\..\TSRM" /I "..\..\regex" /I "C:\Program Files\Apache Group\Apache\include" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP4_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /FR /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 php4ts_debug.lib ApacheCore.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:"0x60000000" /version:4.0 /dll /incremental:yes /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\php_build\release" /libpath:"..\..\Debug_TS" /libpath:"..\..\TSRM\Debug_TS" /libpath:"..\..\Zend\Debug_TS" /libpath:"C:\Program Files\Apache Group\Apache\libexec" - -!ELSEIF "$(CFG)" == "php4apache - 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 "APACHEPHP4_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\includes" /I "..\..\main" /I "..\..\TSRM" /I "..\..\regex" /I "C:\Program Files\Apache Group\Apache\include" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "NDEBUG" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP4_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /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 php4ts.lib ApacheCore.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 /version:4.0 /dll /machine:I386 /libpath:"..\..\..\php_build\release" /libpath:"..\..\Release_TS_inline" /libpath:"..\..\TSRM\Release_TS_inline" /libpath:"..\..\Zend\Release_TS_inline" /libpath:"C:\Program Files\Apache Group\Apache\libexec" - -!ENDIF - -# Begin Target - -# Name "php4apache - Win32 Release_TS" -# Name "php4apache - Win32 Debug_TS" -# Name "php4apache - Win32 Release_TS_inline" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\mod_php5.c -# End Source File -# Begin Source File - -SOURCE=.\php_apache.c -# End Source File -# Begin Source File - -SOURCE=.\sapi_apache.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\mod_php5.h -# End Source File -# Begin Source File - -SOURCE=.\php_apache_http.h -# End Source File -# 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 diff --git a/sapi/apache/php5apache.dsp b/sapi/apache/php5apache.dsp new file mode 100644 index 0000000000..fbdb7612b8 --- /dev/null +++ b/sapi/apache/php5apache.dsp @@ -0,0 +1,151 @@ +# Microsoft Developer Studio Project File - Name="php5apache" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=php5apache - Win32 Release_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 "php5apache.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 "php5apache.mak" CFG="php5apache - Win32 Release_TS" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "php5apache - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "php5apache - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "php5apache - Win32 Release_TS_inline" (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)" == "php5apache - 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 "APACHEPHP5_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\includes" /I "..\..\main" /I "..\..\TSRM" /I "..\..\regex" /I "C:\Program Files\Apache Group\Apache\include" /D ZEND_DEBUG=0 /D "NDEBUG" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP5_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /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 php5ts.lib ApacheCore.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:"0x60000000" /version:4.0 /dll /machine:I386 /libpath:"..\..\..\php_build\release" /libpath:"..\..\Release_TS" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\Zend\Release_TS" /libpath:"C:\Program Files\Apache Group\Apache\libexec" + +!ELSEIF "$(CFG)" == "php5apache - Win32 Debug_TS" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Debug_TS" +# PROP BASE Intermediate_Dir "Debug_TS" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\..\Debug_TS" +# PROP Intermediate_Dir "Debug_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 "APACHEPHP5_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\includes" /I "..\..\main" /I "..\..\TSRM" /I "..\..\regex" /I "C:\Program Files\Apache Group\Apache\include" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP5_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /FR /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 php5ts_debug.lib ApacheCore.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:"0x60000000" /version:4.0 /dll /incremental:yes /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\php_build\release" /libpath:"..\..\Debug_TS" /libpath:"..\..\TSRM\Debug_TS" /libpath:"..\..\Zend\Debug_TS" /libpath:"C:\Program Files\Apache Group\Apache\libexec" + +!ELSEIF "$(CFG)" == "php5apache - 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 "APACHEPHP5_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\includes" /I "..\..\main" /I "..\..\TSRM" /I "..\..\regex" /I "C:\Program Files\Apache Group\Apache\include" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "NDEBUG" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP5_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /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 php5ts.lib ApacheCore.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 /version:4.0 /dll /machine:I386 /libpath:"..\..\..\php_build\release" /libpath:"..\..\Release_TS_inline" /libpath:"..\..\TSRM\Release_TS_inline" /libpath:"..\..\Zend\Release_TS_inline" /libpath:"C:\Program Files\Apache Group\Apache\libexec" + +!ENDIF + +# Begin Target + +# Name "php5apache - Win32 Release_TS" +# Name "php5apache - Win32 Debug_TS" +# Name "php5apache - Win32 Release_TS_inline" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\mod_php5.c +# End Source File +# Begin Source File + +SOURCE=.\php_apache.c +# End Source File +# Begin Source File + +SOURCE=.\sapi_apache.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\mod_php5.h +# End Source File +# Begin Source File + +SOURCE=.\php_apache_http.h +# End Source File +# 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 diff --git a/sapi/apache2handler/php4apache2.dsp b/sapi/apache2handler/php4apache2.dsp deleted file mode 100644 index c20655a454..0000000000 --- a/sapi/apache2handler/php4apache2.dsp +++ /dev/null @@ -1,146 +0,0 @@ -# Microsoft Developer Studio Project File - Name="php4apache2" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=php4apache2 - 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 "php4apache2.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 "php4apache2.mak" CFG="php4apache2 - Win32 Debug_TS" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "php4apache2 - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "php4apache2 - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "php4apache2 - 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)" == "php4apache2 - 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 "PHP_APACHE2_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "NDEBUG" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WIN32" /D "_MBCS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x407 /d "NDEBUG" -# ADD RSC /l 0x407 /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 libhttpd.lib libapr.lib libaprutil.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 /libpath:"..\..\Release_TS" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\Zend\Release_TS" - -!ELSEIF "$(CFG)" == "php4apache2 - 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 "PHP_APACHE2_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /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 "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WIN32" /D "_MBCS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x407 /d "NDEBUG" -# ADD RSC /l 0x407 /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 libhttpd.lib libapr.lib libaprutil.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_inline/php4apache2.dll" /libpath:"..\..\Release_TS_inline" /libpath:"..\..\TSRM\Release_TS_inline" /libpath:"..\..\Zend\Release_TS_inline" - -!ELSEIF "$(CFG)" == "php4apache2 - 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 "PHP_APACHE2_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WIN32" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x407 /d "_DEBUG" -# ADD RSC /l 0x407 /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_debug.lib libhttpd.lib libapr.lib libaprutil.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 /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\TSRM\Debug_TS" /libpath:"..\..\Zend\Debug_TS" - -!ENDIF - -# Begin Target - -# Name "php4apache2 - Win32 Release_TS" -# Name "php4apache2 - Win32 Release_TS_inline" -# Name "php4apache2 - Win32 Debug_TS" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\apache_config.c -# End Source File -# Begin Source File - -SOURCE=.\mod_php5.c -# End Source File -# Begin Source File - -SOURCE=.\php_functions.c -# End Source File -# Begin Source File - -SOURCE=.\sapi_apache2.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\php_apache.h -# End Source File -# End Group -# End Target -# End Project diff --git a/sapi/apache2handler/php5apache2.dsp b/sapi/apache2handler/php5apache2.dsp new file mode 100644 index 0000000000..40cd58cb92 --- /dev/null +++ b/sapi/apache2handler/php5apache2.dsp @@ -0,0 +1,146 @@ +# Microsoft Developer Studio Project File - Name="php5apache2" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=php5apache2 - 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 "php5apache2.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 "php5apache2.mak" CFG="php5apache2 - Win32 Debug_TS" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "php5apache2 - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "php5apache2 - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "php5apache2 - 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)" == "php5apache2 - 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 "PHP_APACHE2_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "NDEBUG" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WIN32" /D "_MBCS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x407 /d "NDEBUG" +# ADD RSC /l 0x407 /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 php5ts.lib libhttpd.lib libapr.lib libaprutil.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 /libpath:"..\..\Release_TS" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\Zend\Release_TS" + +!ELSEIF "$(CFG)" == "php5apache2 - 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 "PHP_APACHE2_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /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 "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WIN32" /D "_MBCS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x407 /d "NDEBUG" +# ADD RSC /l 0x407 /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 php5ts.lib libhttpd.lib libapr.lib libaprutil.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_inline/php5apache2.dll" /libpath:"..\..\Release_TS_inline" /libpath:"..\..\TSRM\Release_TS_inline" /libpath:"..\..\Zend\Release_TS_inline" + +!ELSEIF "$(CFG)" == "php5apache2 - 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 "PHP_APACHE2_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WIN32" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x407 /d "_DEBUG" +# ADD RSC /l 0x407 /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 php5ts_debug.lib libhttpd.lib libapr.lib libaprutil.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 /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\TSRM\Debug_TS" /libpath:"..\..\Zend\Debug_TS" + +!ENDIF + +# Begin Target + +# Name "php5apache2 - Win32 Release_TS" +# Name "php5apache2 - Win32 Release_TS_inline" +# Name "php5apache2 - Win32 Debug_TS" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\apache_config.c +# End Source File +# Begin Source File + +SOURCE=.\mod_php5.c +# End Source File +# Begin Source File + +SOURCE=.\php_functions.c +# End Source File +# Begin Source File + +SOURCE=.\sapi_apache2.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\php_apache.h +# End Source File +# End Group +# End Target +# End Project diff --git a/sapi/apache_hooks/apMakefile.tmpl b/sapi/apache_hooks/apMakefile.tmpl index 80fe346561..4054e8e119 100644 --- a/sapi/apache_hooks/apMakefile.tmpl +++ b/sapi/apache_hooks/apMakefile.tmpl @@ -1,38 +1,38 @@ ## ## Apache 1.3 Makefile template for PHP 4.0 Module -## [src/modules/php4/Makefile.tmpl] +## [src/modules/php5/Makefile.tmpl] ## # the parametrized target -LIB=libphp4.$(LIBEXT) +LIB=libphp5.$(LIBEXT) # objects for building the static library -OBJS=mod_php4.o -OBJS_LIB=libmodphp4.a +OBJS=mod_php5.o +OBJS_LIB=libmodphp5.a # objects for building the shared object library -SHLIB_OBJS=mod_php4.so-o -SHLIB_OBJS_LIB=libmodphp4.a +SHLIB_OBJS=mod_php5.so-o +SHLIB_OBJS_LIB=libmodphp5.a # the general targets all: lib lib: $(LIB) # build the static library by merging the object files -libphp4.a: $(OBJS) $(OBJS_LIB) +libphp5.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) +libphp5.: $(OBJS) $(OBJS_LIB) cp $(OBJS_LIB) $@ ar r $@ $(OBJS) $(RANLIB) $@ - cp libphp4. libphp4.a + cp libphp5. libphp5.a # build the shared object library by linking the object files -libphp4.so: $(SHLIB_OBJS) $(SHLIB_OBJS_LIB) +libphp5.so: $(SHLIB_OBJS) $(SHLIB_OBJS_LIB) rm -f $@ $(LD_SHLIB) $(LDFLAGS_SHLIB) -o $@ $(SHLIB_OBJS) $(SHLIB_OBJS_LIB) $(LIBS) $(PHP_LIBS) @@ -69,9 +69,9 @@ depend: $(OBJS): Makefile # DO NOT REMOVE -mod_php4.o: mod_php4.c $(INCDIR)/httpd.h $(INCDIR)/conf.h \ +mod_php5.o: mod_php5.c $(INCDIR)/httpd.h $(INCDIR)/conf.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 + $(INCDIR)/http_log.h $(INCDIR)/util_script.h mod_php5.h diff --git a/sapi/apache_hooks/config.m4 b/sapi/apache_hooks/config.m4 index 558250b6a8..51702c5c2f 100644 --- a/sapi/apache_hooks/config.m4 +++ b/sapi/apache_hooks/config.m4 @@ -53,16 +53,16 @@ AC_ARG_WITH(apache-hooks, *aix*) APXS_LIBEXECDIR=`$APXS -q LIBEXECDIR` EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-bI:$APXS_LIBEXECDIR/httpd.exp" - PHP_SELECT_SAPI(apache_hooks, shared, sapi_apache.c mod_php4.c php_apache.c, -I$APXS_INCLUDEDIR) + PHP_SELECT_SAPI(apache_hooks, shared, sapi_apache.c mod_php5.c php_apache.c, -I$APXS_INCLUDEDIR) ;; *darwin*) MH_BUNDLE_FLAGS="-dynamic -twolevel_namespace -bundle -bundle_loader $APXS_HTTPD" PHP_SUBST(MH_BUNDLE_FLAGS) - SAPI_SHARED=libs/libphp4.so - PHP_SELECT_SAPI(apache_hooks, bundle, sapi_apache.c mod_php4.c php_apache.c, -I$APXS_INCLUDEDIR) + SAPI_SHARED=libs/libphp5.so + PHP_SELECT_SAPI(apache_hooks, bundle, sapi_apache.c mod_php5.c php_apache.c, -I$APXS_INCLUDEDIR) ;; *) - PHP_SELECT_SAPI(apache_hooks, shared, sapi_apache.c mod_php4.c php_apache.c, -I$APXS_INCLUDEDIR) + PHP_SELECT_SAPI(apache_hooks, shared, sapi_apache.c mod_php5.c php_apache.c, -I$APXS_INCLUDEDIR) ;; esac @@ -70,9 +70,9 @@ AC_ARG_WITH(apache-hooks, $APXS -q -S CFLAGS="$APXS_CFLAGS" CFLAGS >/dev/null 2>&1 if test "$?" != "0"; then - APACHE_INSTALL="$APXS -i -a -n php4 $SAPI_SHARED" # Old apxs does not have -S option + APACHE_INSTALL="$APXS -i -a -n php5 $SAPI_SHARED" # Old apxs does not have -S option else - APACHE_INSTALL="\$(mkinstalldirs) \"\$(INSTALL_ROOT)`$APXS -q LIBEXECDIR`\" && $APXS -S LIBEXECDIR=\"\$(INSTALL_ROOT)`$APXS -q LIBEXECDIR`\" -i -a -n php4 $SAPI_SHARED" + APACHE_INSTALL="\$(mkinstalldirs) \"\$(INSTALL_ROOT)`$APXS -q LIBEXECDIR`\" && $APXS -S LIBEXECDIR=\"\$(INSTALL_ROOT)`$APXS -q LIBEXECDIR`\" -i -a -n php5 $SAPI_SHARED" fi if test -z "`$APXS -q LD_SHLIB`" || test "`$APXS -q LIBEXECDIR`" = "modules"; then @@ -86,7 +86,7 @@ AC_ARG_WITH(apache-hooks, AC_MSG_RESULT(no) ]) -APACHE_INSTALL_FILES="\$(srcdir)/sapi/apache_hooks/mod_php4.* sapi/apache_hooks/libphp4.module" +APACHE_INSTALL_FILES="\$(srcdir)/sapi/apache_hooks/mod_php5.* sapi/apache_hooks/libphp5.module" if test "$PHP_SAPI" != "apache_hooks"; then AC_MSG_CHECKING(for Apache 1.x (hooks) module support) @@ -106,7 +106,7 @@ AC_ARG_WITH(apache-hooks-static, if test -f $withval/src/httpd.h; then APACHE_INCLUDE=-I$withval/src APACHE_TARGET=$withval/src - PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php4.c php_apache.c, $APACHE_INCLUDE) + PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE) APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_INSTALL_FILES $APACHE_TARGET" PHP_LIBS="-L. -lphp3" AC_MSG_RESULT(yes - Apache 1.2.x) @@ -122,13 +122,13 @@ AC_ARG_WITH(apache-hooks-static, 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 + APACHE_TARGET=$withval/src/modules/php5 if test ! -d $APACHE_TARGET; then mkdir $APACHE_TARGET fi - PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php4.c php_apache.c, $APACHE_INCLUDE) - APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp4.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache_hooks/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache_hooks/apMakefile.libdir $APACHE_TARGET/Makefile.libdir" - PHP_LIBS="-Lmodules/php4 -L../modules/php4 -L../../modules/php4 -lmodphp4" + PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE) + APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache_hooks/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache_hooks/apMakefile.libdir $APACHE_TARGET/Makefile.libdir" + PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5" AC_MSG_RESULT(yes - Apache 1.3.x) STRONGHOLD= if test -f $withval/src/include/ap_config.h; then @@ -148,13 +148,13 @@ AC_ARG_WITH(apache-hooks-static, 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 + APACHE_TARGET=$withval/src/modules/php5 if test ! -d $APACHE_TARGET; then mkdir $APACHE_TARGET fi - PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php4.c php_apache.c, $APACHE_INCLUDE) - 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_hooks/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache_hooks/apMakefile.libdir $APACHE_TARGET/Makefile.libdir" + PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE) + PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5" + APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache_hooks/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache_hooks/apMakefile.libdir $APACHE_TARGET/Makefile.libdir" AC_MSG_RESULT(yes - Apache 1.3.x) STRONGHOLD= if test -f $withval/src/include/ap_config.h; then @@ -174,9 +174,9 @@ AC_ARG_WITH(apache-hooks-static, elif test -f $withval/apache/httpd.h; then APACHE_INCLUDE=-"I$withval/apache -I$withval/ssl/include" APACHE_TARGET=$withval/apache - PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php4.c php_apache.c, $APACHE_INCLUDE) - 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" + PHP_SELECT_SAPI(apache_hooks, static, sapi_apache.c mod_php5.c php_apache.c, $APACHE_INCLUDE) + PHP_LIBS="-Lmodules/php5 -L../modules/php5 -L../../modules/php5 -lmodphp5" + APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp5.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET" STRONGHOLD=-DSTRONGHOLD=1 AC_MSG_RESULT(yes - StrongHold) if test -f $withval/apache/ap_config.h; then @@ -206,7 +206,7 @@ AC_ARG_WITH(apache-hooks-static, fi if test "x$APXS" != "x" -a "`uname -sv`" = "AIX 4" -a "$GCC" != "yes"; then - APXS_EXP=-bE:sapi/apache_hooks/mod_php4.exp + APXS_EXP=-bE:sapi/apache_hooks/mod_php5.exp fi PHP_SUBST(APXS_EXP) @@ -230,7 +230,7 @@ AC_ARG_WITH(mod_charset, if test -n "$APACHE_MODULE"; then PHP_TARGET_RDYNAMIC $php_shtool mkdir -p sapi/apache_hooks - PHP_OUTPUT(sapi/apache_hooks/libphp4.module) + PHP_OUTPUT(sapi/apache_hooks/libphp5.module) fi if test -n "$APACHE_INSTALL"; then diff --git a/sapi/apache_hooks/config.w32 b/sapi/apache_hooks/config.w32 index 66a5535271..9a4d12508c 100644 --- a/sapi/apache_hooks/config.w32 +++ b/sapi/apache_hooks/config.w32 @@ -12,9 +12,9 @@ if (PHP_APACHE_HOOKS != "no") { ';..\\php_build\\apache\\src\\corer')) { // We need to play tricks to get our readdir.h used by apache // headers - SAPI('apache_hooks', 'mod_php4.c sapi_apache.c php_apache.c', + SAPI('apache_hooks', 'mod_php5.c sapi_apache.c php_apache.c', 'php' + PHP_VERSION + 'apache_hooks.dll', - '/D APACHEPHP4_EXPORTS /D APACHE_READDIR_H /I win32'); + '/D APACHEPHP5_EXPORTS /D APACHE_READDIR_H /I win32'); } else { WARNING("Could not find apache libraries/headers"); } diff --git a/sapi/apache_hooks/libphp4.module.in b/sapi/apache_hooks/libphp4.module.in deleted file mode 100644 index ccb97493a7..0000000000 --- a/sapi/apache_hooks/libphp4.module.in +++ /dev/null @@ -1,11 +0,0 @@ -Name: php4_module -ConfigStart - RULE_WANTHSREGEX=no - RULE_HIDE=yes - PHP_LIBS="@NATIVE_RPATHS@ @PHP_LDFLAGS@ @PHP_LIBS@ @EXTRA_LIBS@ $LIBS" - PHP_CFLAGS="$CFLAGS @OPENSSL_INCDIR_OPT@ -I@php_abs_top_builddir@/main -I@php_abs_top_builddir@/Zend -I@php_abs_top_builddir@/TSRM -I@php_abs_top_srcdir@ -I@php_abs_top_srcdir@/sapi/apache -I@php_abs_top_srcdir@/main -I@php_abs_top_srcdir@/Zend -I@php_abs_top_srcdir@/TSRM" - my_outfile="Makefile.config" - echo "PHP_CFLAGS=$PHP_CFLAGS" >>$my_outfile - echo "PHP_LIBS=$PHP_LIBS" >>$my_outfile - LIBS=$PHP_LIBS -ConfigEnd diff --git a/sapi/apache_hooks/libphp5.module.in b/sapi/apache_hooks/libphp5.module.in new file mode 100644 index 0000000000..8488181897 --- /dev/null +++ b/sapi/apache_hooks/libphp5.module.in @@ -0,0 +1,11 @@ +Name: php5_module +ConfigStart + RULE_WANTHSREGEX=no + RULE_HIDE=yes + PHP_LIBS="@NATIVE_RPATHS@ @PHP_LDFLAGS@ @PHP_LIBS@ @EXTRA_LIBS@ $LIBS" + PHP_CFLAGS="$CFLAGS @OPENSSL_INCDIR_OPT@ -I@php_abs_top_builddir@/main -I@php_abs_top_builddir@/Zend -I@php_abs_top_builddir@/TSRM -I@php_abs_top_srcdir@ -I@php_abs_top_srcdir@/sapi/apache -I@php_abs_top_srcdir@/main -I@php_abs_top_srcdir@/Zend -I@php_abs_top_srcdir@/TSRM" + my_outfile="Makefile.config" + echo "PHP_CFLAGS=$PHP_CFLAGS" >>$my_outfile + echo "PHP_LIBS=$PHP_LIBS" >>$my_outfile + LIBS=$PHP_LIBS +ConfigEnd diff --git a/sapi/apache_hooks/mod_php4.c b/sapi/apache_hooks/mod_php4.c deleted file mode 100644 index fa067958f6..0000000000 --- a/sapi/apache_hooks/mod_php4.c +++ /dev/null @@ -1,1474 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2004 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.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/3_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 | - | (with helpful hints from Dean Gaudet | - | PHP 4.0 patches by Zeev Suraski | - +----------------------------------------------------------------------+ - */ -/* $Id$ */ - -#include "php_apache_http.h" - -#ifdef NETWARE -#define SIGPIPE SIGINT -#endif - -#if defined(ZEND_MULTIBYTE) && defined(HAVE_MBSTRING) -#include "ext/mbstring/mbstring.h" -#endif /* defined(ZEND_MULTIBYTE) && defined(HAVE_MBSTRING) */ - -#undef shutdown - -/* {{{ Prototypes - */ -int apache_php_module_main(request_rec *r, int display_source_mode TSRMLS_DC); -static void php_save_umask(void); -static void php_restore_umask(void); -static int sapi_apache_read_post(char *buffer, uint count_bytes TSRMLS_DC); -static char *sapi_apache_read_cookies(TSRMLS_D); -static int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC); -static int sapi_apache_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC); -static int send_php(request_rec *r, int display_source_mode, char *filename); -static int send_parsed_php(request_rec * r); -static int send_parsed_php_source(request_rec * r); -static int php_xbithack_handler(request_rec * r); -static void php_init_handler(server_rec *s, pool *p); -/* }}} */ - -#if MODULE_MAGIC_NUMBER >= 19970728 -static void php_child_exit_handler(server_rec *s, pool *p); -#endif - -#if MODULE_MAGIC_NUMBER > 19961007 -#define CONST_PREFIX const -#else -#define CONST_PREFIX -#endif - - -typedef struct _sapi_stack { - int top, max, persistent; - void **elements; -} sapi_stack; - -typedef struct _php_per_dir_config { - HashTable *ini_settings; - sapi_stack headers_handlers; - sapi_stack auth_handlers; - sapi_stack access_handlers; - sapi_stack type_handlers; - sapi_stack fixup_handlers; - sapi_stack logger_handlers; - sapi_stack post_read_handlers; - sapi_stack response_handlers; -} php_per_dir_config; - -typedef struct _php_per_server_config { - sapi_stack uri_handlers; - sapi_stack requires; -} php_per_server_config; - - -static CONST_PREFIX char *php_apache_value_handler_ex(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2, int mode); -static CONST_PREFIX char *php_apache_value_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2); -static CONST_PREFIX char *php_apache_admin_value_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2); -static CONST_PREFIX char *php_apache_flag_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2); -static CONST_PREFIX char *php_apache_flag_handler_ex(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2, int mode); -static CONST_PREFIX char *php_apache_admin_flag_handler(cmd_parms *cmd, php_per_dir_config *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 int setup_env = 0; -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; - -/* some systems are missing these from their header files */ - -/* {{{ zend stack utility functions - */ - -/* This code is ripped part and parcel from zend_stack.[ch]. Assuming that the - patch supporting zend_stack_init_ex is applied, all but the bottom two - module-specific iterators will be removed - */ - -int sapi_stack_init_ex(sapi_stack *stack, int persistent) -{ - stack->top = 0; - stack->persistent = persistent; - stack->elements = (void **) pemalloc(sizeof(void **) * STACK_BLOCK_SIZE, persistent); - if (!stack->elements) { - return FAILURE; - } else { - stack->max = STACK_BLOCK_SIZE; - return SUCCESS; - } -} -int sapi_stack_push(sapi_stack *stack, void *element) -{ - if (stack->top >= stack->max) { /* we need to allocate more memory */ - stack->elements = (void **) perealloc(stack->elements, - (sizeof(void **) * (stack->max += STACK_BLOCK_SIZE)), stack->persistent); - if (!stack->elements) { - return FAILURE; - } - } - stack->elements[stack->top] = (void *) element; - return stack->top++; -} -void* sapi_stack_pop(sapi_stack *stack) { - if(stack->top == 0) { - return NULL; - } - else { - return stack->elements[--stack->top]; - } -} - -int sapi_stack_destroy(sapi_stack *stack) -{ - return SUCCESS; -} - -int sapi_stack_apply_with_argument_all(sapi_stack *stack, int type, int (*apply_function)(void *element, void *arg), void *arg) -{ - int i, retval; - - switch (type) { - case ZEND_STACK_APPLY_TOPDOWN: - for (i=stack->top-1; i>=0; i--) { - retval = apply_function(stack->elements[i], arg); - } - break; - case ZEND_STACK_APPLY_BOTTOMUP: - for (i=0; itop; i++) { - retval = apply_function(stack->elements[i], arg); - } - break; - } - return retval; -} - - -int sapi_stack_apply_with_argument_stop_if_equals(sapi_stack *stack, int type, int (*apply_function)(void *element, void *arg), void *arg, int stopval) -{ - int i; - int ret = DECLINED; - switch (type) { - case ZEND_STACK_APPLY_TOPDOWN: - for (i=stack->top-1; i>=0; i--) { - if ((ret = apply_function(stack->elements[i], arg)) == stopval) { - break; - } - } - break; - case ZEND_STACK_APPLY_BOTTOMUP: - for (i=0; itop; i++) { - if ((ret = apply_function(stack->elements[i], arg)) == stopval) { - break; - } - } - break; - } - return ret; -} - -int sapi_stack_apply_with_argument_stop_if_http_error(sapi_stack *stack, int type, int (*apply_function)(void *element, void *arg), void *arg) -{ - int i; - int ret = DECLINED; - switch (type) { - case ZEND_STACK_APPLY_TOPDOWN: - for (i=stack->top-1; i>=0; i--) { - if ((ret = apply_function(stack->elements[i], arg)) > 0) { - break; - } - } - break; - case ZEND_STACK_APPLY_BOTTOMUP: - for (i=0; itop; i++) { - if ((ret = apply_function(stack->elements[i], arg)) > 0) { - break; - } - } - break; - } - return ret; -} - -void php_handler_stack_destroy(sapi_stack *stack) -{ - php_handler *ph; - while((ph = (php_handler *)sapi_stack_pop(stack)) != NULL) { - free(ph->name); - free(ph); - } -} -/* }}} */ - -/* {{{ php_save_umask - */ -static void php_save_umask(void) -{ - saved_umask = umask(077); - umask(saved_umask); -} -/* }}} */ - -/* {{{ sapi_apache_ub_write - */ -static int sapi_apache_ub_write(const char *str, uint str_length TSRMLS_DC) -{ - int ret=0; - - if (SG(server_context)) { - ret = rwrite(str, str_length, (request_rec *) SG(server_context)); - } - if (ret != str_length) { - php_handle_aborted_connection(); - } - return ret; -} -/* }}} */ - -/* {{{ sapi_apache_flush - */ -static void sapi_apache_flush(void *server_context) -{ - if (server_context) { -#if MODULE_MAGIC_NUMBER > 19970110 - rflush((request_rec *) server_context); -#else - bflush((request_rec *) server_context->connection->client); -#endif - } -} -/* }}} */ - -/* {{{ sapi_apache_read_post - */ -static int sapi_apache_read_post(char *buffer, uint count_bytes TSRMLS_DC) -{ - uint total_read_bytes=0, read_bytes; - request_rec *r = (request_rec *) SG(server_context); - void (*handler)(int); - - /* - * This handles the situation where the browser sends a Expect: 100-continue header - * and needs to recieve confirmation from the server on whether or not it can send - * the rest of the request. RFC 2616 - * - */ - if (!SG(read_post_bytes) && !ap_should_client_block(r)) { - return total_read_bytes; - } - - handler = signal(SIGPIPE, SIG_IGN); - while (total_read_bytessubprocess_env, "HTTP_COOKIE"); -} -/* }}} */ - -/* {{{ sapi_apache_header_handler - */ -static int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_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) { - efree(sapi_header->header); - 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 */ -} -/* }}} */ - -/* {{{ sapi_apache_send_headers - */ -static int sapi_apache_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) -{ - if(SG(server_context) == NULL) { /* server_context is not here anymore */ - return SAPI_HEADER_SEND_FAILED; - } - - ((request_rec *) SG(server_context))->status = SG(sapi_headers).http_response_code; - /* check that we haven't sent headers already, we use our own - * headers_sent since we may send headers at anytime - */ - if(!AP(headers_sent)) { - send_http_header((request_rec *) SG(server_context)); - AP(headers_sent) = 1; - } - return SAPI_HEADER_SENT_SUCCESSFULLY; -} -/* }}} */ - -/* {{{ sapi_apache_register_server_variables - */ -static void sapi_apache_register_server_variables(zval *track_vars_array TSRMLS_DC) -{ - register int i; - array_header *arr = table_elts(((request_rec *) SG(server_context))->subprocess_env); - table_entry *elts = (table_entry *) arr->elts; - zval **path_translated; - HashTable *symbol_table; - - for (i = 0; i < arr->nelts; i++) { - char *val; - - if (elts[i].val) { - val = elts[i].val; - } else { - val = empty_string; - } - php_register_variable(elts[i].key, val, track_vars_array TSRMLS_CC); - } - - /* If PATH_TRANSLATED doesn't exist, copy it from SCRIPT_FILENAME */ - if (track_vars_array) { - symbol_table = track_vars_array->value.ht; - } else if (PG(register_globals)) { - /* should never happen nowadays */ - symbol_table = EG(active_symbol_table); - } else { - symbol_table = NULL; - } - if (symbol_table - && !zend_hash_exists(symbol_table, "PATH_TRANSLATED", sizeof("PATH_TRANSLATED")) - && zend_hash_find(symbol_table, "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME"), (void **) &path_translated)==SUCCESS) { - php_register_variable("PATH_TRANSLATED", Z_STRVAL_PP(path_translated), track_vars_array TSRMLS_CC); - } - - php_register_variable("PHP_SELF", ((request_rec *) SG(server_context))->uri, track_vars_array TSRMLS_CC); -} -/* }}} */ - -/* {{{ php_apache_startup - */ -static int php_apache_startup(sapi_module_struct *sapi_module) -{ - if (php_module_startup(sapi_module, &apache_module_entry, 1) == FAILURE) { - return FAILURE; - } else { - return SUCCESS; - } -} -/* }}} */ - -/* {{{ php_apache_log_message - */ -static void php_apache_log_message(char *message) -{ - TSRMLS_FETCH(); - - if (SG(server_context)) { -#if MODULE_MAGIC_NUMBER >= 19970831 - aplog_error(NULL, 0, APLOG_ERR | APLOG_NOERRNO, ((request_rec *) SG(server_context))->server, "%s", message); -#else - log_error(message, ((request_rec *) SG(server_context))->server); -#endif - } else { - fprintf(stderr, "%s", message); - fprintf(stderr, "\n"); - } -} -/* }}} */ - -/* {{{ php_apache_request_shutdown - */ -static void php_apache_request_shutdown(void *dummy) -{ - TSRMLS_FETCH(); - AP(current_hook) = AP_CLEANUP; - php_output_set_status(0 TSRMLS_CC); - SG(server_context) = NULL; /* The server context (request) is invalid by the time run_cleanups() is called */ - if(SG(sapi_started)) { - php_request_shutdown(dummy); - SG(sapi_started) = 0; - } - AP(in_request) = 0; - if(AP(setup_env)) { - AP(setup_env) = 0; - } - AP(current_hook) = AP_WAITING_FOR_REQUEST; - AP(headers_sent) = 0; -} -/* }}} */ - -/* {{{ php_apache_sapi_activate - */ -static int php_apache_sapi_activate(TSRMLS_D) -{ - request_rec *r = (request_rec *) SG(server_context); - - /* - * For the Apache module version, this bit of code registers a cleanup - * function that gets triggered when our request pool is destroyed. - * We need this because at any point in our code we can be interrupted - * and that may happen before we have had time to free our memory. - * The php_request_shutdown function needs to free all outstanding allocated - * memory. - */ - block_alarms(); - register_cleanup(r->pool, NULL, php_apache_request_shutdown, php_request_shutdown_for_exec); - AP(in_request)=1; - unblock_alarms(); - - /* Override the default headers_only value - sometimes "GET" requests should actually only - * send headers. - */ - SG(request_info).headers_only = r->header_only; - return SUCCESS; -} -/* }}} */ - -/* {{{ php_apache_get_stat - */ -static struct stat *php_apache_get_stat(TSRMLS_D) -{ - return &((request_rec *) SG(server_context))->finfo; -} -/* }}} */ - -/* {{{ php_apache_getenv - */ -static char *php_apache_getenv(char *name, size_t name_len TSRMLS_DC) -{ - return (char *) table_get(((request_rec *) SG(server_context))->subprocess_env, name); -} -/* }}} */ - -/* {{{ sapi_module_struct apache_sapi_module - */ -static sapi_module_struct apache_sapi_module = { - "apache", /* name */ - "Apache", /* pretty name */ - - php_apache_startup, /* startup */ - php_module_shutdown_wrapper, /* shutdown */ - - php_apache_sapi_activate, /* activate */ - NULL, /* deactivate */ - - sapi_apache_ub_write, /* unbuffered write */ - sapi_apache_flush, /* flush */ - php_apache_get_stat, /* get uid */ - php_apache_getenv, /* getenv */ - - 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 */ - - sapi_apache_register_server_variables, /* register server variables */ - php_apache_log_message, /* Log message */ - - NULL, /* php.ini path override */ - -#ifdef PHP_WIN32 - NULL, - NULL, -#else - block_alarms, /* Block interruptions */ - unblock_alarms, /* Unblock interruptions */ -#endif - - NULL, /* default post reader */ - NULL, /* treat data */ - NULL, /* exe location */ - 0, /* ini ignore */ - NULL - -}; -/* }}} */ - -/* {{{ php_restore_umask - */ -static void php_restore_umask(void) -{ - umask(saved_umask); -} -/* }}} */ - -/* {{{ init_request_info - */ -static void init_request_info(TSRMLS_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); - SG(sapi_headers).http_response_code = r->status; - - if (r->headers_in) { - authorization = table_get(r->headers_in, "Authorization"); - } - if (authorization - && !auth_type(r) - && !strcasecmp(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) { - r->connection->user = pstrdup(r->connection->pool, SG(request_info).auth_user); - r->connection->ap_auth_type = "Basic"; - 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; - } -} -/* }}} */ - -/* {{{ php_apache_alter_ini_entries - */ -static int php_apache_alter_ini_entries(php_per_dir_entry *per_dir_entry TSRMLS_DC) -{ - zend_alter_ini_entry(per_dir_entry->key, per_dir_entry->key_length+1, per_dir_entry->value, per_dir_entry->value_length, per_dir_entry->type, PHP_INI_STAGE_ACTIVATE); - return 0; -} -/* }}} */ - -/* {{{ php_apache_get_default_mimetype - */ -static char *php_apache_get_default_mimetype(request_rec *r TSRMLS_DC) -{ - - char *mimetype; - if (SG(default_mimetype) || SG(default_charset)) { - /* Assume output will be of the default MIME type. Individual - scripts may change this later. */ - char *tmpmimetype; - tmpmimetype = sapi_get_default_content_type(TSRMLS_C); - mimetype = pstrdup(r->pool, tmpmimetype); - efree(tmpmimetype); - } else { - mimetype = SAPI_DEFAULT_MIMETYPE "; charset=" SAPI_DEFAULT_CHARSET; - } - return mimetype; -} -/* }}} */ - -/* {{{ send_php - */ -static int send_php(request_rec *r, int display_source_mode, char *filename) -{ - int retval; - php_per_dir_config *per_dir_conf; - TSRMLS_FETCH(); - if (AP(in_request)) { - zend_file_handle fh; - - fh.filename = r->filename; - fh.opened_path = NULL; - fh.free_filename = 0; - fh.type = ZEND_HANDLE_FILENAME; - -#if defined(ZEND_MULTIBYTE) && defined(HAVE_MBSTRING) - php_mbstring_set_zend_encoding(TSRMLS_C); -#endif /* defined(ZEND_MULTIBYTE) && defined(HAVE_MBSTRING) */ - - zend_execute_scripts(ZEND_INCLUDE TSRMLS_CC, NULL, 1, &fh); - return OK; - } - - zend_first_try { - - /* Make sure file exists */ - if (filename == NULL && r->finfo.st_mode == 0) { - return DECLINED; - } - - per_dir_conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module); - if (per_dir_conf) { - zend_hash_apply((HashTable *) per_dir_conf->ini_settings, (apply_func_t) php_apache_alter_ini_entries TSRMLS_CC); - } - - /* If PHP parser engine has been turned off with an "engine off" - * directive, then decline to handle this request - */ - if (!AP(engine)) { - r->content_type = php_apache_get_default_mimetype(r TSRMLS_CC); - r->allowed |= (1 << METHODS) - 1; - zend_try { - zend_ini_deactivate(TSRMLS_C); - } zend_end_try(); - return DECLINED; - } - if (filename == NULL) { - filename = r->filename; - } - - /* 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))) { - zend_try { - zend_ini_deactivate(TSRMLS_C); - } zend_end_try(); - return retval; - } -#endif - - if (AP(last_modified)) { -#if MODULE_MAGIC_NUMBER < 19970912 - if ((retval = set_last_modified(r, r->finfo.st_mtime))) { - zend_try { - zend_ini_deactivate(TSRMLS_C); - } zend_end_try(); - return retval; - } -#else - update_mtime (r, r->finfo.st_mtime); - set_last_modified(r); - set_etag(r); -#endif - } - /* Assume output will be of the default MIME type. Individual - scripts may change this later in the request. */ - r->content_type = php_apache_get_default_mimetype(r TSRMLS_CC); - - /* Init timeout */ - hard_timeout("send", r); - - SG(server_context) = r; - - php_save_umask(); - if(!AP(setup_env)) { - AP(setup_env) = 1; - add_common_vars(r); - add_cgi_vars(r); - } - init_request_info(TSRMLS_C); - apache_php_module_main(r, display_source_mode TSRMLS_CC); - - /* Done, restore umask, turn off timeout, close file and return */ - php_restore_umask(); - kill_timeout(r); - } zend_end_try(); - - return OK; -} -/* }}} */ - -/* {{{ send_parsed_php - */ -static int send_parsed_php(request_rec * r) -{ - int result = send_php(r, 0, NULL); - -#if MEMORY_LIMIT - { - char *mem_usage; - TSRMLS_FETCH(); - - mem_usage = ap_psprintf(r->pool, "%u", AG(allocated_memory_peak)); - AG(allocated_memory_peak) = 0; - ap_table_setn(r->notes, "mod_php_memory_usage", mem_usage); - } -#endif - - return result; -} -/* }}} */ - -/* {{{ send_parsed_php_source - */ -static int send_parsed_php_source(request_rec * r) -{ - return send_php(r, 1, NULL); -} -/* }}} */ - - -/* {{{ destroy_per_dir_entry - */ -static void destroy_per_dir_entry(php_per_dir_entry *per_dir_entry) -{ - free(per_dir_entry->key); - free(per_dir_entry->value); -} -/* }}} */ - -/* {{{ copy_per_dir_entry - */ -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; -} -/* }}} */ - -/* {{{ should_overwrite_per_dir_entry; - - */ -static zend_bool should_overwrite_per_dir_entry(HashTable *target_ht, php_per_dir_entry *orig_per_dir_entry, zend_hash_key *hash_key, void *pData) -{ - php_per_dir_entry *new_per_dir_entry; - - if (zend_hash_find(target_ht, hash_key->arKey, hash_key->nKeyLength, (void **) &new_per_dir_entry)==FAILURE) { - return 1; /* does not exist in dest, copy from source */ - } - - if (new_per_dir_entry->type==PHP_INI_SYSTEM - && orig_per_dir_entry->type!=PHP_INI_SYSTEM) { - return 1; - } else { - return 0; - } -} -/* }}} */ -/* {{{ php_destroy_per_server_info - */ -static void php_destroy_per_server_info(php_per_server_config *conf) -{ - php_handler_stack_destroy(&conf->requires); - php_handler_stack_destroy(&conf->uri_handlers); -} -/* }}} */ - -/* {{{ php_destroy_per_dir_info - */ -static void php_destroy_per_dir_info(php_per_dir_config *conf) -{ - zend_hash_destroy(conf->ini_settings); - php_handler_stack_destroy(&conf->response_handlers); - php_handler_stack_destroy(&conf->auth_handlers); - php_handler_stack_destroy(&conf->access_handlers); - php_handler_stack_destroy(&conf->type_handlers); - php_handler_stack_destroy(&conf->fixup_handlers); - php_handler_stack_destroy(&conf->logger_handlers); - php_handler_stack_destroy(&conf->post_read_handlers); - php_handler_stack_destroy(&conf->headers_handlers); - free(conf->ini_settings); -} -/* }}} */ - -/* {{{ php_create_server - */ -static void *php_create_server(pool *p, char *dummy) -{ - php_per_server_config *conf; - conf = (php_per_server_config *) malloc(sizeof(php_per_server_config)); - register_cleanup(p, (void *) conf, (void (*)(void *)) php_destroy_per_server_info, (void (*)(void *)) php_destroy_per_server_info); - - sapi_stack_init_ex(&conf->requires, 1); - sapi_stack_init_ex(&conf->uri_handlers, 1); - return conf; -} - -/* }}} */ - - -/* {{{ php_create_dir - */ -static void *php_create_dir(pool *p, char *dummy) -{ - php_per_dir_config *conf; - conf = (php_per_dir_config *) malloc(sizeof(php_per_dir_config)); - conf->ini_settings = (HashTable *) malloc(sizeof(HashTable)); - zend_hash_init_ex(conf->ini_settings, 5, NULL, (void (*)(void *)) destroy_per_dir_entry, 1, 0); - sapi_stack_init_ex(&conf->response_handlers, 1); - sapi_stack_init_ex(&conf->headers_handlers, 1); - sapi_stack_init_ex(&conf->auth_handlers, 1); - sapi_stack_init_ex(&conf->access_handlers, 1); - sapi_stack_init_ex(&conf->type_handlers, 1); - sapi_stack_init_ex(&conf->fixup_handlers, 1); - sapi_stack_init_ex(&conf->logger_handlers, 1); - sapi_stack_init_ex(&conf->post_read_handlers, 1); - register_cleanup(p, (void *) conf, (void (*)(void *)) php_destroy_per_dir_info, (void (*)(void *)) php_destroy_per_dir_info); - - return conf; -} - -/* }}} */ - -/* {{{ php_merge_dir - */ -static void *php_merge_dir(pool *p, void *basev, void *addv) -{ - php_per_dir_config *a = (php_per_dir_config *) addv; - php_per_dir_config *b = (php_per_dir_config *) basev; - /* This function *must* return addv, and not modify basev */ - zend_hash_merge_ex((HashTable *) a->ini_settings, (HashTable *) b->ini_settings, (copy_ctor_func_t) copy_per_dir_entry, sizeof(php_per_dir_entry), (merge_checker_func_t) should_overwrite_per_dir_entry, NULL); - a->headers_handlers = (a->headers_handlers.top)?a->headers_handlers:b->headers_handlers; - a->auth_handlers = (a->auth_handlers.top)?a->auth_handlers:b->auth_handlers; - a->access_handlers = (a->access_handlers.top)?a->access_handlers:b->access_handlers; - a->type_handlers = (a->type_handlers.top)?a->type_handlers:b->type_handlers; - a->fixup_handlers = (a->fixup_handlers.top)?a->fixup_handlers:b->fixup_handlers; - a->logger_handlers = (a->logger_handlers.top)?a->logger_handlers:b->logger_handlers; - a->post_read_handlers = (a->post_read_handlers.top)?a->post_read_handlers:b->post_read_handlers; - a->response_handlers = (a->response_handlers.top)?a->response_handlers:b->response_handlers; - return a; -} -/* }}} */ - -/* {{{ php_apache_value_handler_ex - */ -static 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) { - apache_php_initialized = 1; -#ifdef ZTS - tsrm_startup(1, 1, 0, NULL); -#endif - sapi_startup(&apache_sapi_module); - php_apache_startup(&apache_sapi_module); - } - per_dir_entry.type = mode; - - if (strcasecmp(arg2, "none") == 0) { - arg2 = ""; - } - - 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(conf, per_dir_entry.key, per_dir_entry.key_length, &per_dir_entry, sizeof(php_per_dir_entry), NULL); - return NULL; -} -/* }}} */ - -static CONST_PREFIX char *php_set_server_handler(server_rec *s, char *arg1, long handler_stage, long handler_type) -{ - php_per_server_config *conf; - php_handler *handler; - handler = (php_handler *) malloc(sizeof(php_handler)); - handler->type = handler_type; - handler->stage = handler_stage; - handler->name = strdup(arg1); - conf = get_module_config(s->module_config, &php4_module); - switch(handler_stage) { - case AP_URI_TRANS: - sapi_stack_push(&conf->uri_handlers, handler); - break; - default: - sapi_stack_push(&conf->requires, handler); - break; - } - return NULL; -} - -static CONST_PREFIX char *php_set_dir_handler(php_per_dir_config *conf, char *arg1, long handler_stage, long handler_type) -{ - php_handler *handler; - handler = (php_handler *) malloc(sizeof(php_handler)); - handler->type = handler_type; - handler->stage = handler_stage; - handler->name = strdup(arg1); - switch(handler_stage) { - case AP_POST_READ: - sapi_stack_push(&conf->post_read_handlers, handler); - break; - case AP_HEADER_PARSE: - sapi_stack_push(&conf->headers_handlers, handler); - break; - case AP_ACCESS_CONTROL: - sapi_stack_push(&conf->access_handlers, handler); - break; - case AP_AUTHENTICATION: - sapi_stack_push(&conf->auth_handlers, handler); - break; - case AP_AUTHORIZATION: - break; - case AP_TYPE_CHECKING: - sapi_stack_push(&conf->type_handlers, handler); - break; - case AP_FIXUP: - sapi_stack_push(&conf->fixup_handlers, handler); - break; - case AP_RESPONSE: - sapi_stack_push(&conf->response_handlers, handler); - break; - case AP_LOGGING: - sapi_stack_push(&conf->logger_handlers, handler); - break; - default: - break; - } - return NULL; -} - -/* {{{ php_set_uri_handler - */ -static CONST_PREFIX char *php_set_uri_handler(cmd_parms *cmd, void *dummy, char *arg1) -{ - return php_set_server_handler(cmd->server, arg1, AP_URI_TRANS, AP_HANDLER_TYPE_FILE); -} -/* }}} */ - -/* {{{ php_set_uri_handler_code */ -static CONST_PREFIX char *php_set_uri_handler_code(cmd_parms *cmd, void *dummy, char *arg1) -{ - return php_set_server_handler(cmd->server, arg1, AP_URI_TRANS, AP_HANDLER_TYPE_METHOD); -} -/* }}} */ - -/* {{{ php_set_header_handler - */ -static CONST_PREFIX char *php_set_header_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) -{ - return php_set_dir_handler(conf, arg1, AP_HEADER_PARSE, AP_HANDLER_TYPE_FILE); -} -static CONST_PREFIX char *php_set_header_handler_code(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) -{ - return php_set_dir_handler(conf, arg1, AP_HEADER_PARSE, AP_HANDLER_TYPE_METHOD); -} -/* }}} */ - -/* {{{ php_set_auth_handler - */ -static CONST_PREFIX char *php_set_auth_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) -{ - return php_set_dir_handler(conf, arg1, AP_AUTHENTICATION, AP_HANDLER_TYPE_FILE); -} -static CONST_PREFIX char *php_set_auth_handler_code(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) -{ - return php_set_dir_handler(conf, arg1, AP_AUTHENTICATION, AP_HANDLER_TYPE_METHOD); -} - -/* }}} */ - -/* {{{ php_set_access_handler - */ -static CONST_PREFIX char *php_set_access_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) -{ - return php_set_dir_handler(conf, arg1, AP_ACCESS_CONTROL, AP_HANDLER_TYPE_FILE); -} -static CONST_PREFIX char *php_set_access_handler_code(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) -{ - return php_set_dir_handler(conf, arg1, AP_ACCESS_CONTROL, AP_HANDLER_TYPE_METHOD); -} - -/* }}} */ - -/* {{{ php_set_type_handler - */ -static CONST_PREFIX char *php_set_type_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) -{ - return php_set_dir_handler(conf, arg1, AP_TYPE_CHECKING, AP_HANDLER_TYPE_FILE); -} -static CONST_PREFIX char *php_set_type_handler_code(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) -{ - return php_set_dir_handler(conf, arg1, AP_TYPE_CHECKING, AP_HANDLER_TYPE_METHOD); -} - -/* }}} */ - -/* {{{ php_set_fixup_handler - */ -static CONST_PREFIX char *php_set_fixup_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) -{ - return php_set_dir_handler(conf, arg1, AP_FIXUP, AP_HANDLER_TYPE_FILE); -} -static CONST_PREFIX char *php_set_fixup_handler_code(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) -{ - return php_set_dir_handler(conf, arg1, AP_FIXUP, AP_HANDLER_TYPE_METHOD); -} -/* }}} */ - -/* {{{ php_set_logger_handler - */ -static CONST_PREFIX char *php_set_logger_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) -{ - return php_set_dir_handler(conf, arg1, AP_LOGGING, AP_HANDLER_TYPE_FILE); -} -static CONST_PREFIX char *php_set_logger_handler_code(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) -{ - return php_set_dir_handler(conf, arg1, AP_LOGGING, AP_HANDLER_TYPE_METHOD); -} - -/* }}} */ - -/* {{{ php_set_post_read_handler - */ -static CONST_PREFIX char *php_set_post_read_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) -{ - return php_set_dir_handler(conf, arg1, AP_POST_READ, AP_HANDLER_TYPE_FILE); -} -static CONST_PREFIX char *php_set_post_read_handler_code(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) -{ - return php_set_dir_handler(conf, arg1, AP_POST_READ, AP_HANDLER_TYPE_METHOD); -} - - -/* }}} */ - -/* {{{ php_set_require - */ - -static CONST_PREFIX char *php_set_require(cmd_parms *cmd, void *dummy, char *arg1) -{ - return php_set_server_handler(cmd->server, arg1, 0, AP_HANDLER_TYPE_FILE); -} -/* }}} */ - -/* {{{ php_set_response_handler - */ -static CONST_PREFIX char *php_set_response_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) -{ - return php_set_dir_handler(conf, arg1, AP_RESPONSE, AP_HANDLER_TYPE_FILE); -} -static CONST_PREFIX char *php_set_response_handler_code(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) -{ - return php_set_dir_handler(conf, arg1, AP_RESPONSE, AP_HANDLER_TYPE_METHOD); -} -/* }}} */ - -/* {{{ php_apache_value_handler - */ -static CONST_PREFIX char *php_apache_value_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2) -{ - return php_apache_value_handler_ex(cmd, conf->ini_settings, arg1, arg2, PHP_INI_PERDIR); -} -/* }}} */ - -/* {{{ php_apache_admin_value_handler - */ -static CONST_PREFIX char *php_apache_admin_value_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2) -{ - return php_apache_value_handler_ex(cmd, conf->ini_settings, arg1, arg2, PHP_INI_SYSTEM); -} -/* }}} */ - -/* {{{ php_apache_flag_handler_ex - */ -static 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); -} -/* }}} */ - -/* {{{ php_apache_flag_handler - */ -static CONST_PREFIX char *php_apache_flag_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2) -{ - return php_apache_flag_handler_ex(cmd, conf->ini_settings, arg1, arg2, PHP_INI_PERDIR); -} -/* }}} */ - -/* {{{ php_apache_admin_flag_handler - */ -static CONST_PREFIX char *php_apache_admin_flag_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2) -{ - return php_apache_flag_handler_ex(cmd, conf->ini_settings, arg1, arg2, PHP_INI_SYSTEM); -} -/* }}} */ - -/* {{{ int php_xbithack_handler(request_rec * r) - */ -static int php_xbithack_handler(request_rec * r) -{ - php_per_dir_config *conf; - TSRMLS_FETCH(); - - if (!(r->finfo.st_mode & S_IXUSR)) { - r->allowed |= (1 << METHODS) - 1; - return DECLINED; - } - conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module); - if (conf) { - zend_hash_apply((HashTable *) conf->ini_settings, (apply_func_t) php_apache_alter_ini_entries TSRMLS_CC); - } - if(!AP(xbithack)) { - r->allowed |= (1 << METHODS) - 1; - return DECLINED; - } - return send_parsed_php(r); -} -/* }}} */ - -/* {{{ apache_php_module_shutdown_wrapper - */ -static void apache_php_module_shutdown_wrapper(void) -{ - apache_php_initialized = 0; - apache_sapi_module.shutdown(&apache_sapi_module); - -#if MODULE_MAGIC_NUMBER >= 19970728 - /* This function is only called on server exit if the apache API - * child_exit handler exists, so shutdown globally - */ - sapi_shutdown(); -#endif - -#ifdef ZTS - tsrm_shutdown(); -#endif -} -/* }}} */ - -#if MODULE_MAGIC_NUMBER >= 19970728 -/* {{{ php_child_exit_handler - */ -static void php_child_exit_handler(server_rec *s, pool *p) -{ -/* apache_php_initialized = 0; */ - apache_sapi_module.shutdown(&apache_sapi_module); - -#ifdef ZTS - tsrm_shutdown(); -#endif -} -/* }}} */ -#endif - -/* {{{ void php_init_handler(server_rec *s, pool *p) - */ -static 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) { - apache_php_initialized = 1; -#ifdef ZTS - tsrm_startup(1, 1, 0, NULL); -#endif - sapi_startup(&apache_sapi_module); - php_apache_startup(&apache_sapi_module); - } -#if MODULE_MAGIC_NUMBER >= 19980527 - { - TSRMLS_FETCH(); - if (PG(expose_php)) { - ap_add_version_component("PHP/" PHP_VERSION); - } - } -#endif -} -/* }}} */ - -static int php_run_hook(php_handler *handler, request_rec *r) -{ - zval *ret = NULL; - php_per_dir_config *conf; - - TSRMLS_FETCH(); - - if(!AP(apache_config_loaded)) { - conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module); - if (conf) - zend_hash_apply((HashTable *)conf->ini_settings, (apply_func_t) php_apache_alter_ini_entries TSRMLS_CC); - AP(apache_config_loaded) = 1; - } - if (!handler->name) { - return DECLINED; - } - php_save_umask(); - if (!AP(setup_env)) { - AP(setup_env) = 1; - add_common_vars(r); - add_cgi_vars(r); - } - SG(server_context) = r; - init_request_info(TSRMLS_C); - apache_php_module_hook(r, handler, &ret TSRMLS_CC); - php_restore_umask(); - kill_timeout(r); - if (ret) { - convert_to_long(ret); - return Z_LVAL_P(ret); - } - return HTTP_INTERNAL_SERVER_ERROR; -} - - -static int php_uri_translation(request_rec *r) -{ - php_per_server_config *conf; - TSRMLS_FETCH(); - AP(current_hook) = AP_URI_TRANS; - conf = (php_per_server_config *) get_module_config(r->server->module_config, &php4_module); - return sapi_stack_apply_with_argument_stop_if_equals(&conf->uri_handlers, - ZEND_STACK_APPLY_BOTTOMUP, - (int (*)(void *element, void *)) php_run_hook, r, OK); -} - -static int php_header_hook(request_rec *r) -{ - php_per_dir_config *conf; - TSRMLS_FETCH(); - AP(current_hook) = AP_HEADER_PARSE; - conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module); - return sapi_stack_apply_with_argument_stop_if_http_error(&conf->headers_handlers, - ZEND_STACK_APPLY_BOTTOMUP, - (int (*)(void *element, void *)) php_run_hook, r); -} - -static int php_auth_hook(request_rec *r) -{ - php_per_dir_config *conf; - TSRMLS_FETCH(); - AP(current_hook) = AP_AUTHENTICATION; - conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module); - return sapi_stack_apply_with_argument_stop_if_equals(&conf->auth_handlers, - ZEND_STACK_APPLY_BOTTOMUP, - (int (*)(void *element, void *)) php_run_hook, r, OK); -} - -static int php_access_hook(request_rec *r) -{ - php_per_dir_config *conf; - int status = DECLINED; - TSRMLS_FETCH(); - AP(current_hook) = AP_ACCESS_CONTROL; - conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module); - status = sapi_stack_apply_with_argument_stop_if_http_error(&conf->access_handlers, - ZEND_STACK_APPLY_BOTTOMUP, - (int (*)(void *element, void *)) php_run_hook, r); - return status; - -} - -static int php_type_hook(request_rec *r) -{ - php_per_dir_config *conf; - TSRMLS_FETCH(); - AP(current_hook) = AP_TYPE_CHECKING; - conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module); - return sapi_stack_apply_with_argument_stop_if_equals(&conf->type_handlers, - ZEND_STACK_APPLY_BOTTOMUP, - (int (*)(void *element, void *)) php_run_hook, - r, OK); -} - -static int php_fixup_hook(request_rec *r) -{ - php_per_dir_config *conf; - TSRMLS_FETCH(); - AP(current_hook) = AP_FIXUP; - conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module); - return sapi_stack_apply_with_argument_stop_if_http_error(&conf->fixup_handlers, - ZEND_STACK_APPLY_BOTTOMUP, - (int (*)(void *element, void *)) php_run_hook, - r); -} - -static int php_logger_hook(request_rec *r) -{ - php_per_dir_config *conf; - TSRMLS_FETCH(); - AP(current_hook) = AP_LOGGING; - conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module); - return sapi_stack_apply_with_argument_stop_if_http_error(&conf->logger_handlers, - ZEND_STACK_APPLY_BOTTOMUP, - (int (*)(void *element, void *)) php_run_hook, - r); -} - -static int php_post_read_hook(request_rec *r) -{ - php_per_dir_config *conf; - php_per_server_config *svr; - TSRMLS_FETCH(); - AP(current_hook) = AP_POST_READ; - svr = get_module_config(r->server->module_config, &php4_module); - if(ap_is_initial_req(r)) { - sapi_stack_apply_with_argument_all(&svr->requires, ZEND_STACK_APPLY_BOTTOMUP, (int (*)(void *element, void *)) php_run_hook, r); - } - conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module); - return sapi_stack_apply_with_argument_stop_if_http_error(&conf->post_read_handlers, - ZEND_STACK_APPLY_BOTTOMUP, - (int (*)(void *element, void *)) php_run_hook, r); -} - -static int php_response_handler(request_rec *r) -{ - php_per_dir_config *conf; - TSRMLS_FETCH(); - AP(current_hook) = AP_RESPONSE; - conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php4_module); - return sapi_stack_apply_with_argument_all(&conf->response_handlers, ZEND_STACK_APPLY_BOTTOMUP, (int (*)(void *element, void *)) php_run_hook, r); -} - -/* {{{ handler_rec php_handlers[] - */ -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}, - {"php-script", php_response_handler}, - {NULL} -}; -/* }}} */ - -/* {{{ command_rec php_commands[] - */ -command_rec php_commands[] = -{ - {"php_value", php_apache_value_handler, NULL, OR_OPTIONS, TAKE2, "PHP Value Modifier"}, - {"phpUriHandler", php_set_uri_handler, NULL, RSRC_CONF, TAKE1, "PHP Value Modifier"}, - {"phpUriHandlerMethod", php_set_uri_handler_code, NULL, RSRC_CONF, TAKE1, "PHP Value Modifier"}, -#if MODULE_MAGIC_NUMBER >= 19970103 - {"phpHeaderHandler", php_set_header_handler, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, - {"phpHeaderHandlerMethod", php_set_header_handler_code, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, -#endif - {"phpAuthHandler", php_set_auth_handler, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, - {"phpAuthHandlerMethod", php_set_auth_handler_code, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, - {"phpAccessHandler", php_set_access_handler, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, - {"phpAccessHandlerMethod", php_set_access_handler_code, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, - {"phpTypeHandler", php_set_type_handler, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, - {"phpTypeHandlerMethod", php_set_type_handler_code, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, - {"phpFixupHandler", php_set_fixup_handler, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, - {"phpFixupHandlerMethod", php_set_fixup_handler_code, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, - {"phpLoggerHandler", php_set_logger_handler, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, - {"phpLoggerHandlerMethod", php_set_logger_handler_code, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, -#if MODULE_MAGIC_NUMBER >= 19970902 - {"phpPostReadHandler", php_set_post_read_handler, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, - {"phpPostReadHandlerMethod", php_set_post_read_handler_code, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, - {"phpRequire", php_set_require, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, - {"phpResponseHandler", php_set_response_handler, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, - {"phpResponseHandlerMethod", php_set_response_handler_code, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, -#endif - {"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 - */ -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 */ - php_create_server, /* per-server config creator */ - NULL, /* merge server config */ - php_commands, /* command table */ - php_handlers, /* handlers */ - php_uri_translation, /* filename translation */ - NULL, /* check_user_id */ - php_auth_hook, /* check auth */ - php_access_hook, /* check access */ - php_type_hook, /* type_checker */ - php_fixup_hook, /* fixups */ - php_logger_hook /* logger */ -#if MODULE_MAGIC_NUMBER >= 19970103 - , php_header_hook /* header parser */ -#endif -#if MODULE_MAGIC_NUMBER >= 19970719 - , NULL /* child_init */ -#endif -#if MODULE_MAGIC_NUMBER >= 19970728 - , php_child_exit_handler /* child_exit */ -#endif -#if MODULE_MAGIC_NUMBER >= 19970902 - , php_post_read_hook /* post read-request */ -#endif -}; -/* }}} */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/sapi/apache_hooks/mod_php4.exp b/sapi/apache_hooks/mod_php4.exp deleted file mode 100644 index 2dca1256c2..0000000000 --- a/sapi/apache_hooks/mod_php4.exp +++ /dev/null @@ -1 +0,0 @@ -php4_module diff --git a/sapi/apache_hooks/mod_php4.h b/sapi/apache_hooks/mod_php4.h deleted file mode 100644 index 5ca4dfcc01..0000000000 --- a/sapi/apache_hooks/mod_php4.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2004 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 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_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: Rasmus Lerdorf | - +----------------------------------------------------------------------+ - */ -/* $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; - long xbithack; - long terminate_child; - long setup_env; - long current_hook; - zend_bool in_request; - zend_bool apache_config_loaded; - zend_bool headers_sent; -} php_apache_info_struct; - -typedef struct _php_handler { - long type; - long stage; - char *name; -} php_handler; - -#define AP_HANDLER_TYPE_FILE 0 -#define AP_HANDLER_TYPE_METHOD 1 - -extern zend_module_entry apache_module_entry; - -#ifdef ZTS -extern int php_apache_info_id; -#define AP(v) TSRMG(php_apache_info_id, php_apache_info_struct *, v) -#else -extern php_apache_info_struct php_apache_info; -#define AP(v) (php_apache_info.v) -#endif - -/* defines for the various stages of the apache request */ -#define AP_WAITING_FOR_REQUEST 0 -#define AP_POST_READ 1 -#define AP_URI_TRANS 2 -#define AP_HEADER_PARSE 3 -#define AP_ACCESS_CONTROL 4 -#define AP_AUTHENTICATION 5 -#define AP_AUTHORIZATION 6 -#define AP_TYPE_CHECKING 7 -#define AP_FIXUP 8 -#define AP_RESPONSE 9 -#define AP_LOGGING 10 -#define AP_CLEANUP 11 - -#endif /* MOD_PHP4_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/sapi/apache_hooks/mod_php5.c b/sapi/apache_hooks/mod_php5.c new file mode 100644 index 0000000000..8551ad0dd8 --- /dev/null +++ b/sapi/apache_hooks/mod_php5.c @@ -0,0 +1,1474 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2004 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.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/3_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 | + | (with helpful hints from Dean Gaudet | + | PHP 4.0 patches by Zeev Suraski | + +----------------------------------------------------------------------+ + */ +/* $Id$ */ + +#include "php_apache_http.h" + +#ifdef NETWARE +#define SIGPIPE SIGINT +#endif + +#if defined(ZEND_MULTIBYTE) && defined(HAVE_MBSTRING) +#include "ext/mbstring/mbstring.h" +#endif /* defined(ZEND_MULTIBYTE) && defined(HAVE_MBSTRING) */ + +#undef shutdown + +/* {{{ Prototypes + */ +int apache_php_module_main(request_rec *r, int display_source_mode TSRMLS_DC); +static void php_save_umask(void); +static void php_restore_umask(void); +static int sapi_apache_read_post(char *buffer, uint count_bytes TSRMLS_DC); +static char *sapi_apache_read_cookies(TSRMLS_D); +static int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC); +static int sapi_apache_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC); +static int send_php(request_rec *r, int display_source_mode, char *filename); +static int send_parsed_php(request_rec * r); +static int send_parsed_php_source(request_rec * r); +static int php_xbithack_handler(request_rec * r); +static void php_init_handler(server_rec *s, pool *p); +/* }}} */ + +#if MODULE_MAGIC_NUMBER >= 19970728 +static void php_child_exit_handler(server_rec *s, pool *p); +#endif + +#if MODULE_MAGIC_NUMBER > 19961007 +#define CONST_PREFIX const +#else +#define CONST_PREFIX +#endif + + +typedef struct _sapi_stack { + int top, max, persistent; + void **elements; +} sapi_stack; + +typedef struct _php_per_dir_config { + HashTable *ini_settings; + sapi_stack headers_handlers; + sapi_stack auth_handlers; + sapi_stack access_handlers; + sapi_stack type_handlers; + sapi_stack fixup_handlers; + sapi_stack logger_handlers; + sapi_stack post_read_handlers; + sapi_stack response_handlers; +} php_per_dir_config; + +typedef struct _php_per_server_config { + sapi_stack uri_handlers; + sapi_stack requires; +} php_per_server_config; + + +static CONST_PREFIX char *php_apache_value_handler_ex(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2, int mode); +static CONST_PREFIX char *php_apache_value_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2); +static CONST_PREFIX char *php_apache_admin_value_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2); +static CONST_PREFIX char *php_apache_flag_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2); +static CONST_PREFIX char *php_apache_flag_handler_ex(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2, int mode); +static CONST_PREFIX char *php_apache_admin_flag_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2); + +/* ### these should be defined in mod_php5.h or somewhere else */ +#define USE_PATH 1 +#define IGNORE_URL 2 + +module MODULE_VAR_EXPORT php5_module; + +int saved_umask; +//static int setup_env = 0; +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; + +/* some systems are missing these from their header files */ + +/* {{{ zend stack utility functions + */ + +/* This code is ripped part and parcel from zend_stack.[ch]. Assuming that the + patch supporting zend_stack_init_ex is applied, all but the bottom two + module-specific iterators will be removed + */ + +int sapi_stack_init_ex(sapi_stack *stack, int persistent) +{ + stack->top = 0; + stack->persistent = persistent; + stack->elements = (void **) pemalloc(sizeof(void **) * STACK_BLOCK_SIZE, persistent); + if (!stack->elements) { + return FAILURE; + } else { + stack->max = STACK_BLOCK_SIZE; + return SUCCESS; + } +} +int sapi_stack_push(sapi_stack *stack, void *element) +{ + if (stack->top >= stack->max) { /* we need to allocate more memory */ + stack->elements = (void **) perealloc(stack->elements, + (sizeof(void **) * (stack->max += STACK_BLOCK_SIZE)), stack->persistent); + if (!stack->elements) { + return FAILURE; + } + } + stack->elements[stack->top] = (void *) element; + return stack->top++; +} +void* sapi_stack_pop(sapi_stack *stack) { + if(stack->top == 0) { + return NULL; + } + else { + return stack->elements[--stack->top]; + } +} + +int sapi_stack_destroy(sapi_stack *stack) +{ + return SUCCESS; +} + +int sapi_stack_apply_with_argument_all(sapi_stack *stack, int type, int (*apply_function)(void *element, void *arg), void *arg) +{ + int i, retval; + + switch (type) { + case ZEND_STACK_APPLY_TOPDOWN: + for (i=stack->top-1; i>=0; i--) { + retval = apply_function(stack->elements[i], arg); + } + break; + case ZEND_STACK_APPLY_BOTTOMUP: + for (i=0; itop; i++) { + retval = apply_function(stack->elements[i], arg); + } + break; + } + return retval; +} + + +int sapi_stack_apply_with_argument_stop_if_equals(sapi_stack *stack, int type, int (*apply_function)(void *element, void *arg), void *arg, int stopval) +{ + int i; + int ret = DECLINED; + switch (type) { + case ZEND_STACK_APPLY_TOPDOWN: + for (i=stack->top-1; i>=0; i--) { + if ((ret = apply_function(stack->elements[i], arg)) == stopval) { + break; + } + } + break; + case ZEND_STACK_APPLY_BOTTOMUP: + for (i=0; itop; i++) { + if ((ret = apply_function(stack->elements[i], arg)) == stopval) { + break; + } + } + break; + } + return ret; +} + +int sapi_stack_apply_with_argument_stop_if_http_error(sapi_stack *stack, int type, int (*apply_function)(void *element, void *arg), void *arg) +{ + int i; + int ret = DECLINED; + switch (type) { + case ZEND_STACK_APPLY_TOPDOWN: + for (i=stack->top-1; i>=0; i--) { + if ((ret = apply_function(stack->elements[i], arg)) > 0) { + break; + } + } + break; + case ZEND_STACK_APPLY_BOTTOMUP: + for (i=0; itop; i++) { + if ((ret = apply_function(stack->elements[i], arg)) > 0) { + break; + } + } + break; + } + return ret; +} + +void php_handler_stack_destroy(sapi_stack *stack) +{ + php_handler *ph; + while((ph = (php_handler *)sapi_stack_pop(stack)) != NULL) { + free(ph->name); + free(ph); + } +} +/* }}} */ + +/* {{{ php_save_umask + */ +static void php_save_umask(void) +{ + saved_umask = umask(077); + umask(saved_umask); +} +/* }}} */ + +/* {{{ sapi_apache_ub_write + */ +static int sapi_apache_ub_write(const char *str, uint str_length TSRMLS_DC) +{ + int ret=0; + + if (SG(server_context)) { + ret = rwrite(str, str_length, (request_rec *) SG(server_context)); + } + if (ret != str_length) { + php_handle_aborted_connection(); + } + return ret; +} +/* }}} */ + +/* {{{ sapi_apache_flush + */ +static void sapi_apache_flush(void *server_context) +{ + if (server_context) { +#if MODULE_MAGIC_NUMBER > 19970110 + rflush((request_rec *) server_context); +#else + bflush((request_rec *) server_context->connection->client); +#endif + } +} +/* }}} */ + +/* {{{ sapi_apache_read_post + */ +static int sapi_apache_read_post(char *buffer, uint count_bytes TSRMLS_DC) +{ + uint total_read_bytes=0, read_bytes; + request_rec *r = (request_rec *) SG(server_context); + void (*handler)(int); + + /* + * This handles the situation where the browser sends a Expect: 100-continue header + * and needs to recieve confirmation from the server on whether or not it can send + * the rest of the request. RFC 2616 + * + */ + if (!SG(read_post_bytes) && !ap_should_client_block(r)) { + return total_read_bytes; + } + + handler = signal(SIGPIPE, SIG_IGN); + while (total_read_bytessubprocess_env, "HTTP_COOKIE"); +} +/* }}} */ + +/* {{{ sapi_apache_header_handler + */ +static int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_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) { + efree(sapi_header->header); + 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 */ +} +/* }}} */ + +/* {{{ sapi_apache_send_headers + */ +static int sapi_apache_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) +{ + if(SG(server_context) == NULL) { /* server_context is not here anymore */ + return SAPI_HEADER_SEND_FAILED; + } + + ((request_rec *) SG(server_context))->status = SG(sapi_headers).http_response_code; + /* check that we haven't sent headers already, we use our own + * headers_sent since we may send headers at anytime + */ + if(!AP(headers_sent)) { + send_http_header((request_rec *) SG(server_context)); + AP(headers_sent) = 1; + } + return SAPI_HEADER_SENT_SUCCESSFULLY; +} +/* }}} */ + +/* {{{ sapi_apache_register_server_variables + */ +static void sapi_apache_register_server_variables(zval *track_vars_array TSRMLS_DC) +{ + register int i; + array_header *arr = table_elts(((request_rec *) SG(server_context))->subprocess_env); + table_entry *elts = (table_entry *) arr->elts; + zval **path_translated; + HashTable *symbol_table; + + for (i = 0; i < arr->nelts; i++) { + char *val; + + if (elts[i].val) { + val = elts[i].val; + } else { + val = empty_string; + } + php_register_variable(elts[i].key, val, track_vars_array TSRMLS_CC); + } + + /* If PATH_TRANSLATED doesn't exist, copy it from SCRIPT_FILENAME */ + if (track_vars_array) { + symbol_table = track_vars_array->value.ht; + } else if (PG(register_globals)) { + /* should never happen nowadays */ + symbol_table = EG(active_symbol_table); + } else { + symbol_table = NULL; + } + if (symbol_table + && !zend_hash_exists(symbol_table, "PATH_TRANSLATED", sizeof("PATH_TRANSLATED")) + && zend_hash_find(symbol_table, "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME"), (void **) &path_translated)==SUCCESS) { + php_register_variable("PATH_TRANSLATED", Z_STRVAL_PP(path_translated), track_vars_array TSRMLS_CC); + } + + php_register_variable("PHP_SELF", ((request_rec *) SG(server_context))->uri, track_vars_array TSRMLS_CC); +} +/* }}} */ + +/* {{{ php_apache_startup + */ +static int php_apache_startup(sapi_module_struct *sapi_module) +{ + if (php_module_startup(sapi_module, &apache_module_entry, 1) == FAILURE) { + return FAILURE; + } else { + return SUCCESS; + } +} +/* }}} */ + +/* {{{ php_apache_log_message + */ +static void php_apache_log_message(char *message) +{ + TSRMLS_FETCH(); + + if (SG(server_context)) { +#if MODULE_MAGIC_NUMBER >= 19970831 + aplog_error(NULL, 0, APLOG_ERR | APLOG_NOERRNO, ((request_rec *) SG(server_context))->server, "%s", message); +#else + log_error(message, ((request_rec *) SG(server_context))->server); +#endif + } else { + fprintf(stderr, "%s", message); + fprintf(stderr, "\n"); + } +} +/* }}} */ + +/* {{{ php_apache_request_shutdown + */ +static void php_apache_request_shutdown(void *dummy) +{ + TSRMLS_FETCH(); + AP(current_hook) = AP_CLEANUP; + php_output_set_status(0 TSRMLS_CC); + SG(server_context) = NULL; /* The server context (request) is invalid by the time run_cleanups() is called */ + if(SG(sapi_started)) { + php_request_shutdown(dummy); + SG(sapi_started) = 0; + } + AP(in_request) = 0; + if(AP(setup_env)) { + AP(setup_env) = 0; + } + AP(current_hook) = AP_WAITING_FOR_REQUEST; + AP(headers_sent) = 0; +} +/* }}} */ + +/* {{{ php_apache_sapi_activate + */ +static int php_apache_sapi_activate(TSRMLS_D) +{ + request_rec *r = (request_rec *) SG(server_context); + + /* + * For the Apache module version, this bit of code registers a cleanup + * function that gets triggered when our request pool is destroyed. + * We need this because at any point in our code we can be interrupted + * and that may happen before we have had time to free our memory. + * The php_request_shutdown function needs to free all outstanding allocated + * memory. + */ + block_alarms(); + register_cleanup(r->pool, NULL, php_apache_request_shutdown, php_request_shutdown_for_exec); + AP(in_request)=1; + unblock_alarms(); + + /* Override the default headers_only value - sometimes "GET" requests should actually only + * send headers. + */ + SG(request_info).headers_only = r->header_only; + return SUCCESS; +} +/* }}} */ + +/* {{{ php_apache_get_stat + */ +static struct stat *php_apache_get_stat(TSRMLS_D) +{ + return &((request_rec *) SG(server_context))->finfo; +} +/* }}} */ + +/* {{{ php_apache_getenv + */ +static char *php_apache_getenv(char *name, size_t name_len TSRMLS_DC) +{ + return (char *) table_get(((request_rec *) SG(server_context))->subprocess_env, name); +} +/* }}} */ + +/* {{{ sapi_module_struct apache_sapi_module + */ +static sapi_module_struct apache_sapi_module = { + "apache", /* name */ + "Apache", /* pretty name */ + + php_apache_startup, /* startup */ + php_module_shutdown_wrapper, /* shutdown */ + + php_apache_sapi_activate, /* activate */ + NULL, /* deactivate */ + + sapi_apache_ub_write, /* unbuffered write */ + sapi_apache_flush, /* flush */ + php_apache_get_stat, /* get uid */ + php_apache_getenv, /* getenv */ + + 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 */ + + sapi_apache_register_server_variables, /* register server variables */ + php_apache_log_message, /* Log message */ + + NULL, /* php.ini path override */ + +#ifdef PHP_WIN32 + NULL, + NULL, +#else + block_alarms, /* Block interruptions */ + unblock_alarms, /* Unblock interruptions */ +#endif + + NULL, /* default post reader */ + NULL, /* treat data */ + NULL, /* exe location */ + 0, /* ini ignore */ + NULL + +}; +/* }}} */ + +/* {{{ php_restore_umask + */ +static void php_restore_umask(void) +{ + umask(saved_umask); +} +/* }}} */ + +/* {{{ init_request_info + */ +static void init_request_info(TSRMLS_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); + SG(sapi_headers).http_response_code = r->status; + + if (r->headers_in) { + authorization = table_get(r->headers_in, "Authorization"); + } + if (authorization + && !auth_type(r) + && !strcasecmp(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) { + r->connection->user = pstrdup(r->connection->pool, SG(request_info).auth_user); + r->connection->ap_auth_type = "Basic"; + 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; + } +} +/* }}} */ + +/* {{{ php_apache_alter_ini_entries + */ +static int php_apache_alter_ini_entries(php_per_dir_entry *per_dir_entry TSRMLS_DC) +{ + zend_alter_ini_entry(per_dir_entry->key, per_dir_entry->key_length+1, per_dir_entry->value, per_dir_entry->value_length, per_dir_entry->type, PHP_INI_STAGE_ACTIVATE); + return 0; +} +/* }}} */ + +/* {{{ php_apache_get_default_mimetype + */ +static char *php_apache_get_default_mimetype(request_rec *r TSRMLS_DC) +{ + + char *mimetype; + if (SG(default_mimetype) || SG(default_charset)) { + /* Assume output will be of the default MIME type. Individual + scripts may change this later. */ + char *tmpmimetype; + tmpmimetype = sapi_get_default_content_type(TSRMLS_C); + mimetype = pstrdup(r->pool, tmpmimetype); + efree(tmpmimetype); + } else { + mimetype = SAPI_DEFAULT_MIMETYPE "; charset=" SAPI_DEFAULT_CHARSET; + } + return mimetype; +} +/* }}} */ + +/* {{{ send_php + */ +static int send_php(request_rec *r, int display_source_mode, char *filename) +{ + int retval; + php_per_dir_config *per_dir_conf; + TSRMLS_FETCH(); + if (AP(in_request)) { + zend_file_handle fh; + + fh.filename = r->filename; + fh.opened_path = NULL; + fh.free_filename = 0; + fh.type = ZEND_HANDLE_FILENAME; + +#if defined(ZEND_MULTIBYTE) && defined(HAVE_MBSTRING) + php_mbstring_set_zend_encoding(TSRMLS_C); +#endif /* defined(ZEND_MULTIBYTE) && defined(HAVE_MBSTRING) */ + + zend_execute_scripts(ZEND_INCLUDE TSRMLS_CC, NULL, 1, &fh); + return OK; + } + + zend_first_try { + + /* Make sure file exists */ + if (filename == NULL && r->finfo.st_mode == 0) { + return DECLINED; + } + + per_dir_conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module); + if (per_dir_conf) { + zend_hash_apply((HashTable *) per_dir_conf->ini_settings, (apply_func_t) php_apache_alter_ini_entries TSRMLS_CC); + } + + /* If PHP parser engine has been turned off with an "engine off" + * directive, then decline to handle this request + */ + if (!AP(engine)) { + r->content_type = php_apache_get_default_mimetype(r TSRMLS_CC); + r->allowed |= (1 << METHODS) - 1; + zend_try { + zend_ini_deactivate(TSRMLS_C); + } zend_end_try(); + return DECLINED; + } + if (filename == NULL) { + filename = r->filename; + } + + /* 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))) { + zend_try { + zend_ini_deactivate(TSRMLS_C); + } zend_end_try(); + return retval; + } +#endif + + if (AP(last_modified)) { +#if MODULE_MAGIC_NUMBER < 19970912 + if ((retval = set_last_modified(r, r->finfo.st_mtime))) { + zend_try { + zend_ini_deactivate(TSRMLS_C); + } zend_end_try(); + return retval; + } +#else + update_mtime (r, r->finfo.st_mtime); + set_last_modified(r); + set_etag(r); +#endif + } + /* Assume output will be of the default MIME type. Individual + scripts may change this later in the request. */ + r->content_type = php_apache_get_default_mimetype(r TSRMLS_CC); + + /* Init timeout */ + hard_timeout("send", r); + + SG(server_context) = r; + + php_save_umask(); + if(!AP(setup_env)) { + AP(setup_env) = 1; + add_common_vars(r); + add_cgi_vars(r); + } + init_request_info(TSRMLS_C); + apache_php_module_main(r, display_source_mode TSRMLS_CC); + + /* Done, restore umask, turn off timeout, close file and return */ + php_restore_umask(); + kill_timeout(r); + } zend_end_try(); + + return OK; +} +/* }}} */ + +/* {{{ send_parsed_php + */ +static int send_parsed_php(request_rec * r) +{ + int result = send_php(r, 0, NULL); + +#if MEMORY_LIMIT + { + char *mem_usage; + TSRMLS_FETCH(); + + mem_usage = ap_psprintf(r->pool, "%u", AG(allocated_memory_peak)); + AG(allocated_memory_peak) = 0; + ap_table_setn(r->notes, "mod_php_memory_usage", mem_usage); + } +#endif + + return result; +} +/* }}} */ + +/* {{{ send_parsed_php_source + */ +static int send_parsed_php_source(request_rec * r) +{ + return send_php(r, 1, NULL); +} +/* }}} */ + + +/* {{{ destroy_per_dir_entry + */ +static void destroy_per_dir_entry(php_per_dir_entry *per_dir_entry) +{ + free(per_dir_entry->key); + free(per_dir_entry->value); +} +/* }}} */ + +/* {{{ copy_per_dir_entry + */ +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; +} +/* }}} */ + +/* {{{ should_overwrite_per_dir_entry; + + */ +static zend_bool should_overwrite_per_dir_entry(HashTable *target_ht, php_per_dir_entry *orig_per_dir_entry, zend_hash_key *hash_key, void *pData) +{ + php_per_dir_entry *new_per_dir_entry; + + if (zend_hash_find(target_ht, hash_key->arKey, hash_key->nKeyLength, (void **) &new_per_dir_entry)==FAILURE) { + return 1; /* does not exist in dest, copy from source */ + } + + if (new_per_dir_entry->type==PHP_INI_SYSTEM + && orig_per_dir_entry->type!=PHP_INI_SYSTEM) { + return 1; + } else { + return 0; + } +} +/* }}} */ +/* {{{ php_destroy_per_server_info + */ +static void php_destroy_per_server_info(php_per_server_config *conf) +{ + php_handler_stack_destroy(&conf->requires); + php_handler_stack_destroy(&conf->uri_handlers); +} +/* }}} */ + +/* {{{ php_destroy_per_dir_info + */ +static void php_destroy_per_dir_info(php_per_dir_config *conf) +{ + zend_hash_destroy(conf->ini_settings); + php_handler_stack_destroy(&conf->response_handlers); + php_handler_stack_destroy(&conf->auth_handlers); + php_handler_stack_destroy(&conf->access_handlers); + php_handler_stack_destroy(&conf->type_handlers); + php_handler_stack_destroy(&conf->fixup_handlers); + php_handler_stack_destroy(&conf->logger_handlers); + php_handler_stack_destroy(&conf->post_read_handlers); + php_handler_stack_destroy(&conf->headers_handlers); + free(conf->ini_settings); +} +/* }}} */ + +/* {{{ php_create_server + */ +static void *php_create_server(pool *p, char *dummy) +{ + php_per_server_config *conf; + conf = (php_per_server_config *) malloc(sizeof(php_per_server_config)); + register_cleanup(p, (void *) conf, (void (*)(void *)) php_destroy_per_server_info, (void (*)(void *)) php_destroy_per_server_info); + + sapi_stack_init_ex(&conf->requires, 1); + sapi_stack_init_ex(&conf->uri_handlers, 1); + return conf; +} + +/* }}} */ + + +/* {{{ php_create_dir + */ +static void *php_create_dir(pool *p, char *dummy) +{ + php_per_dir_config *conf; + conf = (php_per_dir_config *) malloc(sizeof(php_per_dir_config)); + conf->ini_settings = (HashTable *) malloc(sizeof(HashTable)); + zend_hash_init_ex(conf->ini_settings, 5, NULL, (void (*)(void *)) destroy_per_dir_entry, 1, 0); + sapi_stack_init_ex(&conf->response_handlers, 1); + sapi_stack_init_ex(&conf->headers_handlers, 1); + sapi_stack_init_ex(&conf->auth_handlers, 1); + sapi_stack_init_ex(&conf->access_handlers, 1); + sapi_stack_init_ex(&conf->type_handlers, 1); + sapi_stack_init_ex(&conf->fixup_handlers, 1); + sapi_stack_init_ex(&conf->logger_handlers, 1); + sapi_stack_init_ex(&conf->post_read_handlers, 1); + register_cleanup(p, (void *) conf, (void (*)(void *)) php_destroy_per_dir_info, (void (*)(void *)) php_destroy_per_dir_info); + + return conf; +} + +/* }}} */ + +/* {{{ php_merge_dir + */ +static void *php_merge_dir(pool *p, void *basev, void *addv) +{ + php_per_dir_config *a = (php_per_dir_config *) addv; + php_per_dir_config *b = (php_per_dir_config *) basev; + /* This function *must* return addv, and not modify basev */ + zend_hash_merge_ex((HashTable *) a->ini_settings, (HashTable *) b->ini_settings, (copy_ctor_func_t) copy_per_dir_entry, sizeof(php_per_dir_entry), (merge_checker_func_t) should_overwrite_per_dir_entry, NULL); + a->headers_handlers = (a->headers_handlers.top)?a->headers_handlers:b->headers_handlers; + a->auth_handlers = (a->auth_handlers.top)?a->auth_handlers:b->auth_handlers; + a->access_handlers = (a->access_handlers.top)?a->access_handlers:b->access_handlers; + a->type_handlers = (a->type_handlers.top)?a->type_handlers:b->type_handlers; + a->fixup_handlers = (a->fixup_handlers.top)?a->fixup_handlers:b->fixup_handlers; + a->logger_handlers = (a->logger_handlers.top)?a->logger_handlers:b->logger_handlers; + a->post_read_handlers = (a->post_read_handlers.top)?a->post_read_handlers:b->post_read_handlers; + a->response_handlers = (a->response_handlers.top)?a->response_handlers:b->response_handlers; + return a; +} +/* }}} */ + +/* {{{ php_apache_value_handler_ex + */ +static 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) { + apache_php_initialized = 1; +#ifdef ZTS + tsrm_startup(1, 1, 0, NULL); +#endif + sapi_startup(&apache_sapi_module); + php_apache_startup(&apache_sapi_module); + } + per_dir_entry.type = mode; + + if (strcasecmp(arg2, "none") == 0) { + arg2 = ""; + } + + 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(conf, per_dir_entry.key, per_dir_entry.key_length, &per_dir_entry, sizeof(php_per_dir_entry), NULL); + return NULL; +} +/* }}} */ + +static CONST_PREFIX char *php_set_server_handler(server_rec *s, char *arg1, long handler_stage, long handler_type) +{ + php_per_server_config *conf; + php_handler *handler; + handler = (php_handler *) malloc(sizeof(php_handler)); + handler->type = handler_type; + handler->stage = handler_stage; + handler->name = strdup(arg1); + conf = get_module_config(s->module_config, &php5_module); + switch(handler_stage) { + case AP_URI_TRANS: + sapi_stack_push(&conf->uri_handlers, handler); + break; + default: + sapi_stack_push(&conf->requires, handler); + break; + } + return NULL; +} + +static CONST_PREFIX char *php_set_dir_handler(php_per_dir_config *conf, char *arg1, long handler_stage, long handler_type) +{ + php_handler *handler; + handler = (php_handler *) malloc(sizeof(php_handler)); + handler->type = handler_type; + handler->stage = handler_stage; + handler->name = strdup(arg1); + switch(handler_stage) { + case AP_POST_READ: + sapi_stack_push(&conf->post_read_handlers, handler); + break; + case AP_HEADER_PARSE: + sapi_stack_push(&conf->headers_handlers, handler); + break; + case AP_ACCESS_CONTROL: + sapi_stack_push(&conf->access_handlers, handler); + break; + case AP_AUTHENTICATION: + sapi_stack_push(&conf->auth_handlers, handler); + break; + case AP_AUTHORIZATION: + break; + case AP_TYPE_CHECKING: + sapi_stack_push(&conf->type_handlers, handler); + break; + case AP_FIXUP: + sapi_stack_push(&conf->fixup_handlers, handler); + break; + case AP_RESPONSE: + sapi_stack_push(&conf->response_handlers, handler); + break; + case AP_LOGGING: + sapi_stack_push(&conf->logger_handlers, handler); + break; + default: + break; + } + return NULL; +} + +/* {{{ php_set_uri_handler + */ +static CONST_PREFIX char *php_set_uri_handler(cmd_parms *cmd, void *dummy, char *arg1) +{ + return php_set_server_handler(cmd->server, arg1, AP_URI_TRANS, AP_HANDLER_TYPE_FILE); +} +/* }}} */ + +/* {{{ php_set_uri_handler_code */ +static CONST_PREFIX char *php_set_uri_handler_code(cmd_parms *cmd, void *dummy, char *arg1) +{ + return php_set_server_handler(cmd->server, arg1, AP_URI_TRANS, AP_HANDLER_TYPE_METHOD); +} +/* }}} */ + +/* {{{ php_set_header_handler + */ +static CONST_PREFIX char *php_set_header_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) +{ + return php_set_dir_handler(conf, arg1, AP_HEADER_PARSE, AP_HANDLER_TYPE_FILE); +} +static CONST_PREFIX char *php_set_header_handler_code(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) +{ + return php_set_dir_handler(conf, arg1, AP_HEADER_PARSE, AP_HANDLER_TYPE_METHOD); +} +/* }}} */ + +/* {{{ php_set_auth_handler + */ +static CONST_PREFIX char *php_set_auth_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) +{ + return php_set_dir_handler(conf, arg1, AP_AUTHENTICATION, AP_HANDLER_TYPE_FILE); +} +static CONST_PREFIX char *php_set_auth_handler_code(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) +{ + return php_set_dir_handler(conf, arg1, AP_AUTHENTICATION, AP_HANDLER_TYPE_METHOD); +} + +/* }}} */ + +/* {{{ php_set_access_handler + */ +static CONST_PREFIX char *php_set_access_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) +{ + return php_set_dir_handler(conf, arg1, AP_ACCESS_CONTROL, AP_HANDLER_TYPE_FILE); +} +static CONST_PREFIX char *php_set_access_handler_code(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) +{ + return php_set_dir_handler(conf, arg1, AP_ACCESS_CONTROL, AP_HANDLER_TYPE_METHOD); +} + +/* }}} */ + +/* {{{ php_set_type_handler + */ +static CONST_PREFIX char *php_set_type_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) +{ + return php_set_dir_handler(conf, arg1, AP_TYPE_CHECKING, AP_HANDLER_TYPE_FILE); +} +static CONST_PREFIX char *php_set_type_handler_code(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) +{ + return php_set_dir_handler(conf, arg1, AP_TYPE_CHECKING, AP_HANDLER_TYPE_METHOD); +} + +/* }}} */ + +/* {{{ php_set_fixup_handler + */ +static CONST_PREFIX char *php_set_fixup_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) +{ + return php_set_dir_handler(conf, arg1, AP_FIXUP, AP_HANDLER_TYPE_FILE); +} +static CONST_PREFIX char *php_set_fixup_handler_code(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) +{ + return php_set_dir_handler(conf, arg1, AP_FIXUP, AP_HANDLER_TYPE_METHOD); +} +/* }}} */ + +/* {{{ php_set_logger_handler + */ +static CONST_PREFIX char *php_set_logger_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) +{ + return php_set_dir_handler(conf, arg1, AP_LOGGING, AP_HANDLER_TYPE_FILE); +} +static CONST_PREFIX char *php_set_logger_handler_code(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) +{ + return php_set_dir_handler(conf, arg1, AP_LOGGING, AP_HANDLER_TYPE_METHOD); +} + +/* }}} */ + +/* {{{ php_set_post_read_handler + */ +static CONST_PREFIX char *php_set_post_read_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) +{ + return php_set_dir_handler(conf, arg1, AP_POST_READ, AP_HANDLER_TYPE_FILE); +} +static CONST_PREFIX char *php_set_post_read_handler_code(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) +{ + return php_set_dir_handler(conf, arg1, AP_POST_READ, AP_HANDLER_TYPE_METHOD); +} + + +/* }}} */ + +/* {{{ php_set_require + */ + +static CONST_PREFIX char *php_set_require(cmd_parms *cmd, void *dummy, char *arg1) +{ + return php_set_server_handler(cmd->server, arg1, 0, AP_HANDLER_TYPE_FILE); +} +/* }}} */ + +/* {{{ php_set_response_handler + */ +static CONST_PREFIX char *php_set_response_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) +{ + return php_set_dir_handler(conf, arg1, AP_RESPONSE, AP_HANDLER_TYPE_FILE); +} +static CONST_PREFIX char *php_set_response_handler_code(cmd_parms *cmd, php_per_dir_config *conf, char *arg1) +{ + return php_set_dir_handler(conf, arg1, AP_RESPONSE, AP_HANDLER_TYPE_METHOD); +} +/* }}} */ + +/* {{{ php_apache_value_handler + */ +static CONST_PREFIX char *php_apache_value_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2) +{ + return php_apache_value_handler_ex(cmd, conf->ini_settings, arg1, arg2, PHP_INI_PERDIR); +} +/* }}} */ + +/* {{{ php_apache_admin_value_handler + */ +static CONST_PREFIX char *php_apache_admin_value_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2) +{ + return php_apache_value_handler_ex(cmd, conf->ini_settings, arg1, arg2, PHP_INI_SYSTEM); +} +/* }}} */ + +/* {{{ php_apache_flag_handler_ex + */ +static 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); +} +/* }}} */ + +/* {{{ php_apache_flag_handler + */ +static CONST_PREFIX char *php_apache_flag_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2) +{ + return php_apache_flag_handler_ex(cmd, conf->ini_settings, arg1, arg2, PHP_INI_PERDIR); +} +/* }}} */ + +/* {{{ php_apache_admin_flag_handler + */ +static CONST_PREFIX char *php_apache_admin_flag_handler(cmd_parms *cmd, php_per_dir_config *conf, char *arg1, char *arg2) +{ + return php_apache_flag_handler_ex(cmd, conf->ini_settings, arg1, arg2, PHP_INI_SYSTEM); +} +/* }}} */ + +/* {{{ int php_xbithack_handler(request_rec * r) + */ +static int php_xbithack_handler(request_rec * r) +{ + php_per_dir_config *conf; + TSRMLS_FETCH(); + + if (!(r->finfo.st_mode & S_IXUSR)) { + r->allowed |= (1 << METHODS) - 1; + return DECLINED; + } + conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module); + if (conf) { + zend_hash_apply((HashTable *) conf->ini_settings, (apply_func_t) php_apache_alter_ini_entries TSRMLS_CC); + } + if(!AP(xbithack)) { + r->allowed |= (1 << METHODS) - 1; + return DECLINED; + } + return send_parsed_php(r); +} +/* }}} */ + +/* {{{ apache_php_module_shutdown_wrapper + */ +static void apache_php_module_shutdown_wrapper(void) +{ + apache_php_initialized = 0; + apache_sapi_module.shutdown(&apache_sapi_module); + +#if MODULE_MAGIC_NUMBER >= 19970728 + /* This function is only called on server exit if the apache API + * child_exit handler exists, so shutdown globally + */ + sapi_shutdown(); +#endif + +#ifdef ZTS + tsrm_shutdown(); +#endif +} +/* }}} */ + +#if MODULE_MAGIC_NUMBER >= 19970728 +/* {{{ php_child_exit_handler + */ +static void php_child_exit_handler(server_rec *s, pool *p) +{ +/* apache_php_initialized = 0; */ + apache_sapi_module.shutdown(&apache_sapi_module); + +#ifdef ZTS + tsrm_shutdown(); +#endif +} +/* }}} */ +#endif + +/* {{{ void php_init_handler(server_rec *s, pool *p) + */ +static 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) { + apache_php_initialized = 1; +#ifdef ZTS + tsrm_startup(1, 1, 0, NULL); +#endif + sapi_startup(&apache_sapi_module); + php_apache_startup(&apache_sapi_module); + } +#if MODULE_MAGIC_NUMBER >= 19980527 + { + TSRMLS_FETCH(); + if (PG(expose_php)) { + ap_add_version_component("PHP/" PHP_VERSION); + } + } +#endif +} +/* }}} */ + +static int php_run_hook(php_handler *handler, request_rec *r) +{ + zval *ret = NULL; + php_per_dir_config *conf; + + TSRMLS_FETCH(); + + if(!AP(apache_config_loaded)) { + conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module); + if (conf) + zend_hash_apply((HashTable *)conf->ini_settings, (apply_func_t) php_apache_alter_ini_entries TSRMLS_CC); + AP(apache_config_loaded) = 1; + } + if (!handler->name) { + return DECLINED; + } + php_save_umask(); + if (!AP(setup_env)) { + AP(setup_env) = 1; + add_common_vars(r); + add_cgi_vars(r); + } + SG(server_context) = r; + init_request_info(TSRMLS_C); + apache_php_module_hook(r, handler, &ret TSRMLS_CC); + php_restore_umask(); + kill_timeout(r); + if (ret) { + convert_to_long(ret); + return Z_LVAL_P(ret); + } + return HTTP_INTERNAL_SERVER_ERROR; +} + + +static int php_uri_translation(request_rec *r) +{ + php_per_server_config *conf; + TSRMLS_FETCH(); + AP(current_hook) = AP_URI_TRANS; + conf = (php_per_server_config *) get_module_config(r->server->module_config, &php5_module); + return sapi_stack_apply_with_argument_stop_if_equals(&conf->uri_handlers, + ZEND_STACK_APPLY_BOTTOMUP, + (int (*)(void *element, void *)) php_run_hook, r, OK); +} + +static int php_header_hook(request_rec *r) +{ + php_per_dir_config *conf; + TSRMLS_FETCH(); + AP(current_hook) = AP_HEADER_PARSE; + conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module); + return sapi_stack_apply_with_argument_stop_if_http_error(&conf->headers_handlers, + ZEND_STACK_APPLY_BOTTOMUP, + (int (*)(void *element, void *)) php_run_hook, r); +} + +static int php_auth_hook(request_rec *r) +{ + php_per_dir_config *conf; + TSRMLS_FETCH(); + AP(current_hook) = AP_AUTHENTICATION; + conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module); + return sapi_stack_apply_with_argument_stop_if_equals(&conf->auth_handlers, + ZEND_STACK_APPLY_BOTTOMUP, + (int (*)(void *element, void *)) php_run_hook, r, OK); +} + +static int php_access_hook(request_rec *r) +{ + php_per_dir_config *conf; + int status = DECLINED; + TSRMLS_FETCH(); + AP(current_hook) = AP_ACCESS_CONTROL; + conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module); + status = sapi_stack_apply_with_argument_stop_if_http_error(&conf->access_handlers, + ZEND_STACK_APPLY_BOTTOMUP, + (int (*)(void *element, void *)) php_run_hook, r); + return status; + +} + +static int php_type_hook(request_rec *r) +{ + php_per_dir_config *conf; + TSRMLS_FETCH(); + AP(current_hook) = AP_TYPE_CHECKING; + conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module); + return sapi_stack_apply_with_argument_stop_if_equals(&conf->type_handlers, + ZEND_STACK_APPLY_BOTTOMUP, + (int (*)(void *element, void *)) php_run_hook, + r, OK); +} + +static int php_fixup_hook(request_rec *r) +{ + php_per_dir_config *conf; + TSRMLS_FETCH(); + AP(current_hook) = AP_FIXUP; + conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module); + return sapi_stack_apply_with_argument_stop_if_http_error(&conf->fixup_handlers, + ZEND_STACK_APPLY_BOTTOMUP, + (int (*)(void *element, void *)) php_run_hook, + r); +} + +static int php_logger_hook(request_rec *r) +{ + php_per_dir_config *conf; + TSRMLS_FETCH(); + AP(current_hook) = AP_LOGGING; + conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module); + return sapi_stack_apply_with_argument_stop_if_http_error(&conf->logger_handlers, + ZEND_STACK_APPLY_BOTTOMUP, + (int (*)(void *element, void *)) php_run_hook, + r); +} + +static int php_post_read_hook(request_rec *r) +{ + php_per_dir_config *conf; + php_per_server_config *svr; + TSRMLS_FETCH(); + AP(current_hook) = AP_POST_READ; + svr = get_module_config(r->server->module_config, &php5_module); + if(ap_is_initial_req(r)) { + sapi_stack_apply_with_argument_all(&svr->requires, ZEND_STACK_APPLY_BOTTOMUP, (int (*)(void *element, void *)) php_run_hook, r); + } + conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module); + return sapi_stack_apply_with_argument_stop_if_http_error(&conf->post_read_handlers, + ZEND_STACK_APPLY_BOTTOMUP, + (int (*)(void *element, void *)) php_run_hook, r); +} + +static int php_response_handler(request_rec *r) +{ + php_per_dir_config *conf; + TSRMLS_FETCH(); + AP(current_hook) = AP_RESPONSE; + conf = (php_per_dir_config *) get_module_config(r->per_dir_config, &php5_module); + return sapi_stack_apply_with_argument_all(&conf->response_handlers, ZEND_STACK_APPLY_BOTTOMUP, (int (*)(void *element, void *)) php_run_hook, r); +} + +/* {{{ handler_rec php_handlers[] + */ +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}, + {"php-script", php_response_handler}, + {NULL} +}; +/* }}} */ + +/* {{{ command_rec php_commands[] + */ +command_rec php_commands[] = +{ + {"php_value", php_apache_value_handler, NULL, OR_OPTIONS, TAKE2, "PHP Value Modifier"}, + {"phpUriHandler", php_set_uri_handler, NULL, RSRC_CONF, TAKE1, "PHP Value Modifier"}, + {"phpUriHandlerMethod", php_set_uri_handler_code, NULL, RSRC_CONF, TAKE1, "PHP Value Modifier"}, +#if MODULE_MAGIC_NUMBER >= 19970103 + {"phpHeaderHandler", php_set_header_handler, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, + {"phpHeaderHandlerMethod", php_set_header_handler_code, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, +#endif + {"phpAuthHandler", php_set_auth_handler, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, + {"phpAuthHandlerMethod", php_set_auth_handler_code, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, + {"phpAccessHandler", php_set_access_handler, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, + {"phpAccessHandlerMethod", php_set_access_handler_code, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, + {"phpTypeHandler", php_set_type_handler, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, + {"phpTypeHandlerMethod", php_set_type_handler_code, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, + {"phpFixupHandler", php_set_fixup_handler, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, + {"phpFixupHandlerMethod", php_set_fixup_handler_code, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, + {"phpLoggerHandler", php_set_logger_handler, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, + {"phpLoggerHandlerMethod", php_set_logger_handler_code, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, +#if MODULE_MAGIC_NUMBER >= 19970902 + {"phpPostReadHandler", php_set_post_read_handler, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, + {"phpPostReadHandlerMethod", php_set_post_read_handler_code, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, + {"phpRequire", php_set_require, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, + {"phpResponseHandler", php_set_response_handler, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, + {"phpResponseHandlerMethod", php_set_response_handler_code, NULL, OR_OPTIONS, TAKE1, "PHP Value Modifier"}, +#endif + {"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 php5_module + */ +module MODULE_VAR_EXPORT php5_module = +{ + STANDARD_MODULE_STUFF, + php_init_handler, /* initializer */ + php_create_dir, /* per-directory config creator */ + php_merge_dir, /* dir merger */ + php_create_server, /* per-server config creator */ + NULL, /* merge server config */ + php_commands, /* command table */ + php_handlers, /* handlers */ + php_uri_translation, /* filename translation */ + NULL, /* check_user_id */ + php_auth_hook, /* check auth */ + php_access_hook, /* check access */ + php_type_hook, /* type_checker */ + php_fixup_hook, /* fixups */ + php_logger_hook /* logger */ +#if MODULE_MAGIC_NUMBER >= 19970103 + , php_header_hook /* header parser */ +#endif +#if MODULE_MAGIC_NUMBER >= 19970719 + , NULL /* child_init */ +#endif +#if MODULE_MAGIC_NUMBER >= 19970728 + , php_child_exit_handler /* child_exit */ +#endif +#if MODULE_MAGIC_NUMBER >= 19970902 + , php_post_read_hook /* post read-request */ +#endif +}; +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/sapi/apache_hooks/mod_php5.exp b/sapi/apache_hooks/mod_php5.exp new file mode 100644 index 0000000000..9ad0f0a0ad --- /dev/null +++ b/sapi/apache_hooks/mod_php5.exp @@ -0,0 +1 @@ +php5_module diff --git a/sapi/apache_hooks/mod_php5.h b/sapi/apache_hooks/mod_php5.h new file mode 100644 index 0000000000..8e62ccdff8 --- /dev/null +++ b/sapi/apache_hooks/mod_php5.h @@ -0,0 +1,81 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2004 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.0 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_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: Rasmus Lerdorf | + +----------------------------------------------------------------------+ + */ +/* $Id$ */ + +#ifndef MOD_PHP5_H +#define MOD_PHP5_H + +#if !defined(WIN32) && !defined(WINNT) +#ifndef MODULE_VAR_EXPORT +#define MODULE_VAR_EXPORT +#endif +#endif + +typedef struct { + long engine; + long last_modified; + long xbithack; + long terminate_child; + long setup_env; + long current_hook; + zend_bool in_request; + zend_bool apache_config_loaded; + zend_bool headers_sent; +} php_apache_info_struct; + +typedef struct _php_handler { + long type; + long stage; + char *name; +} php_handler; + +#define AP_HANDLER_TYPE_FILE 0 +#define AP_HANDLER_TYPE_METHOD 1 + +extern zend_module_entry apache_module_entry; + +#ifdef ZTS +extern int php_apache_info_id; +#define AP(v) TSRMG(php_apache_info_id, php_apache_info_struct *, v) +#else +extern php_apache_info_struct php_apache_info; +#define AP(v) (php_apache_info.v) +#endif + +/* defines for the various stages of the apache request */ +#define AP_WAITING_FOR_REQUEST 0 +#define AP_POST_READ 1 +#define AP_URI_TRANS 2 +#define AP_HEADER_PARSE 3 +#define AP_ACCESS_CONTROL 4 +#define AP_AUTHENTICATION 5 +#define AP_AUTHORIZATION 6 +#define AP_TYPE_CHECKING 7 +#define AP_FIXUP 8 +#define AP_RESPONSE 9 +#define AP_LOGGING 10 +#define AP_CLEANUP 11 + +#endif /* MOD_PHP5_H */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + */ diff --git a/sapi/apache_hooks/php.sym b/sapi/apache_hooks/php.sym index 2dca1256c2..9ad0f0a0ad 100644 --- a/sapi/apache_hooks/php.sym +++ b/sapi/apache_hooks/php.sym @@ -1 +1 @@ -php4_module +php5_module diff --git a/sapi/apache_hooks/php4apache_hooks.dsp b/sapi/apache_hooks/php4apache_hooks.dsp deleted file mode 100755 index 3a2f347d8a..0000000000 --- a/sapi/apache_hooks/php4apache_hooks.dsp +++ /dev/null @@ -1,151 +0,0 @@ -# Microsoft Developer Studio Project File - Name="php4apache_hooks" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=php4apache_hooks - Win32 Release_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 "php4apache_hooks.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 "php4apache_hooks.mak" CFG="php4apache_hooks - Win32 Release_TS" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "php4apache_hooks - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "php4apache_hooks - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "php4apache_hooks - Win32 Release_TS_inline" (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)" == "php4apache_hooks - 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 "APACHEPHP4_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\..\regex" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\apache\src\include" /I "..\..\main" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "NDEBUG" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP4_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /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 php4ts.lib ApacheCore.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:"0x60000000" /version:4.0 /dll /machine:I386 /libpath:"..\..\..\php_build\apache\src\corer" /libpath:"..\..\Release_TS" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\Zend\Release_TS" - -!ELSEIF "$(CFG)" == "php4apache_hooks - Win32 Debug_TS" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Debug_TS" -# PROP BASE Intermediate_Dir "Debug_TS" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\Debug_TS" -# PROP Intermediate_Dir "Debug_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 "APACHEPHP4_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\..\regex" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\apache\src\include" /I "..\..\main" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP4_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /FR /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 php4ts_debug.lib ApacheCore.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:"0x60000000" /version:4.0 /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php4apache_hooks.dll" /pdbtype:sept /libpath:"..\..\..\php_build\apache\src\cored" /libpath:"..\..\Debug_TS" /libpath:"..\..\TSRM\Debug_TS" /libpath:"..\..\Zend\Debug_TS" - -!ELSEIF "$(CFG)" == "php4apache_hooks - 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 "APACHEPHP4_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\..\regex" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\apache\src\include" /I "..\..\main" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "NDEBUG" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP4_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /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 php4ts.lib ApacheCore.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 /version:4.0 /dll /machine:I386 /libpath:"\apache\src\corer" /libpath:"..\..\Release_TS_inline" /libpath:"..\..\TSRM\Release_TS_inline" /libpath:"..\..\Zend\Release_TS_inline" - -!ENDIF - -# Begin Target - -# Name "php4apache_hooks - Win32 Release_TS" -# Name "php4apache_hooks - Win32 Debug_TS" -# Name "php4apache_hooks - Win32 Release_TS_inline" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\mod_php4.c -# End Source File -# Begin Source File - -SOURCE=.\php_apache.c -# End Source File -# Begin Source File - -SOURCE=.\sapi_apache.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\mod_php4.h -# End Source File -# Begin Source File - -SOURCE=.\php_apache_http.h -# End Source File -# 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 diff --git a/sapi/apache_hooks/php5apache_hooks.dsp b/sapi/apache_hooks/php5apache_hooks.dsp new file mode 100755 index 0000000000..cc60f4b3b1 --- /dev/null +++ b/sapi/apache_hooks/php5apache_hooks.dsp @@ -0,0 +1,151 @@ +# Microsoft Developer Studio Project File - Name="php5apache_hooks" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=php5apache_hooks - Win32 Release_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 "php5apache_hooks.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 "php5apache_hooks.mak" CFG="php5apache_hooks - Win32 Release_TS" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "php5apache_hooks - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "php5apache_hooks - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "php5apache_hooks - Win32 Release_TS_inline" (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)" == "php5apache_hooks - 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 "APACHEPHP5_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\..\regex" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\apache\src\include" /I "..\..\main" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "NDEBUG" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP5_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /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 php5ts.lib ApacheCore.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:"0x60000000" /version:4.0 /dll /machine:I386 /libpath:"..\..\..\php_build\apache\src\corer" /libpath:"..\..\Release_TS" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\Zend\Release_TS" + +!ELSEIF "$(CFG)" == "php5apache_hooks - Win32 Debug_TS" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Debug_TS" +# PROP BASE Intermediate_Dir "Debug_TS" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\..\Debug_TS" +# PROP Intermediate_Dir "Debug_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 "APACHEPHP5_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\..\regex" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\apache\src\include" /I "..\..\main" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP5_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /FR /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 php5ts_debug.lib ApacheCore.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:"0x60000000" /version:4.0 /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php5apache_hooks.dll" /pdbtype:sept /libpath:"..\..\..\php_build\apache\src\cored" /libpath:"..\..\Debug_TS" /libpath:"..\..\TSRM\Debug_TS" /libpath:"..\..\Zend\Debug_TS" + +!ELSEIF "$(CFG)" == "php5apache_hooks - 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 "APACHEPHP5_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\..\regex" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\apache\src\include" /I "..\..\main" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "NDEBUG" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP5_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /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 php5ts.lib ApacheCore.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 /version:4.0 /dll /machine:I386 /libpath:"\apache\src\corer" /libpath:"..\..\Release_TS_inline" /libpath:"..\..\TSRM\Release_TS_inline" /libpath:"..\..\Zend\Release_TS_inline" + +!ENDIF + +# Begin Target + +# Name "php5apache_hooks - Win32 Release_TS" +# Name "php5apache_hooks - Win32 Debug_TS" +# Name "php5apache_hooks - Win32 Release_TS_inline" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\mod_php5.c +# End Source File +# Begin Source File + +SOURCE=.\php_apache.c +# End Source File +# Begin Source File + +SOURCE=.\sapi_apache.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\mod_php5.h +# End Source File +# Begin Source File + +SOURCE=.\php_apache_http.h +# End Source File +# 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 diff --git a/sapi/apache_hooks/php_apache_http.h b/sapi/apache_hooks/php_apache_http.h index b9b3c63715..2a030482f6 100644 --- a/sapi/apache_hooks/php_apache_http.h +++ b/sapi/apache_hooks/php_apache_http.h @@ -36,7 +36,7 @@ #include "php_ini.h" #include "ext/standard/php_standard.h" -#include "mod_php4.h" +#include "mod_php5.h" zval *php_apache_request_new(request_rec *r); diff --git a/sapi/caudium/caudium.c b/sapi/caudium/caudium.c index 1cf4137911..68ba73b60e 100644 --- a/sapi/caudium/caudium.c +++ b/sapi/caudium/caudium.c @@ -38,7 +38,7 @@ */ #define NO_PIKE_SHORTHAND -/* Ok, we are now using Pike level threads to handle PHP4 since +/* Ok, we are now using Pike level threads to handle PHP5 since * the nice th_farm threads aren't working on Linux with glibc 2.2 * (why this is I don't know). */ @@ -79,7 +79,7 @@ #endif #ifndef PIKE_THREADS -#error The PHP4 module requires that your Pike has thread support. +#error The PHP5 module requires that your Pike has thread support. #endif #undef HIDE_GLOBAL_VARIABLES @@ -624,7 +624,7 @@ static void php_caudium_module_main(php_caudium_request *ureq) SG(request_info).headers_only = 0; } - /* Let PHP4 handle the deconding of the AUTH */ + /* Let PHP5 handle the deconding of the AUTH */ php_handle_auth_data(lookup_string_header("HTTP_AUTHORIZATION", NULL), TSRMLS_C); /* Swap out this thread and release the interpreter lock to allow * Pike threads to run. We wait since the above would otherwise require @@ -713,10 +713,10 @@ void f_php_caudium_request_handler(INT32 args) if(THIS == NULL) Pike_error("Out of memory."); - get_all_args("PHP4.Interpreter->run", args, "%S%m%O%*", &script, + get_all_args("PHP5.Interpreter->run", args, "%S%m%O%*", &script, &request_data, &my_fd_obj, &done_callback); if(done_callback->type != PIKE_T_FUNCTION) - Pike_error("PHP4.Interpreter->run: Bad argument 4, expected function.\n"); + Pike_error("PHP5.Interpreter->run: Bad argument 4, expected function.\n"); add_ref(request_data); add_ref(my_fd_obj); add_ref(script); diff --git a/sapi/caudium/config.m4 b/sapi/caudium/config.m4 index 6d5e4bbc19..ef36a5ea6e 100644 --- a/sapi/caudium/config.m4 +++ b/sapi/caudium/config.m4 @@ -78,12 +78,12 @@ AC_ARG_WITH(caudium, AC_MSG_RESULT(not found) fi else - AC_MSG_ERROR(Caudium PHP4 requires Pike 7.0 or newer) + AC_MSG_ERROR(Caudium PHP5 requires Pike 7.0 or newer) fi PIKE_VERSION=`$PIKE -e 'string v; int rel;sscanf(version(), "Pike v%s release %d", v, rel); write(v+"."+rel);'` AC_DEFINE(HAVE_CAUDIUM,1,[Whether to compile with Caudium support]) PHP_SELECT_SAPI(caudium, shared, caudium.c) - INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED $withval/lib/$PIKE_VERSION/PHP4.so" + INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED $withval/lib/$PIKE_VERSION/PHP5.so" RESULT=" *** Pike binary used: $PIKE *** Pike include dir(s) used: $PIKE_INCLUDE_DIR *** Pike version: $PIKE_VERSION" diff --git a/sapi/cgi/README.FastCGI b/sapi/cgi/README.FastCGI index c2952c0768..f51ae5686b 100644 --- a/sapi/cgi/README.FastCGI +++ b/sapi/cgi/README.FastCGI @@ -69,7 +69,7 @@ a line in your config like: Don't load mod_php, by the way. Make sure it is commented out! - #LoadModule php4_module /usr/lib/apache/2.0/libphp4.so + #LoadModule php5_module /usr/lib/apache/2.0/libphp5.so Now, we'll create a fcgi-bin directory, just like you would do with normal CGI scripts. You'll need to create a directory somewhere to store your diff --git a/sapi/continuity/capi.c b/sapi/continuity/capi.c index 5e3c5e90a7..00fca27b14 100644 --- a/sapi/continuity/capi.c +++ b/sapi/continuity/capi.c @@ -19,7 +19,7 @@ /* For more information on Continuity: http://www.ashpool.com/ */ /* - * This code is based on the PHP4 SAPI module for NSAPI by Jayakumar + * This code is based on the PHP5 SAPI module for NSAPI by Jayakumar * Muthukumarasamy */ diff --git a/sapi/embed/php4embed.dsp b/sapi/embed/php4embed.dsp deleted file mode 100644 index d251fca04d..0000000000 --- a/sapi/embed/php4embed.dsp +++ /dev/null @@ -1,100 +0,0 @@ -# Microsoft Developer Studio Project File - Name="php4embed" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=php4embed - 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 "php4embed.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 "php4embed.mak" CFG="php4embed - Win32 Debug_TS" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "php4embed - Win32 Debug_TS" (based on "Win32 (x86) Static Library") -!MESSAGE "php4embed - Win32 Release_TS" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "php4embed - 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 /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=1 /YX /FD /GZ /c -# ADD BASE RSC /l 0x406 /d "_DEBUG" -# ADD RSC /l 0x406 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\Debug_TS\php4embed.lib" - -!ELSEIF "$(CFG)" == "php4embed - 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 Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=0 /YX /FD /c -# ADD BASE RSC /l 0x406 /d "NDEBUG" -# ADD RSC /l 0x406 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\Release_TS\php4embed.lib" - -!ENDIF - -# Begin Target - -# Name "php4embed - Win32 Debug_TS" -# Name "php4embed - Win32 Release_TS" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=php_embed.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=php_embed.h -# End Source File -# End Group -# End Target -# End Project diff --git a/sapi/embed/php5embed.dsp b/sapi/embed/php5embed.dsp new file mode 100644 index 0000000000..8564b11797 --- /dev/null +++ b/sapi/embed/php5embed.dsp @@ -0,0 +1,100 @@ +# Microsoft Developer Studio Project File - Name="php5embed" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=php5embed - 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 "php5embed.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 "php5embed.mak" CFG="php5embed - Win32 Debug_TS" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "php5embed - Win32 Debug_TS" (based on "Win32 (x86) Static Library") +!MESSAGE "php5embed - Win32 Release_TS" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "php5embed - 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 /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=1 /YX /FD /GZ /c +# ADD BASE RSC /l 0x406 /d "_DEBUG" +# ADD RSC /l 0x406 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /out:"..\..\Debug_TS\php5embed.lib" + +!ELSEIF "$(CFG)" == "php5embed - 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 Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=0 /YX /FD /c +# ADD BASE RSC /l 0x406 /d "NDEBUG" +# ADD RSC /l 0x406 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /out:"..\..\Release_TS\php5embed.lib" + +!ENDIF + +# Begin Target + +# Name "php5embed - Win32 Debug_TS" +# Name "php5embed - Win32 Release_TS" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=php_embed.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=php_embed.h +# End Source File +# End Group +# End Target +# End Project diff --git a/sapi/isapi/config.m4 b/sapi/isapi/config.m4 index 8e0c4bc11f..dbb80ee810 100644 --- a/sapi/isapi/config.m4 +++ b/sapi/isapi/config.m4 @@ -16,7 +16,7 @@ AC_ARG_WITH(isapi, PHP_BUILD_THREAD_SAFE AC_DEFINE(WITH_ZEUS,1,[ ]) PHP_ADD_INCLUDE($ZEUSPATH/web/include) - PHP_SELECT_SAPI(isapi, shared, php4isapi.c) + PHP_SELECT_SAPI(isapi, shared, php5isapi.c) INSTALL_IT="\$(SHELL) \$(srcdir)/install-sh -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)$ZEUSPATH/web/bin/" RESULT=yes ]) diff --git a/sapi/isapi/config.w32 b/sapi/isapi/config.w32 index 1a6cfd3be8..13d0e016eb 100644 --- a/sapi/isapi/config.w32 +++ b/sapi/isapi/config.w32 @@ -8,6 +8,6 @@ if (PHP_ISAPI == "yes") { ERROR("ISAPI module requires an --enable-zts build of PHP"); } - SAPI('isapi', 'php4isapi.c', 'php' + PHP_VERSION + 'isapi.dll', '/D PHP4ISAPI_EXPORTS'); - ADD_FLAG('LDFLAGS_ISAPI', '/DEF:sapi\\isapi\\php4isapi.def'); + SAPI('isapi', 'php5isapi.c', 'php' + PHP_VERSION + 'isapi.dll', '/D PHP5ISAPI_EXPORTS'); + ADD_FLAG('LDFLAGS_ISAPI', '/DEF:sapi\\isapi\\php5isapi.def'); } diff --git a/sapi/isapi/php4isapi.c b/sapi/isapi/php4isapi.c deleted file mode 100644 index b0d1366299..0000000000 --- a/sapi/isapi/php4isapi.c +++ /dev/null @@ -1,949 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2004 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 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_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: Zeev Suraski | - | Ben Mansell (Zeus Support) | - +----------------------------------------------------------------------+ - */ - -#include "php.h" -#include -#include -#include -#include "php_main.h" -#include "SAPI.h" -#include "php_globals.h" -#include "ext/standard/info.h" -#include "php_variables.h" -#include "php_ini.h" - -#ifdef PHP_WIN32 -# include -#else -# define __try -# define __except(val) -# define __declspec(foo) -#endif - - -#ifdef WITH_ZEUS -# include "httpext.h" -# include -# define GetLastError() errno -#endif - -#ifdef PHP_WIN32 -#define PHP_ENABLE_SEH -#endif - -/* -uncomment the following lines to turn off -exception trapping when running under a debugger - -#ifdef _DEBUG -#undef PHP_ENABLE_SEH -#endif -*/ - -#define MAX_STATUS_LENGTH sizeof("xxxx LONGEST STATUS DESCRIPTION") -#define ISAPI_SERVER_VAR_BUF_SIZE 1024 -#define ISAPI_POST_DATA_BUF 1024 - -static zend_bool bFilterLoaded=0; -static zend_bool bTerminateThreadsOnError=0; - -static char *isapi_special_server_variable_names[] = { - "ALL_HTTP", - "HTTPS", -#ifndef WITH_ZEUS - "SCRIPT_NAME", -#endif - NULL -}; - -#define NUM_SPECIAL_VARS (sizeof(isapi_special_server_variable_names)/sizeof(char *)) -#define SPECIAL_VAR_ALL_HTTP 0 -#define SPECIAL_VAR_HTTPS 1 -#define SPECIAL_VAR_PHP_SELF 2 - -static char *isapi_server_variable_names[] = { - "AUTH_PASSWORD", - "AUTH_TYPE", - "AUTH_USER", - "CONTENT_LENGTH", - "CONTENT_TYPE", - "PATH_TRANSLATED", - "QUERY_STRING", - "REMOTE_ADDR", - "REMOTE_HOST", - "REMOTE_USER", - "REQUEST_METHOD", - "SERVER_NAME", - "SERVER_PORT", - "SERVER_PROTOCOL", - "SERVER_SOFTWARE", -#ifndef WITH_ZEUS - "APPL_MD_PATH", - "APPL_PHYSICAL_PATH", - "INSTANCE_ID", - "INSTANCE_META_PATH", - "LOGON_USER", - "REQUEST_URI", - "URL", -#else - "DOCUMENT_ROOT", -#endif - NULL -}; - - -static char *isapi_secure_server_variable_names[] = { - "CERT_COOKIE", - "CERT_FLAGS", - "CERT_ISSUER", - "CERT_KEYSIZE", - "CERT_SECRETKEYSIZE", - "CERT_SERIALNUMBER", - "CERT_SERVER_ISSUER", - "CERT_SERVER_SUBJECT", - "CERT_SUBJECT", - "HTTPS_KEYSIZE", - "HTTPS_SECRETKEYSIZE", - "HTTPS_SERVER_ISSUER", - "HTTPS_SERVER_SUBJECT", - "SERVER_PORT_SECURE", -#ifdef WITH_ZEUS - "SSL_CLIENT_CN", - "SSL_CLIENT_EMAIL", - "SSL_CLIENT_OU", - "SSL_CLIENT_O", - "SSL_CLIENT_L", - "SSL_CLIENT_ST", - "SSL_CLIENT_C", - "SSL_CLIENT_I_CN", - "SSL_CLIENT_I_EMAIL", - "SSL_CLIENT_I_OU", - "SSL_CLIENT_I_O", - "SSL_CLIENT_I_L", - "SSL_CLIENT_I_ST", - "SSL_CLIENT_I_C", -#endif - NULL -}; - - -static void php_info_isapi(ZEND_MODULE_INFO_FUNC_ARGS) -{ - char **p; - char variable_buf[ISAPI_SERVER_VAR_BUF_SIZE]; - DWORD variable_len; - char **all_variables[] = { - isapi_server_variable_names, - isapi_special_server_variable_names, - isapi_secure_server_variable_names, - NULL - }; - char ***server_variable_names; - LPEXTENSION_CONTROL_BLOCK lpECB; - - lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context); - - php_info_print_table_start(); - php_info_print_table_header(2, "Server Variable", "Value"); - server_variable_names = all_variables; - while (*server_variable_names) { - p = *server_variable_names; - 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++; - } - server_variable_names++; - } - php_info_print_table_end(); -} - - -static zend_module_entry php_isapi_module = { - STANDARD_MODULE_HEADER, - "ISAPI", - NULL, - NULL, - NULL, - NULL, - NULL, - php_info_isapi, - NULL, - STANDARD_MODULE_PROPERTIES -}; - - -static int sapi_isapi_ub_write(const char *str, uint str_length TSRMLS_DC) -{ - DWORD num_bytes = str_length; - LPEXTENSION_CONTROL_BLOCK ecb; - - ecb = (LPEXTENSION_CONTROL_BLOCK) SG(server_context); - if (ecb->WriteClient(ecb->ConnID, (char *) str, &num_bytes, HSE_IO_SYNC) == FALSE) { - php_handle_aborted_connection(); - } - return num_bytes; -} - - -static int sapi_isapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC) -{ - return SAPI_HEADER_ADD; -} - - - -static void accumulate_header_length(sapi_header_struct *sapi_header, uint *total_length TSRMLS_DC) -{ - *total_length += sapi_header->header_len+2; -} - - -static void concat_header(sapi_header_struct *sapi_header, char **combined_headers_ptr TSRMLS_DC) -{ - 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 TSRMLS_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; - - /* Obtain headers length */ - if (SG(sapi_headers).send_default_content_type) { - sapi_get_default_content_type_header(&default_content_type TSRMLS_CC); - accumulate_header_length(&default_content_type, (void *) &total_length TSRMLS_CC); - } - zend_llist_apply_with_argument(&SG(sapi_headers).headers, (llist_apply_with_arg_func_t) accumulate_header_length, (void *) &total_length TSRMLS_CC); - - /* 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 TSRMLS_CC); - sapi_free_header(&default_content_type); /* we no longer need it */ - } - zend_llist_apply_with_argument(&SG(sapi_headers).headers, (llist_apply_with_arg_func_t) concat_header, (void *) &combined_headers_ptr TSRMLS_CC); - *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; - } - header_info.cchStatus = strlen(header_info.pszStatus); - header_info.pszHeader = combined_headers; - header_info.cchHeader = total_length; - header_info.fKeepConn = FALSE; - 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); - return SAPI_HEADER_SENT_SUCCESSFULLY; -} - - -static int php_isapi_startup(sapi_module_struct *sapi_module) -{ - if (php_module_startup(sapi_module, &php_isapi_module, 1)==FAILURE) { - return FAILURE; - } else { - bTerminateThreadsOnError = (zend_bool) INI_INT("isapi.terminate_threads_on_error"); - return SUCCESS; - } -} - - - -static int sapi_isapi_read_post(char *buffer, uint count_bytes TSRMLS_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 ((DWORD) 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_bufcbTotalBytes) { - 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; - } - return total_read; -} - - -static char *sapi_isapi_read_cookies(TSRMLS_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; -} - - -#ifdef WITH_ZEUS - -static void sapi_isapi_register_zeus_ssl_variables(LPEXTENSION_CONTROL_BLOCK lpECB, zval *track_vars_array TSRMLS_DC) -{ - char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE]; - DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE; - char static_cons_buf[ISAPI_SERVER_VAR_BUF_SIZE]; - /* - * We need to construct the /C=.../ST=... - * DN's for SSL_CLIENT_DN and SSL_CLIENT_I_DN - */ - strcpy( static_cons_buf, "/C=" ); - if( lpECB->GetServerVariable( lpECB->ConnID, "SSL_CLIENT_C", static_variable_buf, &variable_len ) && static_variable_buf[0] ) { - strcat( static_cons_buf, static_variable_buf ); - } - strcat( static_cons_buf, "/ST=" ); - variable_len = ISAPI_SERVER_VAR_BUF_SIZE; - if( lpECB->GetServerVariable( lpECB->ConnID, "SSL_CLIENT_ST", static_variable_buf, &variable_len ) && static_variable_buf[0] ) { - strcat( static_cons_buf, static_variable_buf ); - } - php_register_variable( "SSL_CLIENT_DN", static_cons_buf, track_vars_array TSRMLS_CC ); - - strcpy( static_cons_buf, "/C=" ); - variable_len = ISAPI_SERVER_VAR_BUF_SIZE; - if( lpECB->GetServerVariable( lpECB->ConnID, "SSL_CLIENT_I_C", static_variable_buf, &variable_len ) && static_variable_buf[0] ) { - strcat( static_cons_buf, static_variable_buf ); - } - strcat( static_cons_buf, "/ST=" ); - variable_len = ISAPI_SERVER_VAR_BUF_SIZE; - if( lpECB->GetServerVariable( lpECB->ConnID, "SSL_CLIENT_I_ST", static_variable_buf, &variable_len ) && static_variable_buf[0] ) { - strcat( static_cons_buf, static_variable_buf ); - } - php_register_variable( "SSL_CLIENT_I_DN", static_cons_buf, track_vars_array TSRMLS_CC ); -} - -static void sapi_isapi_register_zeus_variables(LPEXTENSION_CONTROL_BLOCK lpECB, zval *track_vars_array TSRMLS_DC) -{ - char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE]; - DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE; - DWORD scriptname_len = ISAPI_SERVER_VAR_BUF_SIZE; - DWORD pathinfo_len = 0; - char *strtok_buf = NULL; - - /* Get SCRIPT_NAME, we use this to work out which bit of the URL - * belongs in PHP's version of PATH_INFO - */ - lpECB->GetServerVariable(lpECB->ConnID, "SCRIPT_NAME", static_variable_buf, &scriptname_len); - - /* Adjust Zeus' version of PATH_INFO, set PHP_SELF, - * and generate REQUEST_URI - */ - if ( lpECB->GetServerVariable(lpECB->ConnID, "PATH_INFO", static_variable_buf, &variable_len) && static_variable_buf[0] ) { - - /* PHP_SELF is just PATH_INFO */ - php_register_variable( "PHP_SELF", static_variable_buf, track_vars_array TSRMLS_CC ); - - /* Chop off filename to get just the 'real' PATH_INFO' */ - pathinfo_len = variable_len - scriptname_len; - php_register_variable( "PATH_INFO", static_variable_buf + scriptname_len - 1, track_vars_array TSRMLS_CC ); - /* append query string to give url... extra byte for '?' */ - if ( strlen(lpECB->lpszQueryString) + variable_len + 1 < ISAPI_SERVER_VAR_BUF_SIZE ) { - /* append query string only if it is present... */ - if ( strlen(lpECB->lpszQueryString) ) { - static_variable_buf[ variable_len - 1 ] = '?'; - strcpy( static_variable_buf + variable_len, lpECB->lpszQueryString ); - } - php_register_variable( "URL", static_variable_buf, track_vars_array TSRMLS_CC ); - php_register_variable( "REQUEST_URI", static_variable_buf, track_vars_array TSRMLS_CC ); - } - } - - /* Get and adjust PATH_TRANSLATED to what PHP wants */ - variable_len = ISAPI_SERVER_VAR_BUF_SIZE; - if ( lpECB->GetServerVariable(lpECB->ConnID, "PATH_TRANSLATED", static_variable_buf, &variable_len) && static_variable_buf[0] ) { - static_variable_buf[ variable_len - pathinfo_len - 1 ] = '\0'; - php_register_variable( "PATH_TRANSLATED", static_variable_buf, track_vars_array TSRMLS_CC ); - } - - /* Bring in the AUTHENTICATION stuff as needed */ - variable_len = ISAPI_SERVER_VAR_BUF_SIZE; - if ( lpECB->GetServerVariable(lpECB->ConnID, "AUTH_USER", static_variable_buf, &variable_len) && static_variable_buf[0] ) { - php_register_variable( "PHP_AUTH_USER", static_variable_buf, track_vars_array TSRMLS_CC ); - } - variable_len = ISAPI_SERVER_VAR_BUF_SIZE; - if ( lpECB->GetServerVariable(lpECB->ConnID, "AUTH_PASSWORD", static_variable_buf, &variable_len) && static_variable_buf[0] ) { - php_register_variable( "PHP_AUTH_PW", static_variable_buf, track_vars_array TSRMLS_CC ); - } - variable_len = ISAPI_SERVER_VAR_BUF_SIZE; - if ( lpECB->GetServerVariable(lpECB->ConnID, "AUTH_TYPE", static_variable_buf, &variable_len) && static_variable_buf[0] ) { - php_register_variable( "AUTH_TYPE", static_variable_buf, track_vars_array TSRMLS_CC ); - } - - /* And now, for the SSL variables (if applicable) */ - variable_len = ISAPI_SERVER_VAR_BUF_SIZE; - if ( lpECB->GetServerVariable(lpECB->ConnID, "CERT_COOKIE", static_variable_buf, &variable_len) && static_variable_buf[0] ) { - sapi_isapi_register_zeus_ssl_variables( lpECB, track_vars_array TSRMLS_CC ); - } - /* Copy some of the variables we need to meet Apache specs */ - variable_len = ISAPI_SERVER_VAR_BUF_SIZE; - if ( lpECB->GetServerVariable(lpECB->ConnID, "SERVER_SOFTWARE", static_variable_buf, &variable_len) && static_variable_buf[0] ) { - php_register_variable( "SERVER_SIGNATURE", static_variable_buf, track_vars_array TSRMLS_CC ); - } -} -#else - -static void sapi_isapi_register_iis_variables(LPEXTENSION_CONTROL_BLOCK lpECB, zval *track_vars_array TSRMLS_DC) -{ - char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE]; - char path_info_buf[ISAPI_SERVER_VAR_BUF_SIZE]; - DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE; - DWORD scriptname_len = ISAPI_SERVER_VAR_BUF_SIZE; - DWORD pathinfo_len = 0; - HSE_URL_MAPEX_INFO humi; - - /* Get SCRIPT_NAME, we use this to work out which bit of the URL - * belongs in PHP's version of PATH_INFO. SCRIPT_NAME also becomes PHP_SELF. - */ - lpECB->GetServerVariable(lpECB->ConnID, "SCRIPT_NAME", static_variable_buf, &scriptname_len); - php_register_variable("SCRIPT_FILENAME", SG(request_info).path_translated, track_vars_array TSRMLS_CC); - - /* Adjust IIS' version of PATH_INFO, set PHP_SELF, - * and generate REQUEST_URI - * Get and adjust PATH_TRANSLATED to what PHP wants - */ - if ( lpECB->GetServerVariable(lpECB->ConnID, "PATH_INFO", static_variable_buf, &variable_len) && static_variable_buf[0] ) { - - /* Chop off filename to get just the 'real' PATH_INFO' */ - php_register_variable( "ORIG_PATH_INFO", static_variable_buf, track_vars_array TSRMLS_CC ); - pathinfo_len = variable_len - scriptname_len; - strncpy(path_info_buf, static_variable_buf + scriptname_len - 1, sizeof(path_info_buf)-1); - php_register_variable( "PATH_INFO", path_info_buf, track_vars_array TSRMLS_CC ); - /* append query string to give url... extra byte for '?' */ - if ( strlen(lpECB->lpszQueryString) + variable_len + 1 < ISAPI_SERVER_VAR_BUF_SIZE ) { - /* append query string only if it is present... */ - if ( strlen(lpECB->lpszQueryString) ) { - static_variable_buf[ variable_len - 1 ] = '?'; - strcpy( static_variable_buf + variable_len, lpECB->lpszQueryString ); - } - php_register_variable( "URL", static_variable_buf, track_vars_array TSRMLS_CC ); - php_register_variable( "REQUEST_URI", static_variable_buf, track_vars_array TSRMLS_CC ); - } - variable_len = ISAPI_SERVER_VAR_BUF_SIZE; - if ( lpECB->GetServerVariable(lpECB->ConnID, "PATH_TRANSLATED", static_variable_buf, &variable_len) && static_variable_buf[0] ) { - php_register_variable( "ORIG_PATH_TRANSLATED", static_variable_buf, track_vars_array TSRMLS_CC ); - } - if (lpECB->ServerSupportFunction(lpECB->ConnID, HSE_REQ_MAP_URL_TO_PATH_EX, path_info_buf, &pathinfo_len, (LPDWORD) &humi)) { - /* Remove trailing \ */ - if (humi.lpszPath[variable_len-2] == '\\') { - humi.lpszPath[variable_len-2] = 0; - } - php_register_variable("PATH_TRANSLATED", humi.lpszPath, track_vars_array TSRMLS_CC); - } - } - - static_variable_buf[0] = '/'; - static_variable_buf[1] = 0; - variable_len = 2; - if (lpECB->ServerSupportFunction(lpECB->ConnID, HSE_REQ_MAP_URL_TO_PATH_EX, static_variable_buf, &variable_len, (LPDWORD) &humi)) { - /* Remove trailing \ */ - if (humi.lpszPath[variable_len-2] == '\\') { - humi.lpszPath[variable_len-2] = 0; - } - php_register_variable("DOCUMENT_ROOT", humi.lpszPath, track_vars_array TSRMLS_CC); - } - - if (!SG(request_info).auth_user || !SG(request_info).auth_password || - !SG(request_info).auth_user[0] || !SG(request_info).auth_password[0]) { - variable_len = ISAPI_SERVER_VAR_BUF_SIZE; - if (lpECB->GetServerVariable(lpECB->ConnID, "HTTP_AUTHORIZATION", static_variable_buf, &variable_len) - && static_variable_buf[0]) { - php_handle_auth_data(static_variable_buf TSRMLS_CC); - } - } - - if (SG(request_info).auth_user) { - php_register_variable("PHP_AUTH_USER", SG(request_info).auth_user, track_vars_array TSRMLS_CC ); - } - if (SG(request_info).auth_password) { - php_register_variable("PHP_AUTH_PW", SG(request_info).auth_password, track_vars_array TSRMLS_CC ); - } -} -#endif - -static void sapi_isapi_register_server_variables2(char **server_variables, LPEXTENSION_CONTROL_BLOCK lpECB, zval *track_vars_array, char **recorded_values TSRMLS_DC) -{ - char **p=server_variables; - DWORD variable_len; - char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE]; - char *variable_buf; - - while (*p) { - variable_len = ISAPI_SERVER_VAR_BUF_SIZE; - if (lpECB->GetServerVariable(lpECB->ConnID, *p, static_variable_buf, &variable_len) - && static_variable_buf[0]) { - php_register_variable(*p, static_variable_buf, track_vars_array TSRMLS_CC); - if (recorded_values) { - recorded_values[p-server_variables] = estrndup(static_variable_buf, variable_len); - } - } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) { - variable_buf = (char *) emalloc(variable_len+1); - if (lpECB->GetServerVariable(lpECB->ConnID, *p, variable_buf, &variable_len) - && variable_buf[0]) { - php_register_variable(*p, variable_buf, track_vars_array TSRMLS_CC); - } - if (recorded_values) { - recorded_values[p-server_variables] = variable_buf; - } else { - efree(variable_buf); - } - } - p++; - } -} - - -static void sapi_isapi_register_server_variables(zval *track_vars_array TSRMLS_DC) -{ - DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE; - char *variable; - char *strtok_buf = NULL; - char *isapi_special_server_variables[NUM_SPECIAL_VARS]; - LPEXTENSION_CONTROL_BLOCK lpECB; - - lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context); - - /* Register the special ISAPI variables */ - memset(isapi_special_server_variables, 0, sizeof(isapi_special_server_variables)); - sapi_isapi_register_server_variables2(isapi_special_server_variable_names, lpECB, track_vars_array, isapi_special_server_variables TSRMLS_CC); - if (SG(request_info).cookie_data) { - php_register_variable("HTTP_COOKIE", SG(request_info).cookie_data, track_vars_array TSRMLS_CC); - } - - /* Register the standard ISAPI variables */ - sapi_isapi_register_server_variables2(isapi_server_variable_names, lpECB, track_vars_array, NULL TSRMLS_CC); - - if (isapi_special_server_variables[SPECIAL_VAR_HTTPS] - && (atoi(isapi_special_server_variables[SPECIAL_VAR_HTTPS]) - || !strcasecmp(isapi_special_server_variables[SPECIAL_VAR_HTTPS], "on")) - ) { - /* Register SSL ISAPI variables */ - sapi_isapi_register_server_variables2(isapi_secure_server_variable_names, lpECB, track_vars_array, NULL TSRMLS_CC); - } - - if (isapi_special_server_variables[SPECIAL_VAR_HTTPS]) { - efree(isapi_special_server_variables[SPECIAL_VAR_HTTPS]); - } - - -#ifdef WITH_ZEUS - sapi_isapi_register_zeus_variables(lpECB, track_vars_array TSRMLS_CC); -#else - sapi_isapi_register_iis_variables(lpECB, track_vars_array TSRMLS_CC); -#endif - - /* PHP_SELF support */ - if (isapi_special_server_variables[SPECIAL_VAR_PHP_SELF]) { - php_register_variable("PHP_SELF", isapi_special_server_variables[SPECIAL_VAR_PHP_SELF], track_vars_array TSRMLS_CC); - efree(isapi_special_server_variables[SPECIAL_VAR_PHP_SELF]); - } - - if (isapi_special_server_variables[SPECIAL_VAR_ALL_HTTP]) { - /* Register the internal bits of ALL_HTTP */ - variable = php_strtok_r(isapi_special_server_variables[SPECIAL_VAR_ALL_HTTP], "\r\n", &strtok_buf); - while (variable) { - char *colon = strchr(variable, ':'); - - if (colon) { - char *value = colon+1; - - while (*value==' ') { - value++; - } - *colon = 0; - php_register_variable(variable, value, track_vars_array TSRMLS_CC); - *colon = ':'; - } - variable = php_strtok_r(NULL, "\r\n", &strtok_buf); - } - efree(isapi_special_server_variables[SPECIAL_VAR_ALL_HTTP]); - } -} - - -static sapi_module_struct isapi_sapi_module = { - "isapi", /* name */ - "ISAPI", /* pretty name */ - - php_isapi_startup, /* startup */ - php_module_shutdown_wrapper, /* shutdown */ - - NULL, /* activate */ - NULL, /* deactivate */ - - sapi_isapi_ub_write, /* unbuffered write */ - NULL, /* flush */ - NULL, /* get uid */ - NULL, /* getenv */ - - 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 */ - - sapi_isapi_register_server_variables, /* register server variables */ - NULL, /* Log message */ - - STANDARD_SAPI_MODULE_PROPERTIES -}; - - -BOOL WINAPI GetFilterVersion(PHTTP_FILTER_VERSION pFilterVersion) -{ - bFilterLoaded = 1; - pFilterVersion->dwFilterVersion = HTTP_FILTER_REVISION; - strcpy(pFilterVersion->lpszFilterDesc, isapi_sapi_module.pretty_name); - pFilterVersion->dwFlags= (SF_NOTIFY_AUTHENTICATION | SF_NOTIFY_PREPROC_HEADERS); - return TRUE; -} - - -DWORD WINAPI HttpFilterProc(PHTTP_FILTER_CONTEXT pfc, DWORD notificationType, LPVOID pvNotification) -{ - TSRMLS_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); - } - return SF_STATUS_REQ_HANDLED_NOTIFICATION; - } - break; - } - return SF_STATUS_REQ_NEXT_NOTIFICATION; -} - - -static void init_request_info(LPEXTENSION_CONTROL_BLOCK lpECB TSRMLS_DC) -{ - DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE; - char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE]; -#ifndef WITH_ZEUS - HSE_URL_MAPEX_INFO humi; -#endif - - SG(request_info).request_method = lpECB->lpszMethod; - SG(request_info).query_string = lpECB->lpszQueryString; - SG(request_info).request_uri = lpECB->lpszPathInfo; - SG(request_info).content_type = lpECB->lpszContentType; - SG(request_info).content_length = lpECB->cbTotalBytes; - SG(sapi_headers).http_response_code = 200; /* I think dwHttpStatusCode is invalid at this stage -RL */ - if (!bFilterLoaded) { /* we don't have valid ISAPI Filter information */ - SG(request_info).auth_user = SG(request_info).auth_password = NULL; - } - -#ifdef WITH_ZEUS - /* PATH_TRANSLATED can contain extra PATH_INFO stuff after the - * file being loaded, so we must use SCRIPT_FILENAME instead - */ - if(lpECB->GetServerVariable(lpECB->ConnID, "SCRIPT_FILENAME", static_variable_buf, &variable_len)) { - SG(request_info).path_translated = estrdup(static_variable_buf); - } else -#else - /* happily, IIS gives us SCRIPT_NAME which is correct (without PATH_INFO stuff) - so we can just map that to the physical path and we have our filename */ - - lpECB->GetServerVariable(lpECB->ConnID, "SCRIPT_NAME", static_variable_buf, &variable_len); - if (lpECB->ServerSupportFunction(lpECB->ConnID, HSE_REQ_MAP_URL_TO_PATH_EX, static_variable_buf, &variable_len, (LPDWORD) &humi)) { - SG(request_info).path_translated = estrdup(humi.lpszPath); - } else -#endif - /* if mapping fails, default to what the server tells us */ - SG(request_info).path_translated = estrdup(lpECB->lpszPathTranslated); - - /* some server configurations allow '..' to slip through in the - translated path. We'll just refuse to handle such a path. */ - if (strstr(SG(request_info).path_translated,"..")) { - SG(sapi_headers).http_response_code = 404; - efree(SG(request_info).path_translated); - SG(request_info).path_translated = NULL; - } -} - - -static void php_isapi_report_exception(char *message, int message_len TSRMLS_DC) -{ - if (!SG(headers_sent)) { - HSE_SEND_HEADER_EX_INFO header_info; - LPEXTENSION_CONTROL_BLOCK lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context); - - header_info.pszStatus = "500 Internal Server Error"; - header_info.cchStatus = strlen(header_info.pszStatus); - header_info.pszHeader = "Content-Type: text/html\r\n\r\n"; - header_info.cchHeader = strlen(header_info.pszHeader); - - lpECB->dwHttpStatusCode = 500; - lpECB->ServerSupportFunction(lpECB->ConnID, HSE_REQ_SEND_RESPONSE_HEADER_EX, &header_info, NULL, NULL); - SG(headers_sent)=1; - } - sapi_isapi_ub_write(message, message_len TSRMLS_CC); -} - - -BOOL WINAPI GetExtensionVersion(HSE_VERSION_INFO *pVer) -{ - pVer->dwExtensionVersion = HSE_VERSION; -#ifdef WITH_ZEUS - strncpy( pVer->lpszExtensionDesc, isapi_sapi_module.name, HSE_MAX_EXT_DLL_NAME_LEN); -#else - lstrcpyn(pVer->lpszExtensionDesc, isapi_sapi_module.name, HSE_MAX_EXT_DLL_NAME_LEN); -#endif - return TRUE; -} - - -static void my_endthread() -{ -#ifdef PHP_WIN32 - if (bTerminateThreadsOnError) { - _endthread(); - } -#endif -} - -#ifdef PHP_WIN32 -/* ep is accessible only in the context of the __except expression, - * so we have to call this function to obtain it. - */ -BOOL exceptionhandler(LPEXCEPTION_POINTERS *e, LPEXCEPTION_POINTERS ep) -{ - *e=ep; - return TRUE; -} -#endif - -DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB) -{ - zend_file_handle file_handle; - zend_bool stack_overflown=0; - int retval = FAILURE; -#ifdef PHP_ENABLE_SEH - LPEXCEPTION_POINTERS e; -#endif - TSRMLS_FETCH(); - - zend_first_try { -#ifdef PHP_ENABLE_SEH - __try { -#endif - init_request_info(lpECB TSRMLS_CC); - SG(server_context) = lpECB; - - php_request_startup(TSRMLS_C); - - file_handle.filename = SG(request_info).path_translated; - file_handle.free_filename = 0; - file_handle.type = ZEND_HANDLE_FILENAME; - file_handle.opened_path = NULL; - - /* open the script here so we can 404 if it fails */ - if (file_handle.filename) - retval = php_fopen_primary_script(&file_handle TSRMLS_CC); - - if (!file_handle.filename || retval == FAILURE) { - SG(sapi_headers).http_response_code = 404; - PUTS("No input file specified.\n"); - } else { - php_execute_script(&file_handle TSRMLS_CC); - } - - if (SG(request_info).cookie_data) { - efree(SG(request_info).cookie_data); - } - if (SG(request_info).path_translated) - efree(SG(request_info).path_translated); -#ifdef PHP_ENABLE_SEH - } __except(exceptionhandler(&e, GetExceptionInformation())) { - char buf[1024]; - if (_exception_code()==EXCEPTION_STACK_OVERFLOW) { - LPBYTE lpPage; - static SYSTEM_INFO si; - static MEMORY_BASIC_INFORMATION mi; - static DWORD dwOldProtect; - - GetSystemInfo(&si); - - /* Get page ESP is pointing to */ - _asm mov lpPage, esp; - - /* Get stack allocation base */ - VirtualQuery(lpPage, &mi, sizeof(mi)); - - /* Go to the page below the current page */ - lpPage = (LPBYTE) (mi.BaseAddress) - si.dwPageSize; - - /* Free pages below current page */ - if (!VirtualFree(mi.AllocationBase, (LPBYTE)lpPage - (LPBYTE) mi.AllocationBase, MEM_DECOMMIT)) { - _endthread(); - } - - /* Restore the guard page */ - if (!VirtualProtect(lpPage, si.dwPageSize, PAGE_GUARD | PAGE_READWRITE, &dwOldProtect)) { - _endthread(); - } - - CG(unclean_shutdown)=1; - _snprintf(buf, sizeof(buf)-1,"PHP has encountered a Stack overflow"); - php_isapi_report_exception(buf, strlen(buf) TSRMLS_CC); - } else if (_exception_code()==EXCEPTION_ACCESS_VIOLATION) { - _snprintf(buf, sizeof(buf)-1,"PHP has encountered an Access Violation at %p", e->ExceptionRecord->ExceptionAddress); - php_isapi_report_exception(buf, strlen(buf) TSRMLS_CC); - my_endthread(); - } else { - _snprintf(buf, sizeof(buf)-1,"PHP has encountered an Unhandled Exception Code %d at %p", e->ExceptionRecord->ExceptionCode , e->ExceptionRecord->ExceptionAddress); - php_isapi_report_exception(buf, strlen(buf) TSRMLS_CC); - my_endthread(); - } - } -#endif -#ifdef PHP_ENABLE_SEH - __try { - php_request_shutdown(NULL); - } __except(EXCEPTION_EXECUTE_HANDLER) { - my_endthread(); - } -#else - php_request_shutdown(NULL); -#endif - } zend_catch { - zend_try { - php_request_shutdown(NULL); - } zend_end_try(); - return HSE_STATUS_ERROR; - } zend_end_try(); - - return HSE_STATUS_SUCCESS; -} - - - -__declspec(dllexport) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) -{ - switch (fdwReason) { - case DLL_PROCESS_ATTACH: -#ifdef WITH_ZEUS - tsrm_startup(128, 1, TSRM_ERROR_LEVEL_CORE, "TSRM.log"); -#else - tsrm_startup(128, 1, TSRM_ERROR_LEVEL_CORE, "C:\\TSRM.log"); -#endif - sapi_startup(&isapi_sapi_module); - if (isapi_sapi_module.startup) { - isapi_sapi_module.startup(&sapi_module); - } - break; - case DLL_THREAD_ATTACH: - break; - case DLL_THREAD_DETACH: - ts_free_thread(); - break; - case DLL_PROCESS_DETACH: - if (isapi_sapi_module.shutdown) { - isapi_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 7913ec6fad..0000000000 --- a/sapi/isapi/php4isapi.dsp +++ /dev/null @@ -1,165 +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 "php4isapi - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "php4isapi - Win32 Release_TSDbg" (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 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 "PHP4ISAPI_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "_DEBUG" /D "COMPILE_LIBZEND" /D ZEND_DEBUG=1 /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /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 wsock32.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 php4ts_debug.lib /nologo /version:4.0 /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 "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /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 /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS" - -!ELSEIF "$(CFG)" == "php4isapi - Win32 Release_TS_inline" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "php4isapi___Win32_Release_TS_inline" -# PROP BASE Intermediate_Dir "php4isapi___Win32_Release_TS_inline" -# PROP BASE Ignore_Export_Lib 0 -# 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 /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /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 CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /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 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" -# 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 /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS_inline" - -!ELSEIF "$(CFG)" == "php4isapi - Win32 Release_TSDbg" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "php4isapi___Win32_Release_TSDbg" -# PROP BASE Intermediate_Dir "php4isapi___Win32_Release_TSDbg" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\Release_TSDbg" -# PROP Intermediate_Dir "Release_TSDbg" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /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 wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS" -# 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 /version:4.0 /dll /debug /machine:I386 /libpath:"..\..\Release_TSDbg" - -!ENDIF - -# Begin Target - -# Name "php4isapi - Win32 Debug_TS" -# Name "php4isapi - Win32 Release_TS" -# Name "php4isapi - Win32 Release_TS_inline" -# Name "php4isapi - Win32 Release_TSDbg" -# 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/isapi/php5isapi.c b/sapi/isapi/php5isapi.c new file mode 100644 index 0000000000..b0d1366299 --- /dev/null +++ b/sapi/isapi/php5isapi.c @@ -0,0 +1,949 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2004 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.0 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_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: Zeev Suraski | + | Ben Mansell (Zeus Support) | + +----------------------------------------------------------------------+ + */ + +#include "php.h" +#include +#include +#include +#include "php_main.h" +#include "SAPI.h" +#include "php_globals.h" +#include "ext/standard/info.h" +#include "php_variables.h" +#include "php_ini.h" + +#ifdef PHP_WIN32 +# include +#else +# define __try +# define __except(val) +# define __declspec(foo) +#endif + + +#ifdef WITH_ZEUS +# include "httpext.h" +# include +# define GetLastError() errno +#endif + +#ifdef PHP_WIN32 +#define PHP_ENABLE_SEH +#endif + +/* +uncomment the following lines to turn off +exception trapping when running under a debugger + +#ifdef _DEBUG +#undef PHP_ENABLE_SEH +#endif +*/ + +#define MAX_STATUS_LENGTH sizeof("xxxx LONGEST STATUS DESCRIPTION") +#define ISAPI_SERVER_VAR_BUF_SIZE 1024 +#define ISAPI_POST_DATA_BUF 1024 + +static zend_bool bFilterLoaded=0; +static zend_bool bTerminateThreadsOnError=0; + +static char *isapi_special_server_variable_names[] = { + "ALL_HTTP", + "HTTPS", +#ifndef WITH_ZEUS + "SCRIPT_NAME", +#endif + NULL +}; + +#define NUM_SPECIAL_VARS (sizeof(isapi_special_server_variable_names)/sizeof(char *)) +#define SPECIAL_VAR_ALL_HTTP 0 +#define SPECIAL_VAR_HTTPS 1 +#define SPECIAL_VAR_PHP_SELF 2 + +static char *isapi_server_variable_names[] = { + "AUTH_PASSWORD", + "AUTH_TYPE", + "AUTH_USER", + "CONTENT_LENGTH", + "CONTENT_TYPE", + "PATH_TRANSLATED", + "QUERY_STRING", + "REMOTE_ADDR", + "REMOTE_HOST", + "REMOTE_USER", + "REQUEST_METHOD", + "SERVER_NAME", + "SERVER_PORT", + "SERVER_PROTOCOL", + "SERVER_SOFTWARE", +#ifndef WITH_ZEUS + "APPL_MD_PATH", + "APPL_PHYSICAL_PATH", + "INSTANCE_ID", + "INSTANCE_META_PATH", + "LOGON_USER", + "REQUEST_URI", + "URL", +#else + "DOCUMENT_ROOT", +#endif + NULL +}; + + +static char *isapi_secure_server_variable_names[] = { + "CERT_COOKIE", + "CERT_FLAGS", + "CERT_ISSUER", + "CERT_KEYSIZE", + "CERT_SECRETKEYSIZE", + "CERT_SERIALNUMBER", + "CERT_SERVER_ISSUER", + "CERT_SERVER_SUBJECT", + "CERT_SUBJECT", + "HTTPS_KEYSIZE", + "HTTPS_SECRETKEYSIZE", + "HTTPS_SERVER_ISSUER", + "HTTPS_SERVER_SUBJECT", + "SERVER_PORT_SECURE", +#ifdef WITH_ZEUS + "SSL_CLIENT_CN", + "SSL_CLIENT_EMAIL", + "SSL_CLIENT_OU", + "SSL_CLIENT_O", + "SSL_CLIENT_L", + "SSL_CLIENT_ST", + "SSL_CLIENT_C", + "SSL_CLIENT_I_CN", + "SSL_CLIENT_I_EMAIL", + "SSL_CLIENT_I_OU", + "SSL_CLIENT_I_O", + "SSL_CLIENT_I_L", + "SSL_CLIENT_I_ST", + "SSL_CLIENT_I_C", +#endif + NULL +}; + + +static void php_info_isapi(ZEND_MODULE_INFO_FUNC_ARGS) +{ + char **p; + char variable_buf[ISAPI_SERVER_VAR_BUF_SIZE]; + DWORD variable_len; + char **all_variables[] = { + isapi_server_variable_names, + isapi_special_server_variable_names, + isapi_secure_server_variable_names, + NULL + }; + char ***server_variable_names; + LPEXTENSION_CONTROL_BLOCK lpECB; + + lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context); + + php_info_print_table_start(); + php_info_print_table_header(2, "Server Variable", "Value"); + server_variable_names = all_variables; + while (*server_variable_names) { + p = *server_variable_names; + 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++; + } + server_variable_names++; + } + php_info_print_table_end(); +} + + +static zend_module_entry php_isapi_module = { + STANDARD_MODULE_HEADER, + "ISAPI", + NULL, + NULL, + NULL, + NULL, + NULL, + php_info_isapi, + NULL, + STANDARD_MODULE_PROPERTIES +}; + + +static int sapi_isapi_ub_write(const char *str, uint str_length TSRMLS_DC) +{ + DWORD num_bytes = str_length; + LPEXTENSION_CONTROL_BLOCK ecb; + + ecb = (LPEXTENSION_CONTROL_BLOCK) SG(server_context); + if (ecb->WriteClient(ecb->ConnID, (char *) str, &num_bytes, HSE_IO_SYNC) == FALSE) { + php_handle_aborted_connection(); + } + return num_bytes; +} + + +static int sapi_isapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC) +{ + return SAPI_HEADER_ADD; +} + + + +static void accumulate_header_length(sapi_header_struct *sapi_header, uint *total_length TSRMLS_DC) +{ + *total_length += sapi_header->header_len+2; +} + + +static void concat_header(sapi_header_struct *sapi_header, char **combined_headers_ptr TSRMLS_DC) +{ + 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 TSRMLS_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; + + /* Obtain headers length */ + if (SG(sapi_headers).send_default_content_type) { + sapi_get_default_content_type_header(&default_content_type TSRMLS_CC); + accumulate_header_length(&default_content_type, (void *) &total_length TSRMLS_CC); + } + zend_llist_apply_with_argument(&SG(sapi_headers).headers, (llist_apply_with_arg_func_t) accumulate_header_length, (void *) &total_length TSRMLS_CC); + + /* 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 TSRMLS_CC); + sapi_free_header(&default_content_type); /* we no longer need it */ + } + zend_llist_apply_with_argument(&SG(sapi_headers).headers, (llist_apply_with_arg_func_t) concat_header, (void *) &combined_headers_ptr TSRMLS_CC); + *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; + } + header_info.cchStatus = strlen(header_info.pszStatus); + header_info.pszHeader = combined_headers; + header_info.cchHeader = total_length; + header_info.fKeepConn = FALSE; + 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); + return SAPI_HEADER_SENT_SUCCESSFULLY; +} + + +static int php_isapi_startup(sapi_module_struct *sapi_module) +{ + if (php_module_startup(sapi_module, &php_isapi_module, 1)==FAILURE) { + return FAILURE; + } else { + bTerminateThreadsOnError = (zend_bool) INI_INT("isapi.terminate_threads_on_error"); + return SUCCESS; + } +} + + + +static int sapi_isapi_read_post(char *buffer, uint count_bytes TSRMLS_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 ((DWORD) 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_bufcbTotalBytes) { + 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; + } + return total_read; +} + + +static char *sapi_isapi_read_cookies(TSRMLS_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; +} + + +#ifdef WITH_ZEUS + +static void sapi_isapi_register_zeus_ssl_variables(LPEXTENSION_CONTROL_BLOCK lpECB, zval *track_vars_array TSRMLS_DC) +{ + char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE]; + DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE; + char static_cons_buf[ISAPI_SERVER_VAR_BUF_SIZE]; + /* + * We need to construct the /C=.../ST=... + * DN's for SSL_CLIENT_DN and SSL_CLIENT_I_DN + */ + strcpy( static_cons_buf, "/C=" ); + if( lpECB->GetServerVariable( lpECB->ConnID, "SSL_CLIENT_C", static_variable_buf, &variable_len ) && static_variable_buf[0] ) { + strcat( static_cons_buf, static_variable_buf ); + } + strcat( static_cons_buf, "/ST=" ); + variable_len = ISAPI_SERVER_VAR_BUF_SIZE; + if( lpECB->GetServerVariable( lpECB->ConnID, "SSL_CLIENT_ST", static_variable_buf, &variable_len ) && static_variable_buf[0] ) { + strcat( static_cons_buf, static_variable_buf ); + } + php_register_variable( "SSL_CLIENT_DN", static_cons_buf, track_vars_array TSRMLS_CC ); + + strcpy( static_cons_buf, "/C=" ); + variable_len = ISAPI_SERVER_VAR_BUF_SIZE; + if( lpECB->GetServerVariable( lpECB->ConnID, "SSL_CLIENT_I_C", static_variable_buf, &variable_len ) && static_variable_buf[0] ) { + strcat( static_cons_buf, static_variable_buf ); + } + strcat( static_cons_buf, "/ST=" ); + variable_len = ISAPI_SERVER_VAR_BUF_SIZE; + if( lpECB->GetServerVariable( lpECB->ConnID, "SSL_CLIENT_I_ST", static_variable_buf, &variable_len ) && static_variable_buf[0] ) { + strcat( static_cons_buf, static_variable_buf ); + } + php_register_variable( "SSL_CLIENT_I_DN", static_cons_buf, track_vars_array TSRMLS_CC ); +} + +static void sapi_isapi_register_zeus_variables(LPEXTENSION_CONTROL_BLOCK lpECB, zval *track_vars_array TSRMLS_DC) +{ + char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE]; + DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE; + DWORD scriptname_len = ISAPI_SERVER_VAR_BUF_SIZE; + DWORD pathinfo_len = 0; + char *strtok_buf = NULL; + + /* Get SCRIPT_NAME, we use this to work out which bit of the URL + * belongs in PHP's version of PATH_INFO + */ + lpECB->GetServerVariable(lpECB->ConnID, "SCRIPT_NAME", static_variable_buf, &scriptname_len); + + /* Adjust Zeus' version of PATH_INFO, set PHP_SELF, + * and generate REQUEST_URI + */ + if ( lpECB->GetServerVariable(lpECB->ConnID, "PATH_INFO", static_variable_buf, &variable_len) && static_variable_buf[0] ) { + + /* PHP_SELF is just PATH_INFO */ + php_register_variable( "PHP_SELF", static_variable_buf, track_vars_array TSRMLS_CC ); + + /* Chop off filename to get just the 'real' PATH_INFO' */ + pathinfo_len = variable_len - scriptname_len; + php_register_variable( "PATH_INFO", static_variable_buf + scriptname_len - 1, track_vars_array TSRMLS_CC ); + /* append query string to give url... extra byte for '?' */ + if ( strlen(lpECB->lpszQueryString) + variable_len + 1 < ISAPI_SERVER_VAR_BUF_SIZE ) { + /* append query string only if it is present... */ + if ( strlen(lpECB->lpszQueryString) ) { + static_variable_buf[ variable_len - 1 ] = '?'; + strcpy( static_variable_buf + variable_len, lpECB->lpszQueryString ); + } + php_register_variable( "URL", static_variable_buf, track_vars_array TSRMLS_CC ); + php_register_variable( "REQUEST_URI", static_variable_buf, track_vars_array TSRMLS_CC ); + } + } + + /* Get and adjust PATH_TRANSLATED to what PHP wants */ + variable_len = ISAPI_SERVER_VAR_BUF_SIZE; + if ( lpECB->GetServerVariable(lpECB->ConnID, "PATH_TRANSLATED", static_variable_buf, &variable_len) && static_variable_buf[0] ) { + static_variable_buf[ variable_len - pathinfo_len - 1 ] = '\0'; + php_register_variable( "PATH_TRANSLATED", static_variable_buf, track_vars_array TSRMLS_CC ); + } + + /* Bring in the AUTHENTICATION stuff as needed */ + variable_len = ISAPI_SERVER_VAR_BUF_SIZE; + if ( lpECB->GetServerVariable(lpECB->ConnID, "AUTH_USER", static_variable_buf, &variable_len) && static_variable_buf[0] ) { + php_register_variable( "PHP_AUTH_USER", static_variable_buf, track_vars_array TSRMLS_CC ); + } + variable_len = ISAPI_SERVER_VAR_BUF_SIZE; + if ( lpECB->GetServerVariable(lpECB->ConnID, "AUTH_PASSWORD", static_variable_buf, &variable_len) && static_variable_buf[0] ) { + php_register_variable( "PHP_AUTH_PW", static_variable_buf, track_vars_array TSRMLS_CC ); + } + variable_len = ISAPI_SERVER_VAR_BUF_SIZE; + if ( lpECB->GetServerVariable(lpECB->ConnID, "AUTH_TYPE", static_variable_buf, &variable_len) && static_variable_buf[0] ) { + php_register_variable( "AUTH_TYPE", static_variable_buf, track_vars_array TSRMLS_CC ); + } + + /* And now, for the SSL variables (if applicable) */ + variable_len = ISAPI_SERVER_VAR_BUF_SIZE; + if ( lpECB->GetServerVariable(lpECB->ConnID, "CERT_COOKIE", static_variable_buf, &variable_len) && static_variable_buf[0] ) { + sapi_isapi_register_zeus_ssl_variables( lpECB, track_vars_array TSRMLS_CC ); + } + /* Copy some of the variables we need to meet Apache specs */ + variable_len = ISAPI_SERVER_VAR_BUF_SIZE; + if ( lpECB->GetServerVariable(lpECB->ConnID, "SERVER_SOFTWARE", static_variable_buf, &variable_len) && static_variable_buf[0] ) { + php_register_variable( "SERVER_SIGNATURE", static_variable_buf, track_vars_array TSRMLS_CC ); + } +} +#else + +static void sapi_isapi_register_iis_variables(LPEXTENSION_CONTROL_BLOCK lpECB, zval *track_vars_array TSRMLS_DC) +{ + char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE]; + char path_info_buf[ISAPI_SERVER_VAR_BUF_SIZE]; + DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE; + DWORD scriptname_len = ISAPI_SERVER_VAR_BUF_SIZE; + DWORD pathinfo_len = 0; + HSE_URL_MAPEX_INFO humi; + + /* Get SCRIPT_NAME, we use this to work out which bit of the URL + * belongs in PHP's version of PATH_INFO. SCRIPT_NAME also becomes PHP_SELF. + */ + lpECB->GetServerVariable(lpECB->ConnID, "SCRIPT_NAME", static_variable_buf, &scriptname_len); + php_register_variable("SCRIPT_FILENAME", SG(request_info).path_translated, track_vars_array TSRMLS_CC); + + /* Adjust IIS' version of PATH_INFO, set PHP_SELF, + * and generate REQUEST_URI + * Get and adjust PATH_TRANSLATED to what PHP wants + */ + if ( lpECB->GetServerVariable(lpECB->ConnID, "PATH_INFO", static_variable_buf, &variable_len) && static_variable_buf[0] ) { + + /* Chop off filename to get just the 'real' PATH_INFO' */ + php_register_variable( "ORIG_PATH_INFO", static_variable_buf, track_vars_array TSRMLS_CC ); + pathinfo_len = variable_len - scriptname_len; + strncpy(path_info_buf, static_variable_buf + scriptname_len - 1, sizeof(path_info_buf)-1); + php_register_variable( "PATH_INFO", path_info_buf, track_vars_array TSRMLS_CC ); + /* append query string to give url... extra byte for '?' */ + if ( strlen(lpECB->lpszQueryString) + variable_len + 1 < ISAPI_SERVER_VAR_BUF_SIZE ) { + /* append query string only if it is present... */ + if ( strlen(lpECB->lpszQueryString) ) { + static_variable_buf[ variable_len - 1 ] = '?'; + strcpy( static_variable_buf + variable_len, lpECB->lpszQueryString ); + } + php_register_variable( "URL", static_variable_buf, track_vars_array TSRMLS_CC ); + php_register_variable( "REQUEST_URI", static_variable_buf, track_vars_array TSRMLS_CC ); + } + variable_len = ISAPI_SERVER_VAR_BUF_SIZE; + if ( lpECB->GetServerVariable(lpECB->ConnID, "PATH_TRANSLATED", static_variable_buf, &variable_len) && static_variable_buf[0] ) { + php_register_variable( "ORIG_PATH_TRANSLATED", static_variable_buf, track_vars_array TSRMLS_CC ); + } + if (lpECB->ServerSupportFunction(lpECB->ConnID, HSE_REQ_MAP_URL_TO_PATH_EX, path_info_buf, &pathinfo_len, (LPDWORD) &humi)) { + /* Remove trailing \ */ + if (humi.lpszPath[variable_len-2] == '\\') { + humi.lpszPath[variable_len-2] = 0; + } + php_register_variable("PATH_TRANSLATED", humi.lpszPath, track_vars_array TSRMLS_CC); + } + } + + static_variable_buf[0] = '/'; + static_variable_buf[1] = 0; + variable_len = 2; + if (lpECB->ServerSupportFunction(lpECB->ConnID, HSE_REQ_MAP_URL_TO_PATH_EX, static_variable_buf, &variable_len, (LPDWORD) &humi)) { + /* Remove trailing \ */ + if (humi.lpszPath[variable_len-2] == '\\') { + humi.lpszPath[variable_len-2] = 0; + } + php_register_variable("DOCUMENT_ROOT", humi.lpszPath, track_vars_array TSRMLS_CC); + } + + if (!SG(request_info).auth_user || !SG(request_info).auth_password || + !SG(request_info).auth_user[0] || !SG(request_info).auth_password[0]) { + variable_len = ISAPI_SERVER_VAR_BUF_SIZE; + if (lpECB->GetServerVariable(lpECB->ConnID, "HTTP_AUTHORIZATION", static_variable_buf, &variable_len) + && static_variable_buf[0]) { + php_handle_auth_data(static_variable_buf TSRMLS_CC); + } + } + + if (SG(request_info).auth_user) { + php_register_variable("PHP_AUTH_USER", SG(request_info).auth_user, track_vars_array TSRMLS_CC ); + } + if (SG(request_info).auth_password) { + php_register_variable("PHP_AUTH_PW", SG(request_info).auth_password, track_vars_array TSRMLS_CC ); + } +} +#endif + +static void sapi_isapi_register_server_variables2(char **server_variables, LPEXTENSION_CONTROL_BLOCK lpECB, zval *track_vars_array, char **recorded_values TSRMLS_DC) +{ + char **p=server_variables; + DWORD variable_len; + char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE]; + char *variable_buf; + + while (*p) { + variable_len = ISAPI_SERVER_VAR_BUF_SIZE; + if (lpECB->GetServerVariable(lpECB->ConnID, *p, static_variable_buf, &variable_len) + && static_variable_buf[0]) { + php_register_variable(*p, static_variable_buf, track_vars_array TSRMLS_CC); + if (recorded_values) { + recorded_values[p-server_variables] = estrndup(static_variable_buf, variable_len); + } + } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) { + variable_buf = (char *) emalloc(variable_len+1); + if (lpECB->GetServerVariable(lpECB->ConnID, *p, variable_buf, &variable_len) + && variable_buf[0]) { + php_register_variable(*p, variable_buf, track_vars_array TSRMLS_CC); + } + if (recorded_values) { + recorded_values[p-server_variables] = variable_buf; + } else { + efree(variable_buf); + } + } + p++; + } +} + + +static void sapi_isapi_register_server_variables(zval *track_vars_array TSRMLS_DC) +{ + DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE; + char *variable; + char *strtok_buf = NULL; + char *isapi_special_server_variables[NUM_SPECIAL_VARS]; + LPEXTENSION_CONTROL_BLOCK lpECB; + + lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context); + + /* Register the special ISAPI variables */ + memset(isapi_special_server_variables, 0, sizeof(isapi_special_server_variables)); + sapi_isapi_register_server_variables2(isapi_special_server_variable_names, lpECB, track_vars_array, isapi_special_server_variables TSRMLS_CC); + if (SG(request_info).cookie_data) { + php_register_variable("HTTP_COOKIE", SG(request_info).cookie_data, track_vars_array TSRMLS_CC); + } + + /* Register the standard ISAPI variables */ + sapi_isapi_register_server_variables2(isapi_server_variable_names, lpECB, track_vars_array, NULL TSRMLS_CC); + + if (isapi_special_server_variables[SPECIAL_VAR_HTTPS] + && (atoi(isapi_special_server_variables[SPECIAL_VAR_HTTPS]) + || !strcasecmp(isapi_special_server_variables[SPECIAL_VAR_HTTPS], "on")) + ) { + /* Register SSL ISAPI variables */ + sapi_isapi_register_server_variables2(isapi_secure_server_variable_names, lpECB, track_vars_array, NULL TSRMLS_CC); + } + + if (isapi_special_server_variables[SPECIAL_VAR_HTTPS]) { + efree(isapi_special_server_variables[SPECIAL_VAR_HTTPS]); + } + + +#ifdef WITH_ZEUS + sapi_isapi_register_zeus_variables(lpECB, track_vars_array TSRMLS_CC); +#else + sapi_isapi_register_iis_variables(lpECB, track_vars_array TSRMLS_CC); +#endif + + /* PHP_SELF support */ + if (isapi_special_server_variables[SPECIAL_VAR_PHP_SELF]) { + php_register_variable("PHP_SELF", isapi_special_server_variables[SPECIAL_VAR_PHP_SELF], track_vars_array TSRMLS_CC); + efree(isapi_special_server_variables[SPECIAL_VAR_PHP_SELF]); + } + + if (isapi_special_server_variables[SPECIAL_VAR_ALL_HTTP]) { + /* Register the internal bits of ALL_HTTP */ + variable = php_strtok_r(isapi_special_server_variables[SPECIAL_VAR_ALL_HTTP], "\r\n", &strtok_buf); + while (variable) { + char *colon = strchr(variable, ':'); + + if (colon) { + char *value = colon+1; + + while (*value==' ') { + value++; + } + *colon = 0; + php_register_variable(variable, value, track_vars_array TSRMLS_CC); + *colon = ':'; + } + variable = php_strtok_r(NULL, "\r\n", &strtok_buf); + } + efree(isapi_special_server_variables[SPECIAL_VAR_ALL_HTTP]); + } +} + + +static sapi_module_struct isapi_sapi_module = { + "isapi", /* name */ + "ISAPI", /* pretty name */ + + php_isapi_startup, /* startup */ + php_module_shutdown_wrapper, /* shutdown */ + + NULL, /* activate */ + NULL, /* deactivate */ + + sapi_isapi_ub_write, /* unbuffered write */ + NULL, /* flush */ + NULL, /* get uid */ + NULL, /* getenv */ + + 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 */ + + sapi_isapi_register_server_variables, /* register server variables */ + NULL, /* Log message */ + + STANDARD_SAPI_MODULE_PROPERTIES +}; + + +BOOL WINAPI GetFilterVersion(PHTTP_FILTER_VERSION pFilterVersion) +{ + bFilterLoaded = 1; + pFilterVersion->dwFilterVersion = HTTP_FILTER_REVISION; + strcpy(pFilterVersion->lpszFilterDesc, isapi_sapi_module.pretty_name); + pFilterVersion->dwFlags= (SF_NOTIFY_AUTHENTICATION | SF_NOTIFY_PREPROC_HEADERS); + return TRUE; +} + + +DWORD WINAPI HttpFilterProc(PHTTP_FILTER_CONTEXT pfc, DWORD notificationType, LPVOID pvNotification) +{ + TSRMLS_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); + } + return SF_STATUS_REQ_HANDLED_NOTIFICATION; + } + break; + } + return SF_STATUS_REQ_NEXT_NOTIFICATION; +} + + +static void init_request_info(LPEXTENSION_CONTROL_BLOCK lpECB TSRMLS_DC) +{ + DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE; + char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE]; +#ifndef WITH_ZEUS + HSE_URL_MAPEX_INFO humi; +#endif + + SG(request_info).request_method = lpECB->lpszMethod; + SG(request_info).query_string = lpECB->lpszQueryString; + SG(request_info).request_uri = lpECB->lpszPathInfo; + SG(request_info).content_type = lpECB->lpszContentType; + SG(request_info).content_length = lpECB->cbTotalBytes; + SG(sapi_headers).http_response_code = 200; /* I think dwHttpStatusCode is invalid at this stage -RL */ + if (!bFilterLoaded) { /* we don't have valid ISAPI Filter information */ + SG(request_info).auth_user = SG(request_info).auth_password = NULL; + } + +#ifdef WITH_ZEUS + /* PATH_TRANSLATED can contain extra PATH_INFO stuff after the + * file being loaded, so we must use SCRIPT_FILENAME instead + */ + if(lpECB->GetServerVariable(lpECB->ConnID, "SCRIPT_FILENAME", static_variable_buf, &variable_len)) { + SG(request_info).path_translated = estrdup(static_variable_buf); + } else +#else + /* happily, IIS gives us SCRIPT_NAME which is correct (without PATH_INFO stuff) + so we can just map that to the physical path and we have our filename */ + + lpECB->GetServerVariable(lpECB->ConnID, "SCRIPT_NAME", static_variable_buf, &variable_len); + if (lpECB->ServerSupportFunction(lpECB->ConnID, HSE_REQ_MAP_URL_TO_PATH_EX, static_variable_buf, &variable_len, (LPDWORD) &humi)) { + SG(request_info).path_translated = estrdup(humi.lpszPath); + } else +#endif + /* if mapping fails, default to what the server tells us */ + SG(request_info).path_translated = estrdup(lpECB->lpszPathTranslated); + + /* some server configurations allow '..' to slip through in the + translated path. We'll just refuse to handle such a path. */ + if (strstr(SG(request_info).path_translated,"..")) { + SG(sapi_headers).http_response_code = 404; + efree(SG(request_info).path_translated); + SG(request_info).path_translated = NULL; + } +} + + +static void php_isapi_report_exception(char *message, int message_len TSRMLS_DC) +{ + if (!SG(headers_sent)) { + HSE_SEND_HEADER_EX_INFO header_info; + LPEXTENSION_CONTROL_BLOCK lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context); + + header_info.pszStatus = "500 Internal Server Error"; + header_info.cchStatus = strlen(header_info.pszStatus); + header_info.pszHeader = "Content-Type: text/html\r\n\r\n"; + header_info.cchHeader = strlen(header_info.pszHeader); + + lpECB->dwHttpStatusCode = 500; + lpECB->ServerSupportFunction(lpECB->ConnID, HSE_REQ_SEND_RESPONSE_HEADER_EX, &header_info, NULL, NULL); + SG(headers_sent)=1; + } + sapi_isapi_ub_write(message, message_len TSRMLS_CC); +} + + +BOOL WINAPI GetExtensionVersion(HSE_VERSION_INFO *pVer) +{ + pVer->dwExtensionVersion = HSE_VERSION; +#ifdef WITH_ZEUS + strncpy( pVer->lpszExtensionDesc, isapi_sapi_module.name, HSE_MAX_EXT_DLL_NAME_LEN); +#else + lstrcpyn(pVer->lpszExtensionDesc, isapi_sapi_module.name, HSE_MAX_EXT_DLL_NAME_LEN); +#endif + return TRUE; +} + + +static void my_endthread() +{ +#ifdef PHP_WIN32 + if (bTerminateThreadsOnError) { + _endthread(); + } +#endif +} + +#ifdef PHP_WIN32 +/* ep is accessible only in the context of the __except expression, + * so we have to call this function to obtain it. + */ +BOOL exceptionhandler(LPEXCEPTION_POINTERS *e, LPEXCEPTION_POINTERS ep) +{ + *e=ep; + return TRUE; +} +#endif + +DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB) +{ + zend_file_handle file_handle; + zend_bool stack_overflown=0; + int retval = FAILURE; +#ifdef PHP_ENABLE_SEH + LPEXCEPTION_POINTERS e; +#endif + TSRMLS_FETCH(); + + zend_first_try { +#ifdef PHP_ENABLE_SEH + __try { +#endif + init_request_info(lpECB TSRMLS_CC); + SG(server_context) = lpECB; + + php_request_startup(TSRMLS_C); + + file_handle.filename = SG(request_info).path_translated; + file_handle.free_filename = 0; + file_handle.type = ZEND_HANDLE_FILENAME; + file_handle.opened_path = NULL; + + /* open the script here so we can 404 if it fails */ + if (file_handle.filename) + retval = php_fopen_primary_script(&file_handle TSRMLS_CC); + + if (!file_handle.filename || retval == FAILURE) { + SG(sapi_headers).http_response_code = 404; + PUTS("No input file specified.\n"); + } else { + php_execute_script(&file_handle TSRMLS_CC); + } + + if (SG(request_info).cookie_data) { + efree(SG(request_info).cookie_data); + } + if (SG(request_info).path_translated) + efree(SG(request_info).path_translated); +#ifdef PHP_ENABLE_SEH + } __except(exceptionhandler(&e, GetExceptionInformation())) { + char buf[1024]; + if (_exception_code()==EXCEPTION_STACK_OVERFLOW) { + LPBYTE lpPage; + static SYSTEM_INFO si; + static MEMORY_BASIC_INFORMATION mi; + static DWORD dwOldProtect; + + GetSystemInfo(&si); + + /* Get page ESP is pointing to */ + _asm mov lpPage, esp; + + /* Get stack allocation base */ + VirtualQuery(lpPage, &mi, sizeof(mi)); + + /* Go to the page below the current page */ + lpPage = (LPBYTE) (mi.BaseAddress) - si.dwPageSize; + + /* Free pages below current page */ + if (!VirtualFree(mi.AllocationBase, (LPBYTE)lpPage - (LPBYTE) mi.AllocationBase, MEM_DECOMMIT)) { + _endthread(); + } + + /* Restore the guard page */ + if (!VirtualProtect(lpPage, si.dwPageSize, PAGE_GUARD | PAGE_READWRITE, &dwOldProtect)) { + _endthread(); + } + + CG(unclean_shutdown)=1; + _snprintf(buf, sizeof(buf)-1,"PHP has encountered a Stack overflow"); + php_isapi_report_exception(buf, strlen(buf) TSRMLS_CC); + } else if (_exception_code()==EXCEPTION_ACCESS_VIOLATION) { + _snprintf(buf, sizeof(buf)-1,"PHP has encountered an Access Violation at %p", e->ExceptionRecord->ExceptionAddress); + php_isapi_report_exception(buf, strlen(buf) TSRMLS_CC); + my_endthread(); + } else { + _snprintf(buf, sizeof(buf)-1,"PHP has encountered an Unhandled Exception Code %d at %p", e->ExceptionRecord->ExceptionCode , e->ExceptionRecord->ExceptionAddress); + php_isapi_report_exception(buf, strlen(buf) TSRMLS_CC); + my_endthread(); + } + } +#endif +#ifdef PHP_ENABLE_SEH + __try { + php_request_shutdown(NULL); + } __except(EXCEPTION_EXECUTE_HANDLER) { + my_endthread(); + } +#else + php_request_shutdown(NULL); +#endif + } zend_catch { + zend_try { + php_request_shutdown(NULL); + } zend_end_try(); + return HSE_STATUS_ERROR; + } zend_end_try(); + + return HSE_STATUS_SUCCESS; +} + + + +__declspec(dllexport) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + switch (fdwReason) { + case DLL_PROCESS_ATTACH: +#ifdef WITH_ZEUS + tsrm_startup(128, 1, TSRM_ERROR_LEVEL_CORE, "TSRM.log"); +#else + tsrm_startup(128, 1, TSRM_ERROR_LEVEL_CORE, "C:\\TSRM.log"); +#endif + sapi_startup(&isapi_sapi_module); + if (isapi_sapi_module.startup) { + isapi_sapi_module.startup(&sapi_module); + } + break; + case DLL_THREAD_ATTACH: + break; + case DLL_THREAD_DETACH: + ts_free_thread(); + break; + case DLL_PROCESS_DETACH: + if (isapi_sapi_module.shutdown) { + isapi_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/php5isapi.def b/sapi/isapi/php5isapi.def new file mode 100644 index 0000000000..596023ef55 --- /dev/null +++ b/sapi/isapi/php5isapi.def @@ -0,0 +1,5 @@ +EXPORTS +HttpFilterProc +GetFilterVersion +HttpExtensionProc +GetExtensionVersion diff --git a/sapi/isapi/php5isapi.dsp b/sapi/isapi/php5isapi.dsp new file mode 100644 index 0000000000..3dbab11eff --- /dev/null +++ b/sapi/isapi/php5isapi.dsp @@ -0,0 +1,165 @@ +# Microsoft Developer Studio Project File - Name="php5isapi" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=php5isapi - 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 "php5isapi.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 "php5isapi.mak" CFG="php5isapi - Win32 Debug_TS" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "php5isapi - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "php5isapi - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "php5isapi - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "php5isapi - Win32 Release_TSDbg" (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)" == "php5isapi - 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 "PHP5ISAPI_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "_DEBUG" /D "COMPILE_LIBZEND" /D ZEND_DEBUG=1 /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /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 wsock32.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 php5ts_debug.lib /nologo /version:4.0 /dll /debug /machine:I386 /nodefaultlib:"libcmt" /pdbtype:sept /libpath:"..\..\Debug_TS" + +!ELSEIF "$(CFG)" == "php5isapi - 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 "PHP5ISAPI_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /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 php5ts.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS" + +!ELSEIF "$(CFG)" == "php5isapi - Win32 Release_TS_inline" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "php5isapi___Win32_Release_TS_inline" +# PROP BASE Intermediate_Dir "php5isapi___Win32_Release_TS_inline" +# PROP BASE Ignore_Export_Lib 0 +# 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 /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /FR /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /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 wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386 /libpath:"..\..\Release_TS" +# 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 php5ts.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS_inline" + +!ELSEIF "$(CFG)" == "php5isapi - Win32 Release_TSDbg" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "php5isapi___Win32_Release_TSDbg" +# PROP BASE Intermediate_Dir "php5isapi___Win32_Release_TSDbg" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\..\Release_TSDbg" +# PROP Intermediate_Dir "Release_TSDbg" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /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 wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS" +# 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 php5ts.lib /nologo /version:4.0 /dll /debug /machine:I386 /libpath:"..\..\Release_TSDbg" + +!ENDIF + +# Begin Target + +# Name "php5isapi - Win32 Debug_TS" +# Name "php5isapi - Win32 Release_TS" +# Name "php5isapi - Win32 Release_TS_inline" +# Name "php5isapi - Win32 Release_TSDbg" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\php5isapi.c +# End Source File +# Begin Source File + +SOURCE=.\php5isapi.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/isapi/stresstest/notes.txt b/sapi/isapi/stresstest/notes.txt index 2bab38dd07..f58ab3c0e9 100644 --- a/sapi/isapi/stresstest/notes.txt +++ b/sapi/isapi/stresstest/notes.txt @@ -44,7 +44,7 @@ Run: stresstest L files.txt supply the path to the parent of the "tests" directory (expect a couple long pauses for a couple of the larger tests) -Run: stresstest T c:\php4-source +Run: stresstest T c:\php5-source diff --git a/sapi/isapi/stresstest/stresstest.cpp b/sapi/isapi/stresstest/stresstest.cpp index bf268f4e23..c7e634c152 100644 --- a/sapi/isapi/stresstest/stresstest.cpp +++ b/sapi/isapi/stresstest/stresstest.cpp @@ -529,7 +529,7 @@ int main(int argc, char* argv[]) 0, NULL ); - fprintf(stderr,"Error: Dll 'php4isapi.dll' not found -%d\n%s\n", GetLastError(), lpMsgBuf); + fprintf(stderr,"Error: Dll 'php5isapi.dll' not found -%d\n%s\n", GetLastError(), lpMsgBuf); free (module); free(filelist); LocalFree( lpMsgBuf ); diff --git a/sapi/nsapi/php4nsapi.dsp b/sapi/nsapi/php4nsapi.dsp deleted file mode 100644 index 9b0b8c9a56..0000000000 --- a/sapi/nsapi/php4nsapi.dsp +++ /dev/null @@ -1,135 +0,0 @@ -# Microsoft Developer Studio Project File - Name="php4nsapi" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=php4nsapi - 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 "php4nsapi.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 "php4nsapi.mak" CFG="php4nsapi - Win32 Debug_TS" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "php4nsapi - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "php4nsapi - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "php4nsapi - 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)" == "php4nsapi - Win32 Release_TS" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "php4nsapi___Win32_Release_TS" -# PROP BASE Intermediate_Dir "php4nsapi___Win32_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 "php4nsapi_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 "XP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "php4nsapi_EXPORTS" /D "WIN32" /D "_MBCS" /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 ns-httpd30.lib php4ts.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 /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Release_TS" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\Zend\Release_TS" - -!ELSEIF "$(CFG)" == "php4nsapi - Win32 Release_TS_inline" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "php4nsapi___Win32_Release_TS_inline" -# PROP BASE Intermediate_Dir "php4nsapi___Win32_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 "php4nsapi_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 "XP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "php4nsapi_EXPORTS" /D "WIN32" /D "_MBCS" /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 ns-httpd30.lib php4ts.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 /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Release_TS_inline" /libpath:"..\..\TSRM\Release_TS_inline" /libpath:"..\..\Zend\Release_TS_inline" - -!ELSEIF "$(CFG)" == "php4nsapi - Win32 Debug_TS" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "php4nsapi___Win32_Debug_TS" -# PROP BASE Intermediate_Dir "php4nsapi___Win32_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 "php4nsapi_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_TS" /D ZEND_DEBUG=1 /D "_DEBUG" /D "XP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "php4nsapi_EXPORTS" /D "WIN32" /D "_MBCS" /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 ns-httpd30.lib php4ts_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 /pdbtype:sept /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Debug_TS" /libpath:"..\..\TSRM\Debug_TS" /libpath:"..\..\Zend\Debug_TS" - -!ENDIF - -# Begin Target - -# Name "php4nsapi - Win32 Release_TS" -# Name "php4nsapi - Win32 Release_TS_inline" -# Name "php4nsapi - Win32 Debug_TS" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\nsapi.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 diff --git a/sapi/nsapi/php5nsapi.dsp b/sapi/nsapi/php5nsapi.dsp new file mode 100644 index 0000000000..6cd0079b43 --- /dev/null +++ b/sapi/nsapi/php5nsapi.dsp @@ -0,0 +1,135 @@ +# Microsoft Developer Studio Project File - Name="php5nsapi" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=php5nsapi - 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 "php5nsapi.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 "php5nsapi.mak" CFG="php5nsapi - Win32 Debug_TS" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "php5nsapi - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "php5nsapi - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "php5nsapi - 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)" == "php5nsapi - Win32 Release_TS" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "php5nsapi___Win32_Release_TS" +# PROP BASE Intermediate_Dir "php5nsapi___Win32_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 "php5nsapi_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 "XP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "php5nsapi_EXPORTS" /D "WIN32" /D "_MBCS" /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 ns-httpd30.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 /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Release_TS" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\Zend\Release_TS" + +!ELSEIF "$(CFG)" == "php5nsapi - Win32 Release_TS_inline" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "php5nsapi___Win32_Release_TS_inline" +# PROP BASE Intermediate_Dir "php5nsapi___Win32_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 "php5nsapi_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 "XP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "php5nsapi_EXPORTS" /D "WIN32" /D "_MBCS" /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 ns-httpd30.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 /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Release_TS_inline" /libpath:"..\..\TSRM\Release_TS_inline" /libpath:"..\..\Zend\Release_TS_inline" + +!ELSEIF "$(CFG)" == "php5nsapi - Win32 Debug_TS" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "php5nsapi___Win32_Debug_TS" +# PROP BASE Intermediate_Dir "php5nsapi___Win32_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 "php5nsapi_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_TS" /D ZEND_DEBUG=1 /D "_DEBUG" /D "XP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "php5nsapi_EXPORTS" /D "WIN32" /D "_MBCS" /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 ns-httpd30.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 /pdbtype:sept /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Debug_TS" /libpath:"..\..\TSRM\Debug_TS" /libpath:"..\..\Zend\Debug_TS" + +!ENDIF + +# Begin Target + +# Name "php5nsapi - Win32 Release_TS" +# Name "php5nsapi - Win32 Release_TS_inline" +# Name "php5nsapi - Win32 Debug_TS" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\nsapi.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 diff --git a/sapi/pi3web/README b/sapi/pi3web/README index 8d7e9dc274..e3e523e940 100644 --- a/sapi/pi3web/README +++ b/sapi/pi3web/README @@ -1,36 +1,36 @@ -PHP4 Module +PHP5 Module ========== -This module requires PHP4 as thread safe shared library. Have a look +This module requires PHP5 as thread safe shared library. Have a look into the INSTALL file which accompanies that distribution. If you distribute this software bundled with the PHP software in source or binary form, then you must adhere to the PHP copyright conditions - the terms are reasonable. -You should have checked out and built the PHP4 source package from the -PHP CVS tree into the Pi3Web source directory called 'PHP4' first. Then -build PHP4 as Pi3Web module and after that build the Pi3Web PHP4 wrapper: +You should have checked out and built the PHP5 source package from the +PHP CVS tree into the Pi3Web source directory called 'PHP5' first. Then +build PHP5 as Pi3Web module and after that build the Pi3Web PHP5 wrapper: -1. Checkout PHP4 +1. Checkout PHP5 ================ cvs -d :pserver:cvsread@cvs.php.net:/repository login The required password is phpfi -cvs -z3 -d :pserver:cvsread@cvs.php.net:/repository co php4 +cvs -z3 -d :pserver:cvsread@cvs.php.net:/repository co php5 You must also checkout the TSRM and the ZEND module from the ZEND cvs tree -into the PHP4 root directory +into the PHP5 root directory cvs -d :pserver:cvsread@cvs.zend.com:/repository login The required password is zend cvs -z3 -d :pserver:cvsread@cvs.zend.com:/repository co Zend TSRM -2. Build PHP4 +2. Build PHP5 ============= 2.1 POSIX --------- -cd ./php4 +cd ./php5 ./buildconf ./configure --with-pi3web make @@ -41,10 +41,10 @@ other required downloads from the php website - bison 1.25 - bindlib32 - number4.tar.gz -nmake php4dllts.mak +nmake php5dllts.mak -3. Build Pi3Web PHP4 wrapper +3. Build Pi3Web PHP5 wrapper ============================ -Run make in the Pi3Web /Source/PHP4 directory. +Run make in the Pi3Web /Source/PHP5 directory. For further information refer to http://www.php.net/version4/ diff --git a/sapi/pi3web/config.m4 b/sapi/pi3web/config.m4 index 325aac2447..ba6a166c16 100644 --- a/sapi/pi3web/config.m4 +++ b/sapi/pi3web/config.m4 @@ -20,7 +20,7 @@ if test "$withval" != "no"; then PHP_ADD_INCLUDE($PI3PATH/PiAPI) PHP_ADD_INCLUDE($PI3PATH/Pi2API) PHP_ADD_INCLUDE($PI3PATH/Pi3API) - PHP_ADD_INCLUDE($PI3PATH/PHP4) + PHP_ADD_INCLUDE($PI3PATH/PHP5) PHP_SELECT_SAPI(pi3web, shared, pi3web_sapi.c) INSTALL_IT="\$(SHELL) \$(srcdir)/install-sh -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)$PI3PATH/bin/" RESULT=yes diff --git a/sapi/pi3web/config.w32 b/sapi/pi3web/config.w32 index 38fae95f5a..a5393e621b 100644 --- a/sapi/pi3web/config.w32 +++ b/sapi/pi3web/config.w32 @@ -8,7 +8,7 @@ if (PHP_PI3WEB != "no") { CHECK_LIB('piapi.lib', 'pi3web', PHP_PHP_BUILD + "\\Pi3Web\\lib;" + PHP_PI3WEB) && CHECK_LIB('pi2api.lib', 'pi3web', PHP_PHP_BUILD + "\\Pi3Web\\lib;" + PHP_PI3WEB) && CHECK_LIB('pi3api.lib', 'pi3web', PHP_PHP_BUILD + "\\Pi3Web\\lib;" + PHP_PI3WEB)) { - SAPI('pi3web', 'pi3web_sapi.c', 'php' + PHP_VERSION + 'pi3web.dll', '/D PHP4PI3WEB_EXPORTS'); + SAPI('pi3web', 'pi3web_sapi.c', 'php' + PHP_VERSION + 'pi3web.dll', '/D PHP5PI3WEB_EXPORTS'); AC_DEFINE('WITH_PI3WEB', 1); } else { WARNING('Pi3Web not enabled; headers/libraries not found'); diff --git a/sapi/pi3web/php4pi3web.dsp b/sapi/pi3web/php4pi3web.dsp deleted file mode 100644 index 2e5bdda152..0000000000 --- a/sapi/pi3web/php4pi3web.dsp +++ /dev/null @@ -1,136 +0,0 @@ -# Microsoft Developer Studio Project File - Name="php4pi3web" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=php4pi3web - 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 "php4pi3web.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 "php4pi3web.mak" CFG="php4pi3web - Win32 Debug_TS" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "php4pi3web - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "php4pi3web - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "php4pi3web - Win32 Release_TS_inline" (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)" == "php4pi3web - 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 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "php4pi3web_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "_WINDOWS" /D "_USRDLL" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /D "PHP4PI3WEB_EXPORTS" /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_debug.lib 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 PiAPI.lib Pi2API.lib Pi3API.lib /nologo /version:4.0 /dll /debug /machine:I386 /nodefaultlib:"libcmt" /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\Debug_TS" - -!ELSEIF "$(CFG)" == "php4pi3web - 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 "php4pi3web_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /D "PHP4PI3WEB_EXPORTS" /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 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 php4ts.lib 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 PiAPI.lib Pi2API.lib Pi3API.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /libpath:"..\..\Release_TS" - -!ELSEIF "$(CFG)" == "php4pi3web - Win32 Release_TS_inline" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "php4pi3web___Win32_Release_TS_inline" -# PROP BASE Intermediate_Dir "php4pi3web___Win32_Release_TS_inline" -# PROP BASE Ignore_Export_Lib 0 -# 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 /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /I "..\ext\mysql\libmysql" /I "..\..\..\PiAPI" /I "..\..\..\Pi2API" /I "..\..\..\Pi3API" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "_WINDOWS" /D "_USRDLL" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /D "PHP4PI3WEB_EXPORTS" /FR /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 wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib libmysql.lib PiAPI.lib Pi2API.lib Pi3API.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /out:"..\Release_TS\php4ts.dll" /libpath:"..\TSRM\Release_TS" /libpath:"..\Zend\Release_TS" /libpath:"..\..\bindlib_w32\Release" /libpath:"..\ext\mysql\libmysql\Release_TS" /libpath:"Release_TS" /libpath:"..\..\..\PiAPI" /libpath:"..\..\..\Pi2API" /libpath:"..\..\..\Pi3API" -# ADD LINK32 php4ts.lib 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 PiAPI.lib Pi2API.lib Pi3API.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /libpath:"..\..\Release_TS_inline" - -!ENDIF - -# Begin Target - -# Name "php4pi3web - Win32 Debug_TS" -# Name "php4pi3web - Win32 Release_TS" -# Name "php4pi3web - Win32 Release_TS_inline" -# Begin Group "Source Files" - -# PROP Default_Filter ".c" -# Begin Source File - -SOURCE=.\pi3web_sapi.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter ".h" -# Begin Source File - -SOURCE=.\pi3web_sapi.h -# End Source File -# End Group -# End Target -# End Project diff --git a/sapi/pi3web/php5pi3web.dsp b/sapi/pi3web/php5pi3web.dsp new file mode 100644 index 0000000000..3ba5224272 --- /dev/null +++ b/sapi/pi3web/php5pi3web.dsp @@ -0,0 +1,136 @@ +# Microsoft Developer Studio Project File - Name="php5pi3web" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=php5pi3web - 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 "php5pi3web.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 "php5pi3web.mak" CFG="php5pi3web - Win32 Debug_TS" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "php5pi3web - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "php5pi3web - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "php5pi3web - Win32 Release_TS_inline" (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)" == "php5pi3web - 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 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "php5pi3web_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "_WINDOWS" /D "_USRDLL" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /D "PHP5PI3WEB_EXPORTS" /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 php5ts_debug.lib 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 PiAPI.lib Pi2API.lib Pi3API.lib /nologo /version:4.0 /dll /debug /machine:I386 /nodefaultlib:"libcmt" /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\Debug_TS" + +!ELSEIF "$(CFG)" == "php5pi3web - 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 "php5pi3web_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /D "PHP5PI3WEB_EXPORTS" /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 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 php5ts.lib 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 PiAPI.lib Pi2API.lib Pi3API.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /libpath:"..\..\Release_TS" + +!ELSEIF "$(CFG)" == "php5pi3web - Win32 Release_TS_inline" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "php5pi3web___Win32_Release_TS_inline" +# PROP BASE Intermediate_Dir "php5pi3web___Win32_Release_TS_inline" +# PROP BASE Ignore_Export_Lib 0 +# 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 /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /I "..\ext\mysql\libmysql" /I "..\..\..\PiAPI" /I "..\..\..\Pi2API" /I "..\..\..\Pi3API" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP5DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "_WINDOWS" /D "_USRDLL" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /D "PHP5PI3WEB_EXPORTS" /FR /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 wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib libmysql.lib PiAPI.lib Pi2API.lib Pi3API.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /out:"..\Release_TS\php5ts.dll" /libpath:"..\TSRM\Release_TS" /libpath:"..\Zend\Release_TS" /libpath:"..\..\bindlib_w32\Release" /libpath:"..\ext\mysql\libmysql\Release_TS" /libpath:"Release_TS" /libpath:"..\..\..\PiAPI" /libpath:"..\..\..\Pi2API" /libpath:"..\..\..\Pi3API" +# ADD LINK32 php5ts.lib 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 PiAPI.lib Pi2API.lib Pi3API.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /libpath:"..\..\Release_TS_inline" + +!ENDIF + +# Begin Target + +# Name "php5pi3web - Win32 Debug_TS" +# Name "php5pi3web - Win32 Release_TS" +# Name "php5pi3web - Win32 Release_TS_inline" +# Begin Group "Source Files" + +# PROP Default_Filter ".c" +# Begin Source File + +SOURCE=.\pi3web_sapi.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter ".h" +# Begin Source File + +SOURCE=.\pi3web_sapi.h +# End Source File +# End Group +# End Target +# End Project diff --git a/sapi/pi3web/pi3web_sapi.c b/sapi/pi3web/pi3web_sapi.c index a13ab707f2..1a6d36fdc7 100644 --- a/sapi/pi3web/pi3web_sapi.c +++ b/sapi/pi3web/pi3web_sapi.c @@ -386,7 +386,7 @@ static sapi_module_struct pi3web_sapi_module = { STANDARD_SAPI_MODULE_PROPERTIES }; -MODULE_API DWORD PHP4_wrapper(LPCONTROL_BLOCK lpCB) +MODULE_API DWORD PHP5_wrapper(LPCONTROL_BLOCK lpCB) { zend_file_handle file_handle; int iRet = PIAPI_COMPLETED; @@ -455,7 +455,7 @@ MODULE_API DWORD PHP4_wrapper(LPCONTROL_BLOCK lpCB) return iRet; } -MODULE_API BOOL PHP4_startup() { +MODULE_API BOOL PHP5_startup() { tsrm_startup(1, 1, 0, NULL); sapi_startup(&pi3web_sapi_module); if (pi3web_sapi_module.startup) { @@ -465,7 +465,7 @@ MODULE_API BOOL PHP4_startup() { return IWasLoaded; }; -MODULE_API BOOL PHP4_shutdown() { +MODULE_API BOOL PHP5_shutdown() { if (pi3web_sapi_module.shutdown) { pi3web_sapi_module.shutdown(&pi3web_sapi_module); }; diff --git a/sapi/pi3web/pi3web_sapi.h b/sapi/pi3web/pi3web_sapi.h index d1c38d744e..c358518362 100644 --- a/sapi/pi3web/pi3web_sapi.h +++ b/sapi/pi3web/pi3web_sapi.h @@ -4,7 +4,7 @@ #ifdef PHP_WIN32 # include # include -# ifdef PHP4PI3WEB_EXPORTS +# ifdef PHP5PI3WEB_EXPORTS # define MODULE_API __declspec(dllexport) # else # define MODULE_API __declspec(dllimport) @@ -79,9 +79,9 @@ typedef struct _CONTROL_BLOCK { } CONTROL_BLOCK, *LPCONTROL_BLOCK; -MODULE_API DWORD PHP4_wrapper(LPCONTROL_BLOCK lpCB); -MODULE_API BOOL PHP4_startup(); -MODULE_API BOOL PHP4_shutdown(); +MODULE_API DWORD PHP5_wrapper(LPCONTROL_BLOCK lpCB); +MODULE_API BOOL PHP5_startup(); +MODULE_API BOOL PHP5_shutdown(); // the following type declaration is for the server side typedef DWORD ( * PFN_WRAPPERFUNC )( CONTROL_BLOCK *pCB ); diff --git a/sapi/roxen/README b/sapi/roxen/README index c6ec30d272..d834a0000e 100644 --- a/sapi/roxen/README +++ b/sapi/roxen/README @@ -8,9 +8,9 @@ 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. -This solution now works fine and is recommended. Multiple PHP4 +This solution now works fine and is recommended. Multiple PHP5 requests will be run in parallell. The maximum number of parallell -PHP4-execution is limited to the number of handle threads Roxen is +PHP5-execution is limited to the number of handle threads Roxen is started with. Support for this module is lacking. Please contact Roxen Internet diff --git a/sapi/roxen/TODO b/sapi/roxen/TODO index 4ba171accc..248f36f52e 100644 --- a/sapi/roxen/TODO +++ b/sapi/roxen/TODO @@ -10,18 +10,18 @@ BUGS: And another error (when trying to include a class) Recursive mutex locks! - /Usr/local/pike/7.0.54/lib/modules/PHP4.so.Interpreter: - run("/home/www/www.tx.pl/news/test.php",mapping[3],modules/scripting/php4.pike.PHPScript(),modules/scripting/php4.pike.PHPScript.done) - modules/scripting/php4.pike:169: run() + /Usr/local/pike/7.0.54/lib/modules/PHP5.so.Interpreter: + run("/home/www/www.tx.pl/news/test.php",mapping[3],modules/scripting/php5.pike.PHPScript(),modules/scripting/php5.pike.PHPScript.done) + modules/scripting/php5.pike:169: run() base_server/roxen.pike:569: handler_thread(3). And after this every access to any php script (on other virtual sites also) ends (of course there is no proper output) with this error: Php4.Interpreter->run: Tried to run a PHP-script from a PHP - callback!/usr/local/pike/7.0.54/lib/modules/PHP4.so.Interpreter: - run("/home/www/biall.com.pl/index.php3",mapping[2],modules/scripting/php4.pike.PHPScript(),modules/scripting/php4.pike.PHPScript.done) - modules/scripting/php4.pike:169: run() + callback!/usr/local/pike/7.0.54/lib/modules/PHP5.so.Interpreter: + run("/home/www/biall.com.pl/index.php3",mapping[2],modules/scripting/php5.pike.PHPScript(),modules/scripting/php5.pike.PHPScript.done) + modules/scripting/php5.pike:169: run() base_server/roxen.pike:569: handler_thread(3). diff --git a/sapi/roxen/config.m4 b/sapi/roxen/config.m4 index cf2726b51b..6634964e94 100644 --- a/sapi/roxen/config.m4 +++ b/sapi/roxen/config.m4 @@ -31,7 +31,7 @@ AC_ARG_WITH(roxen, PHP_ADD_INCLUDE($PIKE_INCLUDE_DIR) AC_DEFINE(HAVE_ROXEN,1,[Whether you use Roxen]) PHP_SELECT_SAPI(roxen, shared, roxen.c) - INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED $PIKE_MODULE_DIR/PHP4.so" + INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED $PIKE_MODULE_DIR/PHP5.so" RESULT="yes Pike binary used: $PIKE Pike include dir: $PIKE_INCLUDE_DIR diff --git a/sapi/roxen/roxen.c b/sapi/roxen/roxen.c index d580fe3a48..c0ec83f2ba 100644 --- a/sapi/roxen/roxen.c +++ b/sapi/roxen/roxen.c @@ -615,12 +615,12 @@ void f_php_roxen_request_handler(INT32 args) TSRMLS_FETCH(); if(current_thread == th_self()) - php_error(E_WARNING, "PHP4.Interpreter->run: Tried to run a PHP-script from a PHP " + php_error(E_WARNING, "PHP5.Interpreter->run: Tried to run a PHP-script from a PHP " "callback!"); - get_all_args("PHP4.Interpreter->run", args, "%S%m%O%*", &script, + get_all_args("PHP5.Interpreter->run", args, "%S%m%O%*", &script, &request_data, &my_fd_obj, &done_callback); if(done_callback->type != PIKE_T_FUNCTION) - php_error(E_WARNING, "PHP4.Interpreter->run: Bad argument 4, expected function.\n"); + php_error(E_WARNING, "PHP5.Interpreter->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 @@ -656,7 +656,7 @@ void f_php_roxen_request_handler(INT32 args) { int fd = fd_from_object(raw_fd->u.object); if(fd == -1) - php_error(E_WARNING, "PHP4.Interpreter->run: my_fd object not open or not an FD.\n"); + php_error(E_WARNING, "PHP5.Interpreter->run: my_fd object not open or not an FD.\n"); THIS->my_fd = fd; } else THIS->my_fd = 0; diff --git a/sapi/thttpd/config.m4 b/sapi/thttpd/config.m4 index 9236677d8e..ac5a2bfca2 100644 --- a/sapi/thttpd/config.m4 +++ b/sapi/thttpd/config.m4 @@ -21,10 +21,10 @@ AC_ARG_WITH(thttpd, fi PHP_TARGET_RDYNAMIC INSTALL_IT="\ - echo 'PHP_LIBS = -L. -lphp4 \$(PHP_LIBS) \$(EXTRA_LIBS)' > $THTTPD/php_makefile; \ + echo 'PHP_LIBS = -L. -lphp5 \$(PHP_LIBS) \$(EXTRA_LIBS)' > $THTTPD/php_makefile; \ echo 'PHP_LDFLAGS = \$(NATIVE_RPATHS) \$(PHP_LDFLAGS)' >> $THTTPD/php_makefile; \ echo 'PHP_CFLAGS = \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(CPPFLAGS) \$(EXTRA_CFLAGS)' >> $THTTPD/php_makefile; \ - rm -f $THTTPD/php_thttpd.c $THTTPD/php_thttpd.h $THTTPD/libphp4.a; \ + rm -f $THTTPD/php_thttpd.c $THTTPD/php_thttpd.h $THTTPD/libphp5.a; \ \$(LN_S) $abs_srcdir/sapi/thttpd/thttpd.c $THTTPD/php_thttpd.c; \ \$(LN_S) $abs_srcdir/sapi/thttpd/php_thttpd.h $abs_builddir/$SAPI_STATIC $THTTPD/;\ $patch" diff --git a/sapi/thttpd/thttpd_patch b/sapi/thttpd/thttpd_patch index 482cad41ac..33de921489 100644 --- a/sapi/thttpd/thttpd_patch +++ b/sapi/thttpd/thttpd_patch @@ -34,7 +34,7 @@ diff -ur thttpd-2.21b/Makefile.in thttpd-2.21b-cool/Makefile.in this: $(ALL) -thttpd: $(OBJ) -+thttpd: $(OBJ) libphp4.a ++thttpd: $(OBJ) libphp5.a @rm -f $@ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS) $(NETLIBS) diff --git a/sapi/tux/README b/sapi/tux/README index 167e52f3ca..92c021123f 100644 --- a/sapi/tux/README +++ b/sapi/tux/README @@ -56,31 +56,31 @@ BUILD INSTRUCTIONS $ ./configure --help - 3. Touch a file in your web-root 'php4.tux'. This will - cause requests to '/php4.tux' to be redirected to the - userspace module php4.tux. + 3. Touch a file in your web-root 'php5.tux'. This will + cause requests to '/php5.tux' to be redirected to the + userspace module php5.tux. 4. Start TUX with something like - # tux -d -t 8 -r /www -m /tux-modules php4.tux + # tux -d -t 8 -r /www -m /tux-modules php5.tux (daemon mode, eight threads, web-root /www, modules in - /tux-modules, load php4.tux) + /tux-modules, load php5.tux) BEFORE running this command, the kernel side of TUX has to be properly setup. 5. Try to access - http://yourserver/php4.tux?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000 + http://yourserver/php5.tux?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000 It should display the PHP credits page. To access a script /foo/bar.php, use - http://yourserver/php4.tux?/foo/bar.php + http://yourserver/php5.tux?/foo/bar.php Parameters can be appended: - http://yourserver/php4.tux?/foo/bar.php&var=value + http://yourserver/php5.tux?/foo/bar.php&var=value diff --git a/sapi/tux/config.m4 b/sapi/tux/config.m4 index ea12e67c4b..cc79bea1b9 100644 --- a/sapi/tux/config.m4 +++ b/sapi/tux/config.m4 @@ -6,7 +6,7 @@ PHP_TUX=no AC_ARG_WITH(tux, [ --with-tux=MODULEDIR Build PHP as a TUX module (Linux only)],[ - INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED $withval/php4.tux.so" + INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED $withval/php5.tux.so" AC_CHECK_HEADERS(tuxmodule.h,[:],[AC_MSG_ERROR([Cannot find tuxmodule.h])]) PHP_SELECT_SAPI(tux, shared, php_tux.c) PHP_TUX=yes diff --git a/sapi/webjames/README b/sapi/webjames/README index 9a316efed7..746a7762fb 100644 --- a/sapi/webjames/README +++ b/sapi/webjames/README @@ -16,7 +16,7 @@ http://www.webjames.alexwaugh.com/ BUILDING -$ cd php4 +$ cd php5 $ ./configure \ --host=arm-riscos-aof \ --with-webjames=../webjames/src \ -- cgit v1.2.1