Jump to content

[SOLVED] How do I extend session life?


frankerpulten

Recommended Posts

Hi,

I don't have access to the configuration file for the server, so i tried to change the session timeout by creating a file called php.ini and placing it in the specific folder for the site.  Here's the file code:

register_globals = on
session.save_path = "/mnt/w9999/.phpsessions"
upload_tmp_dir = "/tmp/"
upload_max_filesize = 20000000
post_max_size = 20000000
zend_extension = /usr/local/nf/share/ioncube/ioncube_loader_fre_4.4.so
session.gc_maxlifetime = 3600

This didn't seem to work.  The session still times out for users after 24 minutes.

 

Any hints or help would be awesome :)

Link to comment
https://forums.phpfreaks.com/topic/165012-solved-how-do-i-extend-session-life/
Share on other sites

Hi thanks for your reply.  My php code now looks like this:

<?php
session_start();
ini_set('session.gc_maxlifetime',3600); 
ini_set('session.cookie_lifetime',3600);



?>

 

on the page that users are on while running a flash application.

 

I tested it and the session still seems to time out after 24 minutes though. 

Any ideas?

Are you on a shared web server and do you still have the following setting in place (is that valid path as well?) -

session.save_path = "/mnt/w9999/.phpsessions"

 

What does a phpinfo(); statement show for the session.save_path?

 

 

On a shared web server, when the session.save_path is the common default location, the shortest session.gc_maxlifetime of all the accounts is what gets used to delete the old session data files.

 

You need to set session.save_path to be to a private folder within your account's folder tree in order to get your session settings to apply to just your session data files.

 

Create a folder of your own and set the session.save_path to match that folder. You must set the session.save_path before every session_start(). Setting it globally in a local php.ini file would be the best way to set it.

I get this error now that I've changed the session save path :

Warning: session_start() [function.session-start]: open(/www/mysite.ca/myfolder/session/sess_9ff691f817defdbbf5b32fffc39d5f64, O_RDWR) failed: No such file or directory (2) in /mnt/w0803/d01/s19/b02e13a5/www/mysite.ca/myfolder/consent2.php on line 8

 

I created a folder called session in the folder of my web site.

Thanks for all your help so far.  :)

I'm pretty new to php. 

Based on the path listed in the error message for your script -

 

/mnt/w0803/d01/s19/b02e13a5/www/mysite.ca/myfolder/

 

The path to the session folder is probably -

 

/mnt/w0803/d01/s19/b02e13a5/www/mysite.ca/myfolder/session/

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.