#!/usr/bin/perl use CGI::Carp qw(fatalsToBrowser); #################### # INTRODUCTION # # This script will help diagnose problems with Actinic session file management, specifically, problems with # obtaining session locks. Session files are typically placed in the acatalog directory, and hold your IP # address as part of the file name, eg, if your IP address is 123.123.123.123 then your session file name # would begin with 123Z123Z123Z123...... followed by some other data, and with a .session file extension. # # When a session is locked, an extra file is created with the same name, but with ".LCK" appended after the # .session part. When this LCK file exists, it prevents other actinic scripts from opening your session file # from 120 (the default) seconds since the LCK file was created. This can result in that bloody # annoying "cannnot be locked during session init" message. # # # HOWTO # # Before runing this script, edit the variables in the Settings section below, then upload to your cgi-bin # directory. Then point your browser to http://www.yourdomainname.com/cgi-bin/testsession.pl - the script # will run then output some information to tell you what is the problem with creating your session files. # #################### # SETTINGS # This is the uploaded session.pm, which Actinic renames to sm....{scriptversion#}.pm. If your script # version number is 6, then use "sm00006" (don't include .pm/pl etc, not needed). Default is sm000001. # If you use the wrong number here, you will see an error "cant locate object method new via package SessionLock". my $sessionpm = "sm000001"; # This is the session file that Actinic is complaining it cannot lock. This file is typically something # like "../acatalog/123Z123Z123Z123A1177425417B4900.session". my $sessionfile = "../acatalog/123Z123Z123Z123A1177425417B4900.session"; # END OF SETTINGS - DO NOT FIDDLE BELOW THIS LINE IF YOU DONT KNOW WHAT YOU ARE DOING!!! ##################### # MAIN # # Make sure "." is included in the @INC directory list so we can find our packages # my $bFound = 0; my $sDir; foreach $sDir (@INC) { if ($sDir eq ".") { $bFound = 1; last; } } if (!$bFound) { push (@INC, "."); } # # NT systems rarely execute the CGI scripts in the cgi-bin, so attempt to locate # the packages in that case. This may still fail if the cgi-bin folder is named # something else, but at least we will catch 80% of the cases. The INCLUDEPATHADJUSMENT # covers the remaining cases. # push (@INC, "cgi-bin"); # include actinic session library eval "require $sessionpm"; use strict; # HTTP Header print "Content-Type: text/html\r\n\r\n"; # Introduction to what the script does.. printf "Perl version: %vd\n
", $^V; print "This script tests session locking, and is used for diagnosing A General Script Error Occurred Error: ./acatalog/FILENAME.session can not be locked during Session init! errors.

"; print "Attempting to lock file: $sessionfile... (typically, this path seems to be relative to your wwwroot, NOT the cgi-bin directory(?))

"; # # Attempt to lock, and evaluate results.. # my $rLck = new SessionLock($sessionfile); my $nRet = $rLck->Lock(); if ($nRet == $SessionLock::SUCCESS) { print "Success!
Everything should be working for you... contact actinic support for further assistance if you still are having problems."; #$rLck->Unlock(); } elsif ($nRet == $SessionLock::ERR_TIMEOUT) { print "Timeout.
There could be disk access problems, or another process could have a lock on the session file"; } elsif ($nRet == $SessionLock::ERR_DIRPERMS) { print "File Permission Problems.
Check that the file path is correct, and 777 permissions are set on the directory containing the session files."; } elsif ($nRet == $SessionLock::FAILURE) { print "Lock Failed. (SessionLock::Failure).
Actinic developers might be able to suggest what to try next? or go have a look in Session.pm yourself to work out what causes ::Failure to be returned."; } else { print "UNKNOWN RESPONSE ($nRet) FROM SessionLock::Lock()"; }