Session cookie parram is not working properly

Session cookie parram is not working properly in my website
But in xampp local server it works exactly the way I want
I have a login page in my website
Where I set a session cookie parram for 1month
But in infinity free servers it just last for few hours
But in my local host server it last for exactly one month
Here’s my website link
Can u please tell me what wrong with my website

A “session cookie” doesn’t have a set validity. A session cookie, like the name suggests, is valid for a browser session. Which is typically until the browser is closed, or the browser decides to clean up the session cookies for some other reason.

If you’re referring to PHP sessions, please note that we have set a max session lifetime of 24 hours on our sessions. This is done to keep the amount of temporary session data being stored on the server to a reasonable amount.

If you want to store some user data for a longer time than that, you’re of course free to set your custom cookies in the browser, and store server data related to that session somewhere else, like in a database. This is also how the “Remember Me” functionality is often implemented, since you cannot rely on session data to be available for a long time.


If I get premium membership then can I set session cookie parram for more than 1month?

I’m sorry, but your question describes the impossible. A session cookie by definition does not have a fixed expiration time. A session cookie is valid for a browser session. That’s what makes a session cookie a session cookie. A cookie with a fixed expiration time is not a session cookie.

If you want to store data in the browser for a month, you need to send your own custom cookie with a custom validity. You can then store the relevant data in the cookie itself, or put a unique ID in the cookie and store the data related to that ID somewhere else (e.g. in a database).

You cannot rely on PHP session data to be available for a long time. The PHP session system is designed to be short lived. Session data is deleted whenever. You cannot make it last a long time, because that’s not how PHP sessions work.

PHP itself does not work like you think it does. No hosting service will change that.


Well thanks for your time.
You guys are awesome

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.