FRIHOSTFORUMSSEARCHFAQTOSBLOGSCOMPETITIONS
You are invited to Log in or Register a free Frihost Account!


PHP.ini and PHP session maxlifetime question





jinger89
I am trying to extend the php session maxlifetime for my site, however I have no clue how to do it. I've tried finding the php.ini file to change it manually, but apparently we can't have access to that file, and I've tried changing it through php commands, to no avail either.

How do I change the session maxlifetime variable?
sonam
You cannot change php ini file on shared hostings. Only what do you can is change ini setting for your site.

Code:
ini_set("session.gc_maxlifetime", 160000);


If this not work proprerly maybe you need with ini_set to set session save path, too.


Sonam
jinger89
Hmm, thanks for that line of code, but I've tried it and it doesn't seem to work. Although am I using it correctly? I'm putting it after I create my sessions and store the variables.

Also, what's you were saying about set session save path?
apptastic
it didn't work for me either....
wumingsden
jinger89 wrote:
I am trying to extend the php session maxlifetime for my site, however I have no clue how to do it. I've tried finding the php.ini file to change it manually, but apparently we can't have access to that file, and I've tried changing it through php commands, to no avail either.

How do I change the session maxlifetime variable?


Try this -

Code:
$garbage_timeout = 3600; // in seconds, 3600seconds = 1hour
ini_set('session.gc_maxlifetime', $garbage_timeout);
jinger89
I figured out my problem. I was setting the gc_maxlifetime after I created the session variables. When I switched to before, it worked properly. Thanks for your help!
sonam
Quote:
Also, what's you were saying about set session save path?


I am reading somewhere:
Sometimes on shared hosting sessions maxlife not working properly because all sessions going in same tmp folder and ini_set commands comming in collision.

I am reading too:
This is not true the probem is in the script.


Now I don't know what is true but I haven't any problem with maxlife sessions on shared hostings. If your scripts are working good then you don't need to set session save path. Wink


Sonam
Related topics
php.ini
[Dúvidas] Pontos
PHP.ini
php.ini[RESOLVED]
Where is the php.ini file?
A Question about the PHP.INI file.
FATAL ERROR: register_globals is disabled in php.ini
how to config php ini for mail locally
php.ini
a bit of help with my php.ini, please?
php.ini
error in PHP.ini
PHP.ini and MYSQL databases
Relatively Secure Session Management System for PHP
Reply to topic    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.