3

I need some help installing Moodle v3.7.2. I've passed all checks for server configuration during installation, except for the fact that the site is recognized as http instead of https, maybe because of the proxy that sits in front of the nginx serving Moodle. Anyway, when I try to load the first page, I receive a generic error:

$string['servererror'] = 'An error occurred whilst communicating with the server';

I've investigated the source code for this error, and found the motivation:

On path /moodle/lib/classes/session/manager.php, row 90, this check fails:

if (!self::$handler->start())

The start() method is simply calling a php function:

session_start();

That returns FALSE and throw the exception. Any idea on how to solve this? Many thanks.

EDIT: I've also tried storing sessions on database:

$CFG->session_handler_class = '\core\session\database';
$CFG->session_database_acquire_lock_timeout = 120;

But with no luck, now the function that fails is:

session_set_save_handler
Jumpa
  • 4,319
  • 11
  • 52
  • 100
  • I'm running into this same problem, I tried installing on Ubuntu WSL apache 2 php 7.1. Did you figure it out? – relipse Apr 02 '20 at 15:55
  • 1
    I ended up purging cache and putting $CFG->session_handler_class = '\core\session\database'; in config.php and navigating to / and now it is working – relipse Apr 02 '20 at 16:51

2 Answers2

2

I have run into the same issue when installing Moodle 3.8 on a Windows-Subsystem-for-Linux (WSL) based Debian development server. Adding the config to switch to database sessions fixed it for me:

$CFG->session_handler_class = '\core\session\database';
$CFG->session_database_acquire_lock_timeout = 120;

I'm thinking that the WSL permissions are problematic when the Moodle data directory falls outside the moodle vhost path, so Moodle cannot read/write properly to the sessions path (yet I do see session files being created). You must delete the browser cookies/restart your browser after setting sessions to the database.

Vladimir Vukanac
  • 944
  • 16
  • 29
0

This is more of a generic solution, but did you check your $CFG->wwwroot in your config.php file? It has to be something like 'https://your.site.com/'. If you forget the s Moodle won't be able to build a connection if you configured your Webserver / proxy to forward users to :443.
I ran in this problem quite often, when I configured SSL for our Moodle Server.

DerKanzler
  • 53
  • 5