Hello everyone I'm Italian and I apologize in advance for errors that read as follows :)
They were dark days for my server and I was going crazy to understand what could be the problem. I thought that the database was badly configured, or that the hard disk could have some troubles, and I was thinking of changing server. While it was testing the harddisk with defragmentation and scandisk (not runnable), I decided to open CCleaner and the miracle has happened. The Windows / Temp folder was completely blocked and you could not even open IT. CCleaner has cleaned up in ten hours the folder :') Ten hours for one folder!
After a day of cleaning, this morning I went to check it and inside there were 18000 0kb files or max 10kb all called "sess_0a5u2ou87 ........." (sess_ is prefixed, and i think are followed by md5).
When I opened one of them, I found in it the session variables of my website's users.
var|s:1:"2";timeout|i:1403338177;id|s:1:"1";name|s:17:"Foo";
Here is shown how I create sessions:
//create session
session_start();
$_SESSION['var'] = $var;
$_SESSION['timeout'] = time();
//work with session
public static function resetVar(){
if(isset($_SESSION['var'])){
unset($_SESSION['var']);
}
}
//destroy session
session_start();
if(isset($_SESSION['timeout'])) {
$duration = time() - (int)$_SESSION['timeout'];
if($duration > 6000) {
session_destroy();
header("Location: index.php");
}
$_SESSION['timeout'] = time();
}
Can anyone help me to understand this?
I was able to solve the problem. it was enough to change the folder where PHP saves the session.. changing it, the files "sess_..." older than one hour, will be automatically deleted! I think Php tried to delete the files in the Windows/Temp folder but probably for permission problems, he could not.
You can change the path in the php settings (php.ini) by changing the value of "session.save_path"
I had the same issue but I was seeing a PHP MYSQL PDO Driver missing error.
could not find driver
Only after some digging did I find that the session directory had 15k files. After delete, all good.
Checkout this php var that manages the lifetime of session files;
session.gc_maxlifetime
http://ar.php.net/manual/en/session.configuration.php.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With