Leantime / docker-leantime

Official Docker Image for Leantime https://leantime.io
GNU Affero General Public License v3.0
190 stars 86 forks source link

[Suggestion] PHP Sessions - custom.ini #79

Open pdunne opened 4 months ago

pdunne commented 4 months ago

Hi,

I am testing your docker image internally and I came across an issue with sessions.

I'll start with the solution I found to my problem:

I added this to custom.ini in the ./config subfolder session.auto_start = 0

I also made sure to add this to /usr/local/etc/php/conf.d/custom.ini inside my docker image before restarting it (since I already had a running image).

Problem If I remained logged in on a device, which then went to sleep, or internet connection, upon reconnection I was automatically logged out of Leantime. And then every time I tried to log back in, I was redirected to the login page. I cleared the cookies from my browser, and tried logging in using other browsers (Edge, Firefox, Chromium), but I had the same problem. I also deleted the files in the /sessions/ directory. Before I found the above solution, the only way to resolve it was to restart the docker images.

Errors from the log

This is what helped me identify the problem:

/var/www/html/logs/error.log

[18-Apr-2024 07:53:38 UTC] PHP Warning:  ini_set(): Session ini settings cannot be changed after headers have already been sent in /var/www/html/app/Core/Session.php on line 62
[18-Apr-2024 07:53:38 UTC] PHP Warning:  ini_set(): Session ini settings cannot be changed after headers have already been sent in /var/www/html/app/Core/Session.php on line 63
[18-Apr-2024 07:53:38 UTC] PHP Warning:  session_name(): Session name cannot be changed after headers have already been sent in /var/www/html/app/Core/Session.php on line 84
[18-Apr-2024 07:53:38 UTC] PHP Warning:  session_id(): Session ID cannot be changed after headers have already been sent in /var/www/html/app/Core/Session.php on line 85
[18-Apr-2024 07:53:38 UTC] PHP Warning:  session_start(): Session cannot be started after headers have already been sent in /var/www/html/app/Core/Session.php on line 86