Jump to content


Session Virus or worm?

  • Please log in to reply
2 replies to this topic

#1 bakbai

  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 03 December 2010 - 11:15 PM

hello all,
please kindly assist me, i have a site that has been running well for over a year now till last week. the session fluctuate presenting the access denied page, like the session are unset, if one clicks another link, it might open as if the session are set. it goes back and front like that. the site is hosted somewhere, not locally. my hosted suggested that setenv TIMEOUT 300, setenv CPULIMIT 100 which i guest is not the case, cos, if it really unset the session due to time, how can it automatically set the session again?

please does anyone has an idea

#2 MadTechie

  • Staff Alumni
  • Advanced Member
  • 9,404 posts
  • LocationUK

Posted 04 December 2010 - 07:21 AM

Check your PHPinfo to find what the current time-out is,

In any case, try this

Let's say your have index.php in your public_html folder

now first create a folder called "session" in the folder that contains "public_html" and make sure you have write access(777),


Now in index.php

 //path to Session dir
$sessdir = dirname(__FILE__).'/../session';
//Create folder is it doesn't exist
if (!is_dir($sessdir)) { mkdir($sessdir, 0777); }
//change save location to the sessions path

ini_set('session.gc_probability', 1); //force on

// 2*60*60 = 2 hours

//Change Garbage Collection to new life time
ini_set('session.gc_maxlifetime', $sessionExpireTime);

//Set cookie life time
session_start(); //as normal

//Update Cookie ExpireTime
if (isset($_COOKIE[session_name()])){
setcookie(session_name(), $_COOKIE[session_name()], time() + $sessionExpireTime, "/");

(please note theirs probably a ton of typos in the above but i hope it helps)

Computers are good at following instructions, but not at reading your mind.

The quality of a response, is usually directly related to the quality of the question. ©2009 mjdamato

I dunno about that. A regular expression has a 0% chance of touching my penis.

the code is professionally made up but not working

Remember to Click Solved, how to ask questions - the smart way

#3 bakbai

  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 04 December 2010 - 02:32 PM

MadTechie thank you,
are you suggesting that i create an additional folder called session in my root and then, add the script you provided in the index.php?

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users