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 6990723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:23:39+00:00 2026-05-27T19:23:39+00:00

Related Sessions – Sessions and Statefullness Sessions – Sessions are Stateful, PHP user code

  • 0

Related

Sessions – Sessions and Statefullness

Sessions – Sessions are Stateful, PHP user code is not

Sessions – Where to use session_start()

Sessions – Statefullness and Runs

Sessions – vs. Mysql

PHP.net

session_start()

session_id()

session_destroy()

Specefic Two ID issue

Sessions – extra ID created

Sessions – extra ID created – Cookie Location

  • 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-27T19:23:40+00:00Added an answer on May 27, 2026 at 7:23 pm

    How can I determine what is the mechanism which causes session_start to create new sessions wrather than resume a previous one?

    This is visible in the PHP sourcecode for the session_start function. You need to read the C-code and compare with your usage.

    From what I know about sessions, session_start won’t start a new session if already one is active. To find out if a session is already active, please see How to tell if a session is active?.

    However if a session is started (and it didn’t existed earlier) and then closed and you create a new session in the same request, PHP might think that the session does not exists (because the cookie from the browser is still empty). So then a second, also new, session will be started.

    If you’re unsure what does what, just create yourself a test script where you play around with scenarios.

    A possible scenario:

    1. Browser sends request
    2. PHP starts
    3. session_start() is called. No session cookie exists, PHP will create a new session id and will create cookie headers.
    4. you close the session.
    5. session_start() is called. No session cookie exists (in the request), PHP will create a new session id and will create cookie headers.

    Two sessions have been created of which one will not be used by the browser for subsequent requests (the session id header for the cookie has been “overwritten” (the last cookie header replaces previous ones for the cookie in question).

    To debug things, headers_list can be useful as well as $_COOKIES.

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

Sidebar

Related Questions

Related: see here I've got this command: exec((wget -O http://domain/file.zip && mysql -u user
What's the best way of storing session related data of a user (like, for
Related to: Testing firmware starting a microcontroller simulator/emulator Interpreting assembly code If you are
Related to: Query Windows Search from Java But this time to use OSX's spotlight
In my application I save some data related to the users sessions in the
This will not be a programming question but more technology / platform related question.
Is there an elegant solution for synchronizing sessions across multiple ASP.NET applications? I'm sure
Can any one teach me how to use sessions? I have a login page
During one of my lab sessions I was given a problem related to delegates
I'm trying to figure out how to best use Sessions in (N)Hibernate. I have

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.