Results 1 to 4 of 4

Thread: PHP Default Session Timeout

  1. #1
    spacepir is offline x10Hosting Member
    Join Date
    Aug 2012
    Location
    Scotland, United Kingdom
    Posts
    41

    PHP Default Session Timeout

    Hey, me again, this time I'm wondering what x10's default PHP Session timeout is, and if there's any way to change it. I don't have access to php.ini, and seeing as I'm on free hosting, I don't think I'm going to have the flexibility I require, for now.

    The reason I ask the question is: After leaving my game idle for a while, I get an SQL error when my status bar updates itself. It happens because the Session has timed out, and, well, there's no session_id to forward to the database query.

    As always, replies appreciated.

  2. #2
    Skizzerz's Avatar
    Skizzerz is offline Contributors
    Join Date
    Nov 2007
    Location
    Texas
    Posts
    2,455

    Re: PHP Default Session Timeout

    No, there is no way to change it. The session timeout is the default PHP value (which means PHP sessions expire when the user closes their browser). If you use PHP's session mechanism (which I personally do not recommend, as it has numerous downsides, such as the inability to load multiple pages at the same time), and desire sessions that last for how long YOU control, you need to back it with your own session mechanism.

    EDIT: Additionally, always be sure to check for an active session before issuing any session-related db queries.
    Last edited by Skizzerz; 01-01-2013 at 07:06 PM.
    Ryan Schmidt | Contributor
    █ 888-X10-9668 - ryan[@]x10hosting.com
    x10Hosting - Giving Away Hosting Since 2004
    Premium Hosting | VPS Services

  3. #3
    spacepir is offline x10Hosting Member
    Join Date
    Aug 2012
    Location
    Scotland, United Kingdom
    Posts
    41

    Re: PHP Default Session Timeout

    Ok, well it seems to be expiring every half hour or so, which seems close to PHP's default. (24 mins). Does anyone have any solutions?

  4. #4
    ezadx10b is offline x10Hosting Member
    Join Date
    Feb 2012
    Posts
    29

    Re: PHP Default Session Timeout

    use htaccess

    #change default session name for security default is PHPSESSIONID
    php_value session.name "©$-£??!?€-FgbJJ7HCga"
    #session timeout
    php_value session.cache_expire "30"
    #for secure session only use if u have ssl
    php_flag session.cookie_secure "Off"

Similar Threads

  1. PHP Session bug
    By gargamel86 in forum Free Hosting
    Replies: 1
    Last Post: 08-17-2011, 09:00 AM
  2. Shopping Cart modules session timeout
    By bmrestate26 in forum Free Hosting
    Replies: 3
    Last Post: 06-27-2011, 01:08 AM
  3. IE PHP session help
    By as4s1n in forum Scripts, 3rd Party Apps, and Programming
    Replies: 0
    Last Post: 03-09-2010, 06:46 PM
  4. PHP session var
    By Gauze in forum Free Hosting
    Replies: 1
    Last Post: 08-26-2008, 08:49 PM
  5. PHP session ID
    By callumacrae in forum Scripts, 3rd Party Apps, and Programming
    Replies: 6
    Last Post: 07-10-2008, 02:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
dedicated servers