Session Timeout

Discussion in 'PHP and MySQL' started by gsaunders, Jul 12, 2006.

  1. gsaunders

    gsaunders Perch

    I have a customer using a PHP script that basically uses sessions. Now after x minutes if idleness if the user tries to do something it shows that the session timed out and redirects them to a login screen.

    He needs to increase the timeout to at least 3 times longer. He doesn't want to alter the script so I think he can do it in a custom php.ini.

    I have never done this and have no idea what is involved.

    - Where do you place the php.ini?
    - What goes in there? Just the items needed to override some defaults or does everything need to be replicated in there.

    Any help would be greately appreciated.

    Thanks
  2. Stephen

    Stephen US Operations Staff Member

    Is it on windows or unix?
  3. gsaunders

    gsaunders Perch

    Sorry... unix.
  4. gsaunders

    gsaunders Perch

  5. Stephen

    Stephen US Operations Staff Member

    Was just waiting for unix admin to pick it up, as I don't have the answer for you :)
  6. gsaunders

    gsaunders Perch

    No problem... hopefully someone will speak up soon. I need to give some answers to my client, but I don't want to lead him wrong or cause any problems with other scripts.

    Thanks
  7. gsaunders

    gsaunders Perch

    More specific quesetions for the Unix folks out there...

    1) If I have a custom PHP.INI. If it is placed in the root of the website do only the scripts in the root use it? Do the scripts that are in subfolders use the custom PHP.INI sitting in the root as well?

    2) I believe the directive I need to override is session.cache_expire. Do I JUST put that one entry in the PHP.INI or do I have to put everything in there? I basically want all the defaults from the standard PHP.INI to be in effect, but JUST override that one directive.

    Thanks
  8. tanmaya

    tanmaya APAC Operations Staff Member

    just upload a .htaccess at doman root, with your custom options in below format:
    php_value session.auto_start 0
  9. gsaunders

    gsaunders Perch

    1) Oh... so I don't use a php.ini file?

    2) I was told by the developer of the script to use the session.cache_expire directive. Is that not correct? Should I use the directive you have listed above? Remember I have never messed with this before so it is all a little greek.

    Thanks
  10. tanmaya

    tanmaya APAC Operations Staff Member

    1. That is for Windows
    2. Sorry, that was just an example.
    For you it will be like:
    php_value session.cache_expire "180"
  11. gsaunders

    gsaunders Perch

    Also this is what documentation says about session.auto_start:

    << session.auto_start specifies whether the session module starts a session automatically on request startup. Defaults to 0 (disabled). >>

    So that doesn't look like it has anything to do with how long a session is allowed before timing out.

    Just trying to understand this and get to a final answer.
  12. gsaunders

    gsaunders Perch

    Oops... missed your last reply.

    Ok... thanks.
  13. gsaunders

    gsaunders Perch

    Once I make this change does the apache server have to be restared? Someone mentioned it may not take effect immediately without a restart or something.
  14. tanmaya

    tanmaya APAC Operations Staff Member

    .htaccess changes will be effective immediately.
  15. gsaunders

    gsaunders Perch

    Thank you for your help!

Share This Page

JodoHost - 26,000 hosting end-users in 100 countries
Plesk Web Hosting
VPS Hosting
H-Sphere Web Hosting
Other Services