more apachewin32 work. much better now, but still crashing in zend_execute. At least it's getting the file open now though.

This commit is contained in:
Shane Caraveo 2000-05-04 03:28:34 +00:00
parent a85e57ebc3
commit cad04f5579
3 changed files with 32 additions and 73 deletions

View File

@ -54,7 +54,7 @@ BSC32=bscmake.exe
# 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 ZendTS.lib TSRM.lib 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 /dll /machine:I386 /libpath:"\apache\src\corer" /libpath:"..\..\Release_TS" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\Zend\Release_TS"
# ADD LINK32 ZendTS.lib TSRM.lib 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" /dll /machine:I386 /libpath:"\apache\src\corer" /libpath:"..\..\Release_TS" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\Zend\Release_TS"
!ELSEIF "$(CFG)" == "ApachePHP4 - Win32 Debug_TS"
@ -65,11 +65,12 @@ LINK32=link.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Debug_TS"
# PROP Output_Dir "e:\apache\modules"
# 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 /MT /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "\apache\src\include" /D ZEND_DEBUG=1 /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "APACHEPHP4_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "\apache\src\include" /D ZEND_DEBUG=1 /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "APACHEPHP4_EXPORTS" /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"
@ -79,7 +80,7 @@ BSC32=bscmake.exe
# 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 ZendTS.lib TSRM.lib 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 /dll /machine:I386 /libpath:"\apache\src\cored" /libpath:"..\..\Debug_TS" /libpath:"..\..\TSRM\Debug_TS" /libpath:"..\..\Zend\Debug_TS"
# 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" /dll /machine:I386 /libpath:"\apache\src\cored" /libpath:"..\..\Debug_TS" /libpath:"..\..\TSRM\Debug_TS" /libpath:"..\..\Zend\Debug_TS"
!ELSEIF "$(CFG)" == "ApachePHP4 - Win32 Release_TS_inline"

View File

@ -64,7 +64,7 @@
# include "mod_dav.h"
#endif
PHPAPI int apache_php_module_main(request_rec *r, int fd, int display_source_mode SLS_DC);
int apache_php_module_main(request_rec *r, int fd, int display_source_mode CLS_DC ELS_DC PLS_DC SLS_DC);
void php_save_umask(void);
void php_restore_umask(void);
int sapi_apache_read_post(char *buffer, uint count_bytes SLS_DC);
@ -106,8 +106,9 @@ typedef struct _php_per_dir_entry {
int type;
} php_per_dir_entry;
/* handled apropriately in apache_php_module_main */
/* popenf isn't working on Windows, use open instead
#if WIN32|WINNT
/* popenf isn't working on Windows, use open instead*/
# ifdef popenf
# undef popenf
# endif
@ -116,9 +117,8 @@ typedef struct _php_per_dir_entry {
# undef pclosef
# endif
# define pclosef(p,f) close(f)
#else
# define php_popenf(p,n,f,m) popenf((p),(n),(f),(m))
#endif
*/
php_apache_info_struct php_apache_info; /* active config */
@ -239,10 +239,7 @@ static void sapi_apache_register_server_variables(zval *track_vars_array ELS_DC
array_header *arr = table_elts(((request_rec *) SG(server_context))->subprocess_env);
table_entry *elts = (table_entry *) arr->elts;
char *script_filename=NULL;
/* Theses are already in parameters?
ELS_FETCH();
PLS_FETCH();
*/
for (i = 0; i < arr->nelts; i++) {
char *val;
@ -264,31 +261,12 @@ static void sapi_apache_register_server_variables(zval *track_vars_array ELS_DC
php_register_variable("PHP_SELF", ((request_rec *) SG(server_context))->uri, track_vars_array ELS_CC PLS_CC);
}
static int
php_apache_startup(sapi_module_struct *sapi_module)
static int php_apache_startup(sapi_module_struct *sapi_module)
{
#ifdef PHP_WIN32
/* this is needed because apache reloads this dll twice due
// to a colision. A better way to do this is to define the load
// address for the dll, but am not sure what it should be.
// this is just a quick hack to get it working.
*/
static int php_apache_started=0;
static int apache_startup_success = FAILURE;
if (php_apache_started>0) return apache_startup_success;
php_apache_started=1;
#endif
if(php_module_startup(sapi_module) == FAILURE
|| zend_startup_module(&apache_module_entry) == FAILURE) {
#ifdef PHP_WIN32
apache_startup_success = FAILURE;
#endif
return FAILURE;
} else {
#ifdef PHP_WIN32
apache_startup_success = SUCCESS;
#endif
return SUCCESS;
}
}
@ -449,6 +427,8 @@ int send_php(request_rec *r, int display_source_mode, char *filename)
HashTable *per_dir_conf;
SLS_FETCH();
ELS_FETCH();
CLS_FETCH();
PLS_FETCH();
if (setjmp(EG(bailout))!=0) {
return OK;
@ -516,7 +496,7 @@ int send_php(request_rec *r, int display_source_mode, char *filename)
add_cgi_vars(r);
init_request_info(SLS_C);
apache_php_module_main(r, fd, display_source_mode SLS_CC);
apache_php_module_main(r, fd, display_source_mode CLS_CC ELS_CC PLS_CC SLS_CC);
/* Done, restore umask, turn off timeout, close file and return */
php_restore_umask();
@ -591,6 +571,9 @@ CONST_PREFIX char *php_apache_value_handler_ex(cmd_parms *cmd, HashTable *conf,
if (!apache_php_initialized) {
apache_php_initialized = 1;
#ifdef ZTS
tsrm_startup(1, 1, 0);
#endif
sapi_startup(&sapi_module);
php_apache_startup(&sapi_module);
}
@ -677,6 +660,9 @@ static void apache_php_module_shutdown_wrapper(void)
{
apache_php_initialized = 0;
sapi_module.shutdown(&sapi_module);
#ifdef ZTS
tsrm_shutdown();
#endif
}
@ -685,6 +671,9 @@ 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);
#endif
sapi_startup(&sapi_module);
php_apache_startup(&sapi_module);
}
@ -792,32 +781,6 @@ module MODULE_VAR_EXPORT php4_module =
};
#ifdef PHP_WIN32
__declspec(dllexport) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
tsrm_startup(1, 1, 0);
sapi_startup(&sapi_module);
if (sapi_module.startup) {
sapi_module.startup(&sapi_module);
}
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
ts_free_thread();
break;
case DLL_PROCESS_DETACH:
if (sapi_module.shutdown) {
sapi_module.shutdown(&sapi_module);
}
tsrm_shutdown();
break;
}
return TRUE;
}
#endif
/*
* Local variables:
* tab-width: 4

View File

@ -24,7 +24,6 @@
#define NO_REGEX_EXTRA_H
#ifdef WIN32
#include <winsock2.h>
#define PHP_EXPORTS
#include <stddef.h>
#endif
@ -60,27 +59,23 @@
/*#include "mod_php4.h"*/
PHPAPI int apache_php_module_main(request_rec *r, int fd, int display_source_mode SLS_DC)
int apache_php_module_main(request_rec *r, int fd, int display_source_mode CLS_DC ELS_DC PLS_DC SLS_DC)
{
zend_file_handle file_handle;
#ifdef ZTS
zend_compiler_globals cg;
zend_executor_globals eg;
php_core_globals pcg;
zend_compiler_globals *compiler_globals=&cg;
zend_executor_globals *executor_globals=&eg;
php_core_globals *core_globals=&pcg;
memset(&cg,0,sizeof(zend_compiler_globals));
memset(&eg,0,sizeof(zend_executor_globals));
memset(&pcg,0,sizeof(php_core_globals));
#endif
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC) == FAILURE) {
return FAILURE;
}
#ifdef PHP_WIN32
/* sending a file handle to another dll is not working
// so let zend open it.
*/
file_handle.type = ZEND_HANDLE_FILENAME;
file_handle.handle.fd = 0;
#else
file_handle.type = ZEND_HANDLE_FD;
file_handle.handle.fd = fd;
#endif
file_handle.filename = SG(request_info).path_translated;
file_handle.free_filename = 0;