I've got a weird problem that I haven't been able to fix...
This behaviour exhibits on the 2 boxes I have that have Apache 1.3.14, ModPerl 1.24
(compiled in).
One is Solaris 2.6, one is 7.
Both run Embperl 1.3.0 (upgraded to 1.3.1 also and that had no effect)
Here's the problem I am running into.
If I have more than one VirtualHost setup to use Embperl sessions, randomly the
session data for one site will be lost, and then a new cookie will be set (proper
name, etc) but to the OTHER VIRTUAL HOSTS's Session table!
Each session table is on a different database (one database per VirtualHost in these
examples)
I have enabled the DEBUG to look at the ENV, and for each request, the environment is
set properly (ie if I go to clients.domain.com I see the SESSION_ARGS I set for that
VirtualHost in the log, and also if I print it out from my Embperl processed page)
I've tried putting the PerlSetEnv settings in just the <VirtualHost> tags, moved
Directory in/out of VirtualHost...same problem.
The first connection works fine, say if I got to clients.domain.com, I see the correct
session ID in their database.
If I go to other.domain.com, I see the correct session cookie in their database/table.
But then, if I randomly use other browsers or machines, or the browsers I already have
open, the ID will change.
And if I look in the MySQL logs, it is apparently as to _why_ this is happening, the
connection ID making the updates that is being used to check for and set the session
ID, is the wrong one for the site.
For example, MySQL processes:
+-----+------------+--------------+-------------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info
| |
+-----+------------+--------------+-------------+---------+------+-------+------------------+
| 401 | username | localhost | database | Sleep | 1228 | |
| |
| 402 | username2 | localhost | database2 | Sleep | 1205 | |
| |
401 should be used for "clients.domain.com". 402 should be used for "other.domain.com"
Let's pretend I go to clients.domain.com, and then the cookie "changes". If I look in
the MySQL log I see it attempting to check via the wrong connection (in this case
connection ID 402) instead of 401...and then of course it simply writes a new
cookie...but of course I've lost all my session data.
Using Semaphore and removing the LockDataSource segements of EMBPERL_SESSION_ARGS
didn't solve the problem.
It's like ModPerl, Embperl or Apache::Session is simply using the wrong connection,
despite me setting SESSION_ARGS specific to each VirtualHost/Directory.
Any ideas?:)
httpd.conf:
<VirtualHost 192.168.1.11>
DocumentRoot /disk1/www/Clients
ServerName clients.domain.com
<Directory "/disk1/www/Clients">
<Files *.epl>
SetHandler perl-script
PerlHandler HTML::Embperl
Options +ExecCGI
PerlSetEnv EMBPERL_OPTIONS 16
PerlSetEnv EMBPERL_COOKIE_DOMAIN ".domain.com"
PerlSetEnv EMBPERL_COOKIE_PATH "/"
PerlSetEnv EMBPERL_SESSION_CLASSES "MySQL MySQL"
PerlSetEnv EMBPERL_SESSION_ARGS "DataSource=dbi:mysql:database
UserName=username Password=password LockDataSource=dbi:mysql:database
LockUserName=username LockPassword=password"
</Files>
</Directory>
</VirtualHost>
<VirtualHost 192.168.1.11>
DocumentRoot /disk1/www/Other
ServerName other.domain2.com
<Directory "/disk1/www/Other">
<Files *.html>
SetHandler perl-script
PerlHandler HTML::Embperl
Options +ExecCGI
PerlSetEnv EMBPERL_OPTIONS 16
PerlSetEnv EMBPERL_COOKIE_PATH "/"
PerlSetEnv EMBPERL_COOKIE_DOMAIN ".domain2.com"
PerlSetEnv EMBPERL_SESSION_CLASSES "MySQL MySQL"
PerlSetEnv EMBPERL_SESSION_ARGS "DataSource=dbi:mysql:database2
UserName=username2 Password=password2 LockDataSource=dbi:mysql:database2
LockUserName=username2 LockPassword=password2"
</Files>
</Directory>
</VirtualHost>
Thanks!
Bill
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]