Hi,
I've found this problem elsewhere on the forums but not with a satisfactory solution or explanation.
My server environment:
- VPS: Ubuntu 16.0 LTS
- latest versions of Apache MySQL (as of April 2018)
- PHP (7.2) with additional modules installed and enabled
- MySQL InnoDB format = Barracuda
- Moodle v 3.4.2
Environment passes all Moodle checks.
Migrated data from another server, i.e.:
- mysqldump DB backup
- /var/www/moodledata/filedir
- /var/www/moodledata/geoip
- /var/www/moodledata/lang
- /var/www/moodledata/lock
- /var/www/moodledata/muc
- /var/www/moodledata/repository
File permissions:
- /var/www/html: chown = root:root; chmod = directories 755; files 644.
- /var/www/moodledata: chown = www-data:www-data; chmod = 777
The whole site was up and running for ~1 week before I started getting the following error increasingly until the whole site stopped working:
Invalid permissions detected when trying to create a directory.
I read here: https://moodle.org/mod/forum/discuss.php?d=343116#p1386751 (2016-12-05) that it might be an opcache issue. Which I took to mean that opcache was unable to write files to:
- /var/www/moodledata/cache,
- /var/www/moodledata/localcache,
- /var/www/moodledata/sessions,
- /var/www/moodledata/temp,
- and/or /var/www/moodledata/trashdir
I connected to the server via CLI and did the following:
$ chown www-data:www-data -R /var/www/moodledata
$ chmod 777 -R /var/www/moodledata
And the issue immediately went away. Nobody else had accessed the server before the issue arose. So somehow, the file permissions got changed without any intervention from me or anyone else.
Is this a known bug in Moodle? I couldn't find a similar one in the bug tracker.
Thanks in advance,
Matt