Timeout sessions solved... (Bugs)

by PeterSB @, Sunday, August 24, 2008, 21:32 (5695 days ago)
edited by PeterSB, Sunday, August 24, 2008, 21:49

Hello,

At last...! I have solved an old problem that I never found the solution here in the forum (ver.2 or ver.1) for the timeout session problem when posting or writing a post for a long period of time. As described here:
http://mylittleforum.net/forum/index.php?id=422

The problem solution depends on the web server where the forum is working and is related completly to the *tmp* dir where the PHP sessions are stored.

You can find a good explanation of the problem here...

In my case I had to change the php.ini where the script files are located (it depends on the server, some webhostings don't let you change the php.ini file)

When you login to the forum, the script start a PHP session for your local cookies in a temp dir on the server, beacause this dir is filled with hundreds of files per minute for all the users in that server, this dir has to be cleaned every "x" period of time, usually every 20 to 25 minutes. That's why if your posting writing took you more time than that, that will loose your login info and then logout automatically.

The solution is to change that subdir where the sessions files are stored to one of your local subdirs in the server. By this, no automatic process in the server will erase these files.

If you can add a php.ini file where your forum files are located, you have to add this in the php.ini

##-----php.ini----------------------
session.use_trans_sid=0;
session.gc_maxlifetime=180000;
session.cookie_lifetime=180000;
session.gc_probability=1;
session.gc_divisor=500;
session.save_path=/home/domain/public_html/phpsessions;
##-----php.ini----------------------


If you can not modify a php.ini file you can add some lines where the "session_start();" line is located like this:


##-----script--------------------
ini_set('session.use_trans_sid', 0);
ini_set('session.gc_maxlifetime', 180000);
ini_set('session.cookie_lifetime', 180000);
ini_set('session.gc_probability', 1);
ini_set('session.gc_divisor', 500);
ini_set('session.save_path', '/home/domain/public_html/phpsessions/');
##-----script--------------------

ver.1 --- inc.php
ver.2 --- index.php

You can see the value of the variable with this (for every variable one line):
echo 'session.gc_probability = ' .ini_get('session.gc_probability') . "<br>";

.
.
.
.
Hope this helps.
Peter

locked
5212 views

Timeout sessions solved...

by BrianC, Monday, August 25, 2008, 13:42 (5694 days ago) @ PeterSB

Peter,

Thanks a million for contacting me with this solution. This bug has caused so many of our posters grief over a long period of time. I first raised the problem here on MLF about 18 months ago. I've just implemented the solution and it seems to work on a first try-out waiting for over an hour between opening the posting window and actually submitting it. My Little Forum continues to be our preferred forum engine — and we have tried a few others. We're now up to 15764 Postings in 3069 Threads and have around 400 registered members of our forum scattered all around the world. I've even found a way to post YouTube videos and other multi-media content on our forum although that facility is not available to the general membership.

With much thanks,
Brian Coyne
Editor & Publisher
Catholica Australia
www.catholica.com.au

locked
4926 views

YouTube?

by Bert @, Wednesday, August 27, 2008, 16:19 (5692 days ago) @ BrianC

I've even found a way to post YouTube videos and other multi-media content on our forum although that facility is not available to the general membership.

Cool, and you want to keep this to yourself or did you plan to elaborate about it so that other people could use the same trick? ;-)

Bert

locked
4882 views

RSS Feed of thread