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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:37:13+00:00 2026-06-10T22:37:13+00:00

I know this problem has been presented here in SO and I’ve tried the

  • 0

I know this problem has been presented here in SO and I’ve tried the solutions but it’s still not fixed.

PHP is deleting the session after some time of inactivity (i assume 24 minutes as it’s the default and seems to fit the testing).

I have the following code set in all the pages:

ini_set('display_errors', 0);
$sessionCookieExpireTime = 2880000;
session_set_cookie_params($sessionCookieExpireTime);
ini_set('session.gc_maxlifetime', $sessionCookieExpireTime);

session_start();
echo ini_get('session.gc_maxlifetime'); //echos 2880000 as expected

But the session still gets reset after 24 minutes (or so) of inactivity.

phpinfo() return the following output for session:
enter image description here

Any idea why this isn’t working? (PHP 5.3.10)

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-06-10T22:37:15+00:00Added an answer on June 10, 2026 at 10:37 pm

    Although Marc B answer shares some great insight it wasn’t working for me. I was pretty sure everything was fine with my script and I had nothing messing with the session in my code.

    After an epic struggle I discovered that my problem was actually due to shared hosting environment. From the PHP doc:

    “If different scripts … share the same place for storing the session
    data then the script with the minimum value will [determine the
    session timeout]“.

    After this the problem was quite obvious. Some script (hosted on the same server) was using the default php.ini session.gc_maxlifetime and that was resetting my sessions.

    The solution was to create a folder under the root of my hosting (make sure it’s not web accessible), set the right permissions to it and then use session.save_path to tell php where to store my sessions. Something like:

    ini_set("session.gc_maxlifetime","21600"); // 6 hours
    ini_set("session.save_path", "/your_home/your_sessions/");
    session_start();
    

    This website provided great insight: php sessions on shared hosting

    So if you come accross this issue make sure you follow Marc B recommendations and if that doesn’t work try this out.

    Best wishes!!

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

Sidebar

Related Questions

I know this problem has been addressed a few times on here. I tried
I know this has probably been asked before but for my problem I cannot
I know this has been asked many times, but not quite the way I'm
I don't know if anyone else even has this problem, or has noticed, but
I'm very sure this problem has been solved, but I can't find any information
I know this has been asked before (and I will keep researching), but I
I know this question has been asked numerous times but I couldn't find a
I know I've solved this problem before, but I can't remember or find the
I know there is a lot of thread about this problem but I dont
I know this question has been asked quite a few times, however, 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.