SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Jul 2007
    Posts
    233
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP/MySQL - Logged in users getting booted off?

    Greetings,

    I have a php site where members log in and post classified ads. A member is complaining that they are occasionally getting booted off in the middle of making a post. I'm not sure why this is happening.

    Could it have something to do with my connection being: mysql_pconnect ?

    Are too many people using the site for persistent connection to be used and members are being booted out?

    Thanks

  2. #2
    SitePoint Member
    Join Date
    Feb 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi..
    I have also a problem that happen with u and I m so confused for this..I don't understand, what I m doing for this..
    Have a nice day..
    Shalini..

  3. #3
    SitePoint Addict
    Join Date
    Jul 2007
    Posts
    233
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone know what might be causing this?

  4. #4
    SitePoint Wizard wonshikee's Avatar
    Join Date
    Jan 2007
    Posts
    1,223
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Is the session data being stored in the database?

    That would make sense then with persistent connection, but why is it using that in the first place?

  5. #5
    SitePoint Addict
    Join Date
    Jul 2007
    Posts
    233
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As far as I know, the session data is not stored in the database, it must be on my shared hosting server or something.

    I am using persistent connection because I am using Dreamhost. They have a system set up called "conqueries", where one connection is equal to 25 queries of resources. So I set up persistent connection to conserve resources. They said this rule isn't important now like it was years ago, but they are still recording it in their statistics...

    So would changing "mysql_pconnect" to "mysql_connect" actually solve this issue and prevent people from randomly being logged out? Also, I am getting about 1000 visitors per day.

  6. #6
    SitePoint Wizard wonshikee's Avatar
    Join Date
    Jan 2007
    Posts
    1,223
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    If the session data is not stored in the database, it should have nothing to do with persistent connections (in theory).

    Things you want to check for are session cookie's lifetime, or a remote possibility could be if you still have register_globals on and somehow it's being overriden. Or it could just be a logical error in the code that's causing them to kill the session.

  7. #7
    SitePoint Addict
    Join Date
    Jul 2007
    Posts
    233
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I noticed that I have an item inside my listing page with an iframe that opens up a php file. This file did not have "session_start();" in it. Could this alone cause the user to lose their session?

    It rarely ever happens, the page is used a lot and I've never witnessed it myself, but maybe the user clicked in the iframe or something?

  8. #8
    Foozle Reducer ServerStorm's Avatar
    Join Date
    Feb 2005
    Location
    Burlington, Canada
    Posts
    2,699
    Mentioned
    89 Post(s)
    Tagged
    6 Thread(s)
    @peepy Issuing session_start() after a session is already started will simply trigger a warning. It is likely that the apache directives plus the server time and the user's browser time are causing the early boot.

    These are the apache directives:
    session.gc_probability = 1
    session.gc_divisor = 1000
    session.gc_maxlifetime = 1440

    The
    session.gc_maxlifetime is in seconds. If the server time and the browser time were off by 9 minutes then a user would be logged in for only 1 minute before the auto disposal of the session happens, killing their logged in state.

    You need to decide how you will control this. For example you could set an unlimited session time and then manually control deletion of the session when a user logs out, inactivity occurs for a xxx length of time or whatever criteria you want.

    Hope this helps,
    Steve
    ictus==""


Bookmarks

Posting Permissions

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