Hi !

I tried to use the cgi version of php4 with the midgard.so module (using
the php4-midgard debian package on woody) but midgard.so uses some
Apache internal functions.

francois@gollum:~$ php4
php4: relocation error: /usr/lib/php4/20010901/midgard.so: undefined
symbol: ap_find_linked_module
francois@gollum:~$

To get it work I had the remove every references to ap_* functions in
midgard.c (my ugly patch is attached).

It appears to work well with phpmole.

Do you know what does my ugly patch breaks ? What has midgard.so (PHP) to do
with mod_midgars.so (Apache) ?

Thanks midgard people for this great work !
diff -u midgard-php4-1.4.3/midgard.c midgard-php4-1.4.3-cgi/midgard.c
--- midgard-php4-1.4.3/midgard.c        Thu Jun 13 21:16:18 2002
+++ midgard-php4-1.4.3-cgi/midgard.c    Tue Oct 15 09:38:07 2002
@@ -407,61 +407,6 @@
 /* Remove if there's nothing to do at request start */
 PHP_RINIT_FUNCTION(midgard)
 {
-       request_rec *r;
-       module *midgard_module;
-
-       SLS_FETCH();
-       MGDLS_FETCH();
-       
-       midgard_module = ap_find_linked_module("mod_midgard.c");
-       if (!midgard_module) {
-               MGDG(rcfg) = NULL;
-               MGDG(dcfg) = NULL;
-               php_error(E_NOTICE, "Cannot get midgard module descriptor");
-               return SUCCESS;
-       }
-
-       /* Failure on Apache 1.3.18-dev (Marius) ??? */
-       r = ((request_rec *) SG(server_context));
-
-#if MIDGARD_PHP_REQUEST_CONFIG_BUG_WORKAROUND
-       MGDG(rcfg) = mgd_php_bug_workaround_get_rcfg();
-       MGDG(dcfg) = mgd_php_bug_workaround_get_dcfg();
-#else
-       MGDG(rcfg) = (midgard_request_config *)
-                       ap_get_module_config(r->request_config, midgard_module);
-       if(MGDG(rcfg) == NULL) {
-      /* Midgard is probably not enabled for this host, only log debug info */
-               MGD_LOG_START("Cannot get midgard module config")
-               MGD_LOG_END()
-
-               MGDG(rcfg) = NULL;
-               MGDG(dcfg) = NULL;
-               return SUCCESS;
-       }
-
-       MGDG(dcfg) = (midgard_directory_config *)
-          ap_get_module_config(r->per_dir_config, midgard_module);
-       if(MGDG(dcfg) == NULL) {
-               MGD_LOG_START("Cannot get midgard module directory config")
-               MGD_LOG_END()
-
-      /* this is an error, since if we can get the module config we should
-         also be able to get this
-      */
-               php_error(E_NOTICE, "Cannot get midgard module directory config");
-               MGDG(rcfg) = NULL;
-               MGDG(dcfg) = NULL;
-               return SUCCESS;
-       }
-#endif
-
-       if (MGDG(rcfg)) {
-               MGDG(mgd) = MGDG(rcfg)->mgd;
-       } else {
-               MGDG(mgd) = NULL;
-   }
-
        return SUCCESS;
 }
 
@@ -692,28 +637,10 @@
        convert_to_string_ex(username);
        convert_to_string_ex(password);
 
-       if ((*username)->value.str.len)
-               u = ap_pstrdup(mgd_rcfg()->pool, (*username)->value.str.val);
-       else
-               u = "";
-       if ((*password)->value.str.len)
-               p = ap_pstrdup(mgd_rcfg()->pool, (*password)->value.str.val);
-       else
-               p = "";
+       u = "";
+       p = "";
 
        rv = mgd_auth(mgd_handle(), u, p, 1);
-       if (rv >= 0 && sc) {
-               cookie1 = ap_psprintf(r->pool, "%s:%s",
-                                     (*username)->value.str.val,
-                                     (*password)->value.str.val);
-               cookie2 = ap_uuencode(r->pool, cookie1);
-               sprintf(cookie3,
-                       "MidgardLogin=%s;"
-                       " Expires=Friday, 1-Jan-%d10 12:00:00 GMT;"
-                       " Path=/", cookie2, mgd_user(mgd_handle())? 20 : 10);
-               ap_table_set(r->headers_out, "Set-Cookie",
-                            cookie3);
-       }
 
        switch (rv) {
                case MGD_AUTH_NOT_CONNECTED:

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to