Forums | Mahara Community
Problem with sessions when installing (PHP version problem?)
01 August 2019, 11:15 AM
I'm trying to install Mahara inside docker containers, which I'm very sure are configured correctly.
Initially, I was having problems during installation. The log was reporting error like:
... "Undefined index: messages", "/var/www/html/auth/session.php", 450" ...
Looking at the forum I could tell that there was a problem with PHP versions: around how the sessions were managed. This prompted my to double check the version of PHP I was running and sure enough it was version 7.2. I reconfigured my PHP container to be version 7.0.33 and rebuilt my system...
But then I got a web output stating :
Warning: session_write_close(): Session data file is not created by your uid in /var/www/html/auth/session.php on line 520
Warning: session_write_close(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (3;/var/www/mahara_data/sessions) in /var/www/html/auth/session.php on line 520
So it seems that I still have problem with sessions with PHP version 7.0.x
Any suggestions? Happy to provide more information about the setup I've configured.
01 August 2019, 12:41 PM
Looking at that error "session.save_path is correct (3;/var/www/mahara_data/sessions) " it sounds like there is a problem writing to sessions directory
Have you read / tried the info under "Unable to login after upgrade"?
01 August 2019, 6:20 PM
I had seen other forum posts where you talked about the difference between PHP version on how it managed the 'sessions' directory, consequently I have been doing installation with a empty 'mahara_data' directory when debugging with issue.
I had noticed that PHP 7.0.* seem to create less files in 'sessions' (i.e. deleting the directory was much quicker), so I just did a quick test.
With PHP 7.0.33, sessions contains 4,368 subfolders (and 2 files)
With PHP 7.2.20, session contains 33,824 subfolders (and 919 files)
Anyway, I guess this is academic since I should stick to PHP 7.0.x
01 August 2019, 7:08 PM
Hello again Robert,
I have finally found my problem which was to do with shared volumes with my docker containers.
I'd set up Mahara using three containers; (1) HTTPd, (2) PHP, (3) POSTGRES.
So that the Mahara htdocs was available to both HTTPd and PHP containers I created an external 'volume' which both containers pointed to. This has a dual benefit of not having to copy to files locally in each containers, and having the possibility of modifying the file in htdocs have having served up by either container automatically.
I did the same for "maraha_data", thinking that both the HTTPd and PHP containers would need access to it. And that's where all my problems came from. I guess PHP has issues with the sessions directory being stored in an external volume (though on the OS it looks like a normal directory). So I tried creating the 'maraha_data' directory locally in the PHP container and it all installed smoothly.
Only problem will be if the HTTPd server needs to serve up files from this directory which isn't replicated in its container. But I think that's not going to happen.
Thank you for your earlier response, and thank to Tobias for helping me also. I'll post my docker setup files on my Mahara page when I've tidied my project up and written up the documentation.
Have a nice day,