diff options
author | Zeev Suraski <zeev@php.net> | 1999-04-26 14:00:49 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 1999-04-26 14:00:49 +0000 |
commit | 7942eaf38138ef8751a447dadb930a129528fb6b (patch) | |
tree | cee4b5eca81082809a9e5bb903173952f45e9501 /mod_php3.c | |
parent | 050cb7cfe3da61621b6d01a0b013642543f44521 (diff) | |
download | php-git-7942eaf38138ef8751a447dadb930a129528fb6b.tar.gz |
* Plenty of thread safety and Win32 work.
* Changed PHP4 to compile as a DLL, both ISAPI and the the CGI run with the same DLL.
* Switched to using the DLL runtime library under Win32. PHP will NOT work if
compiled against the static library!
* Removed yesterday's php4libts project (with php4dllts, it's obsolete).
This *does* affect thread-unsafe Windows as well - the thread unsafe CGI is also
dependant on the thread-unsafe DLL.
Diffstat (limited to 'mod_php3.c')
-rw-r--r-- | mod_php3.c | 89 |
1 files changed, 26 insertions, 63 deletions
diff --git a/mod_php3.c b/mod_php3.c index 9f8d56dc33..ba0d6b6db5 100644 --- a/mod_php3.c +++ b/mod_php3.c @@ -87,68 +87,10 @@ int saved_umask; php_apache_info_struct php_apache_info; /* active config */ int apache_php3_module_main(request_rec * r, int fd, int display_source_mode); -extern int php3_module_startup(); -extern void php3_module_shutdown(); -extern void php3_module_shutdown_for_exec(); +int php_module_startup(sapi_functions_struct *sf); +void php_module_shutdown(); +void php_module_shutdown_for_exec(); -extern int tls_create(void); -extern int tls_destroy(void); -extern int tls_startup(void); -extern int tls_shutdown(void); - -#if WIN32|WINNT - -/* - we will want to change this to the apache api - process and thread entry and exit functions -*/ -BOOL WINAPI DllMain(HANDLE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved) -{ - switch( ul_reason_for_call ) { - case DLL_PROCESS_ATTACH: - /* - I should be loading ini vars here - and doing whatever true global inits - need to be done - */ - if (!tls_startup()) - return 0; - if (!tls_create()) - return 0; - - break; - case DLL_THREAD_ATTACH: - if (!tls_create()) - return 0; - /* if (php3_module_startup()==FAILURE) { - return FAILURE; - } -*/ break; - case DLL_THREAD_DETACH: - if (!tls_destroy()) - return 0; -/* if (initialized) { - php3_module_shutdown(); - return SUCCESS; - } else { - return FAILURE; - } -*/ break; - case DLL_PROCESS_DETACH: - /* - close down anything down in process_attach - */ - if (!tls_destroy()) - return 0; - if (!tls_shutdown()) - return 0; - break; - } - return 1; -} -#endif void php3_save_umask() { @@ -156,11 +98,28 @@ void php3_save_umask() umask(saved_umask); } + +static int zend_apache_ub_write(const char *str, uint str_length) +{ + if (php3_rqst) { + return rwrite(str, str_length, php3_rqst); + } else { + return fwrite(str, 1, str_length, stdout); + } +} + + +sapi_functions_struct sapi_functions = { + zend_apache_ub_write +}; + + void php3_restore_umask() { umask(saved_umask); } + int send_php3(request_rec *r, int display_source_mode, char *filename) { int fd, retval; @@ -230,16 +189,19 @@ int send_php3(request_rec *r, int display_source_mode, char *filename) return OK; } + int send_parsed_php3(request_rec * r) { return send_php3(r, 0, NULL); } + int send_parsed_php3_source(request_rec * r) { return send_php3(r, 0, NULL); } + /* * Create the per-directory config structure with defaults */ @@ -299,10 +261,11 @@ int php3_xbithack_handler(request_rec * r) return send_parsed_php3(r); } + void php3_init_handler(server_rec *s, pool *p) { - register_cleanup(p, NULL, php3_module_shutdown, php3_module_shutdown_for_exec); - php3_module_startup(); + register_cleanup(p, NULL, php_module_shutdown, php_module_shutdown_for_exec); + php_module_startup(&sapi_functions); #if MODULE_MAGIC_NUMBER >= 19980527 ap_add_version_component("PHP/" PHP_VERSION); #endif |