Browser losing session

I am experiencing session problems.

Server: Ubuntu 14, Apache 2, PHP. Client: Kubuntu 20.04 Browsers: Firefox, Brave, Chrome.

I am not sure if the problem is at the client site or at the server site. I can not find anything with google search about the topic.

Problem is this. When I login from my computer with a browser to my server, everything works fine. When I login with a number of accounts on a number of websites, problems start at some point. I can login, but when I go to a next page, I have to login again. I assume the session gets lost. When I close the browser that gives this problem and I restart it, it works for a while without problems.

I first upgraded my client to the latest version of Kubuntu. I spread the logins over three different browsers: Firefox, Brave and Chrome. The problem remains the same.

My questions in short: Can it be a setting on the server, for example in Apache? Should I look at the server or is it a client problem? (That seems more likely to me.)

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Thank you for your answer, KFSys.

I use php and start each start file with


Then I use $_SESSION.

Which always works fine, until I have to many login’s.

It is not an expire session problem. I login. I move to the next page. And I am returned to the login screen.

When I close the browser with this problem and restart it, it works for a while.

After long digging on the internet I found this suggestion. (I could not find it again, so I can not give a direct link.)

Php writes session data to files. When one session is still open and php tries to write to another session, this can cause problems. As a solution it was recommended to use the statement


as soon as you are done with the session.

I have added this to my code. Six simultaneous sessions is currently not a problem. But it is to soon to say that the problem is solved. Much more testing is required.

If someone has other possible causes for the problem, please let me know.


Hi @avdwal25,

There are two possibilities here. One is your browser acting up but you mentioned you’ve tried with different ones. The second option would be something on the droplet.

Let’s review the second one. Usually, sessions are either saved in the database of your website or as a temporary file. There is a PHP limit which is set as to when the session expires. The first point would be checking out that and how long is the session time set to expire in your php.ini file. The second point you should check if is in some way you have session expiration configured from the website. This option might be probable if you are usng CMSs like WordPress, Magento, PrestaShop, etc. The third and final option I can think of now is checking you have enough space and free inodes on your droplet. You can do that by executing the commands

For Space

df -h

For Inodes

df -i

Regards, KFSys