]> granicus.if.org Git - php/commitdiff
MFH
authorUwe Schindler <thetaphi@php.net>
Mon, 4 Aug 2003 12:46:38 +0000 (12:46 +0000)
committerUwe Schindler <thetaphi@php.net>
Mon, 4 Aug 2003 12:46:38 +0000 (12:46 +0000)
sapi/nsapi/nsapi-readme.txt
sapi/nsapi/nsapi.c

index 9c3c79131baa412336170a9ae196fc0f3c95cb71..af5e8b872a3ffb0ea3afd0d5aa2249069c2e46dd 100644 (file)
@@ -118,4 +118,33 @@ For both error and directory listing pages the original URI and
 translated URI are in the variables $_SERVER['PATH_INFO'] and
 $_SERVER['PATH_TRANSLATED'].
 
+
+Note about nsapi_virtual() and subrequests
+------------------------------------------
+
+The NSAPI module now supports the nsapi_virtual() function (alias: virtual())
+to make subrequests on the webserver and insert the result in the webpage.
+The problem is, that this function uses some undocumented features from
+the NSAPI library.
+
+Under Unix this is not a problem, because the module automatically looks
+for the needed functions and uses them if available. If not, nsapi_virtual()
+is disabled.
+
+Under Windows limitations in the DLL handling need the use of a automatic
+detection of the most recent ns-httpdXX.dll file. This is tested for servers
+till version 6.0. If a newer version of the SunONE server is used, the detection
+fails and nsapi_virtual() is disabled.
+
+If this is the case, try the following:
+Add the following parameter to php4_init in magnus.conf:
+
+    Init fn=php4_init ... server_lib="ns-httpdXX.dll"
+    
+where XX is the correct DLL version number. To get it, look in the server-root
+for the correct DLL name. The DLL with the biggest filesize is the right one.
+
+But be warned: SUPPORT FOR nsapi_virtual() IS EXPERIMENTAL !!!
+
+
 $Id$
index 335e09102d831da690f34bf4d28ade03d5c3c6e3..c0bade223771ba3d228c318fa44299b992b8148a 100644 (file)
@@ -234,6 +234,10 @@ nsapi_servact_prototype nsapi_servact_service = NULL;
  * the server only by wrapping the function table nothing else. So choose
  * the newest one found in process space for dynamic linking */
 static char *nsapi_dlls[] = { "ns-httpd40.dll", "ns-httpd36.dll", "ns-httpd35.dll", "ns-httpd30.dll", NULL };
+/* if user specifies an other dll name by server_lib parameter 
+ * it is placed in the following variable and only this DLL is
+ * checked for the servact_* functions */
+char *nsapi_dll = NULL;
 #endif
 
 /* {{{ php_nsapi_init_dynamic_symbols
@@ -251,10 +255,18 @@ static void php_nsapi_init_dynamic_symbols(void)
 #ifdef PHP_WIN32
        register int i;
        DL_HANDLE module = NULL;
-       /* find a LOADED dll module from nsapi_dlls */
-       for (i=0; nsapi_dlls[i]; i++) {
-               if (module = GetModuleHandle(nsapi_dlls[i])) {
-                       break;
+       if (nsapi_dll) {
+               /* try user specified server_lib */
+               module = GetModuleHandle(nsapi_dll);
+               if (!module) {
+                       log_error(LOG_WARN, "php4_init", NULL, NULL, "Cannot find DLL specified by server_lib parameter: %s", nsapi_dll);
+               }
+       } else {
+               /* find a LOADED dll module from nsapi_dlls */
+               for (i=0; nsapi_dlls[i]; i++) {
+                       if (module = GetModuleHandle(nsapi_dlls[i])) {
+                               break;
+                       }
                }
        }
        if (!module) return;
@@ -786,6 +798,13 @@ void NSAPI_PUBLIC php4_close(void *vparam)
        if (nsapi_sapi_module.php_ini_path_override) {
                free(nsapi_sapi_module.php_ini_path_override);
        }
+       
+#ifdef PHP_WIN32
+       if (nsapi_dll) {
+               free(nsapi_dll);
+               nsapi_dll = NULL;
+       }
+#endif 
 
        tsrm_shutdown();
 
@@ -795,14 +814,18 @@ void NSAPI_PUBLIC php4_close(void *vparam)
 /*********************************************************
 / init SAF
 /
-/ Init fn="php4_init" [php_ini="/path/to/php.ini"]
+/ Init fn="php4_init" [php_ini="/path/to/php.ini"] [server_lib="ns-httpdXX.dll"]
 /   Initialize the NSAPI module in magnus.conf
 /
+/ php_ini: gives path to php.ini file
+/ server_lib: (only Win32) gives name of DLL (without path) to look for
+/  servact_* functions
+/
 /*********************************************************/
 int NSAPI_PUBLIC php4_init(pblock *pb, Session *sn, Request *rq)
 {
        php_core_globals *core_globals;
-       char *ini_path;
+       char *strval;
        int threads=128; /* default for server */
 
        /* fetch max threads from NSAPI and initialize TSRM with it */
@@ -817,9 +840,17 @@ int NSAPI_PUBLIC php4_init(pblock *pb, Session *sn, Request *rq)
        core_globals = ts_resource(core_globals_id);
 
        /* look if php_ini parameter is given to php4_init */
-       if (ini_path = pblock_findval("php_ini", pb)) {
-               nsapi_sapi_module.php_ini_path_override = strdup(ini_path);
+       if (strval = pblock_findval("php_ini", pb)) {
+               nsapi_sapi_module.php_ini_path_override = strdup(strval);
+       }
+       
+#ifdef PHP_WIN32
+       /* look if server_lib parameter is given to php4_init
+        * (this disables the automatic search for the newest ns-httpdXX.dll) */
+       if (strval = pblock_findval("server_lib", pb)) {
+               nsapi_dll = strdup(strval);
        }
+#endif 
 
        /* start SAPI */
        sapi_startup(&nsapi_sapi_module);