Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1039309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:05:01+00:00 2026-05-16T15:05:01+00:00

I am a little confused about the session management in PHP. A lot of

  • 0

I am a little confused about the session management in PHP. A lot of focus in the docs is devoted to the magic PHPSESSID cookie. I program Ajax and am actually thinking of getting rid of cookies. I understand that I can do so in the php.ini file. It also seems possible to suppress the PHPSESSID by means of a simple ini_set(“session.use_cookies”,0) at the top of my login script. Don’t get me wrong, I do want sessions. My Ajax hand-shakes will, where required, POST the session id. From the cookie-centric docs, one just gains the impression that all session expiry handling is done via the time stamp on the cookie. I am unclear on how exactly a timestamp of a cookie can prompt the server to expire the session cache over a stateless connection? Put another way, in a cookie-less setup, how can I instruct the server to clean down the session cache after a while? Would I still be calling session_set_cookie_params? Seems quaint…

If I understand well, then I should call sessionID(sid) and check the return for “” to make out whether “sid” is dead. Correct?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:05:02+00:00Added an answer on May 16, 2026 at 3:05 pm

    session.cookie_lifetime influences the expires parameter of the cookie that session_start() sets. It’s like setcookie(<sessionname>, <sessionid>, time()+<session.cookie_lifetime>, ...). It advises the client not to use that cookie after time()+<session.cookie_lifetime> (but it can of course remove it earlier, not accept it at all or ignore the “expires” parameter altogether).
    The session id is used to select the “right” session data. I.e. if a request does not contain the correct session id the session data is not available to the php script.
    If only that single client knows the session id (as it should be) and throws away the cookie that contains the session id the session data is unreachable. Unreachable but still present on the server.

    When a script invokes session_start() there is a chance that the garbage collection is started, see session.gc_probability and session.gc_divisor.
    Then the flat-file session handler loops through all files in the directory specified by session.save_path and checks the “last modified time” (mtime). If that timestamp is older than now-session.gc_maxlifetime the file is removed (unless this file corresponds to the current session id, in which case it doesn’t matter how old the file is).
    That takes some time and is therefore not performed on each call to session_start().

    I.e. there can be session files on the server that are older than both session.cookie_lifetime and session.gc_maxlifetime.
    session.cookie_lifetime signals the client that there is no need to store the cookie/id after x seconds.
    session.gc_maxlifetime signals the session mechanism that there is no need to keep the data after x seconds.
    But as long as the data remains on the server it can be accessed if the respective session-id is sent.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a little confused about two new technologies receiving a lot of buzz
I am a little confused about the benefits or conc using scriptmanager with ajax
So I'm a little confused about Qt's memory management. I was looking at the
I am little bit confused about Zend authentication session storage system. I will try
I am little confused about outoging traffic cost in GAE projects. see: https://developers.google.com/storage/docs/pricingandterms So,
I'm a little confused about this paragraph on OO visibilty in PHP. was curious
Still a little confused about Objective-C memory management. I think my confusion stems from
I am a little confused about Accept-Encoding . I have Web Service which would
I am a little confused about the roles of a java application server and
I'm a little confused about something. I wrote an app and tested it on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.