bakbai Posted December 3, 2010 Share Posted December 3, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/220607-session-virus-or-worm/ Share on other sites More sharing options...
MadTechie Posted December 4, 2010 Share Posted December 4, 2010 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), i.e. root | |--public_html |----+index.php |--session 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 session_save_path($sessdir)); ini_set('session.gc_probability', 1); //force on // 2*60*60 = 2 hours $sessionExpireTime=2*60*60; //Change Garbage Collection to new life time ini_set('session.gc_maxlifetime', $sessionExpireTime); //Set cookie life time session_set_cookie_params($sessionExpireTime); 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) -MadTechie Quote Link to comment https://forums.phpfreaks.com/topic/220607-session-virus-or-worm/#findComment-1142832 Share on other sites More sharing options...
bakbai Posted December 4, 2010 Author Share Posted December 4, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/220607-session-virus-or-worm/#findComment-1142895 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.