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
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?

Link to comment
Share on other sites

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?

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.