LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Apache 2.2.3 Session tracking with mod_session produces load error on module load (https://www.linuxquestions.org/questions/linux-server-73/apache-2-2-3-session-tracking-with-mod_session-produces-load-error-on-module-load-909807/)

programlight 10-24-2011 08:37 AM

Apache 2.2.3 Session tracking with mod_session produces load error on module load
 
We are using Apache server 2.2.3 at work as our web server. Currently I am tasked to track metrics for our website's content access. I am able to gather some information (client's ip, request type, uri, etc.) from the request_rec structure. I also need to correlate "clicks" on the web site with their specific users.

For this, I am trying to use the mod_session module to track sessions for each user. Since mod_session is built into Apache for versions 2.3 or later, in order for me to use it on our Apache 2.2.3 server, I tried to build it from source. I use a build machine where I compile the source and then deploy the resulting ".so" file into the Apache server and change the httpd.conf file (adding LoadModule directive) to load the module, and then restart the Apache server to deploy the new module.
I've made it work for my own custom modules, but when I try to do this process for loading the mod_session module, I'm getting the following error:
error: httpd: Syntax error on line 217 of /etc/httpd/conf/httpd.conf: Cannot load /usr/lib64/httpd/modules/mod_session.so into server: /usr/lib64/httpd/modules/mod_session.so: undefined symbol: session_module.

I see that mod_session.c uses the variable &session_module in the first line of the function ap_session_load. Here are the relevant lines of the function:
static int ap_session_load(request_rec * r, session_rec ** z)
{

session_dir_conf *dconf = ap_get_module_config(r->per_dir_config,
&session_module);
.....................................................
}


This was the first reference to session_module in the file mod_session.c. This variable is defined in the header file mod_session.h as follows:
extern module AP_MODULE_DECLARE_DATA session_module;

It seems to me that session_module is defined in a library or header file that is included in mod_session.h. I have noted the pertinent lines of mod_session.h below:

#ifndef MOD_SESSION_H
#define MOD_SESSION_H

/* Create a set of SESSION_DECLARE(type), SESSION_DECLARE_NONSTD(type) and
* SESSION_DECLARE_DATA with appropriate export and import tags for the platform
*/
#if !defined(WIN32)
#define SESSION_DECLARE(type) type
#define SESSION_DECLARE_NONSTD(type) type
#define SESSION_DECLARE_DATA
#elif defined(SESSION_DECLARE_STATIC)
#define SESSION_DECLARE(type) type __stdcall
#define SESSION_DECLARE_NONSTD(type) type
#define SESSION_DECLARE_DATA
#elif defined(SESSION_DECLARE_EXPORT)
#define SESSION_DECLARE(type) __declspec(dllexport) type __stdcall
#define SESSION_DECLARE_NONSTD(type) __declspec(dllexport) type
#define SESSION_DECLARE_DATA __declspec(dllexport)
#else
#define SESSION_DECLARE(type) __declspec(dllimport) type __stdcall
#define SESSION_DECLARE_NONSTD(type) __declspec(dllimport) type
#define SESSION_DECLARE_DATA __declspec(dllimport)
#endif

#include "apr_hooks.h"
#include "apr_optional.h"
#include "apr_tables.h"
#include "apr_uuid.h"
#include "apr_pools.h"
#include "apr_time.h"

#include "httpd.h"
#include "http_config.h"
#include "ap_config.h"



I don't know if there is a library that I'm supposed to link to before I load this module or what's causing this error. If you know the cause of this error, or if there is a better way to gather session information on Apache 2.2.3 please let me know.

bathory 10-24-2011 04:48 PM

Hi,

I don't think it's possible to use a module compiled against apache 2.3 libraries with apache 2.2.x.
You can use the mod_usertrack to log user activity based on cookies. Take a look here for usage.

Regards


All times are GMT -5. The time now is 02:07 PM.