Sei que esse assunto já foi tratado em outros tópicos, mas de tudo que eu tentei nada deu certo.
Instalei um Linux (CentOS 7) com o Apache (httpd), PHP (5.6), Mysql e o Moodle (3.3). Quando tento acessar a página aparece o erro "Fatal error: $CFG->dataroot is not writable, admin has to fix directory permissions! Exiting".
Já alterei o dono do arquivo, as permissões, refiz toda a instalação duas vezes e não consegui ainda encontrar o motivo do erro.
Seguem algumas evidências:
config.php
$CFG->dbtype = 'mysqli'; // 'pgsql', 'mariadb', 'mysqli', 'mssql', 'sqlsrv' or 'oci'
$CFG->dblibrary = 'native'; // 'native' only at the moment
$CFG->dbhost = 'localhost'; // eg 'localhost' or 'db.isp.com' or IP
$CFG->dbname = 'moodle'; // database name, eg moodle
$CFG->dbuser = 'root'; // your database username
$CFG->dbpass = 'Moodle@123'; // your database password
$CFG->prefix = 'mdl_'; // prefix to use for all table names
$CFG->dboptions = array(
'dbpersist' => false, // should persistent database connections be used? set to 'false' for the most stable setting, 'true'
//can improve performance sometimes
'dbsocket' => false, // should connection via UNIX socket be used?
// if you set it to 'true' or custom path
// here set dbhost to 'localhost',
// (please note mysql is always using socket
// if dbhost is 'localhost' - if you need
// local port connection use '127.0.0.1')
'dbport' => '127.0.0.1', // the TCP port number to use when connecting to the server. keep empty string for the default port
'dbhandlesoptions' => false, // On PostgreSQL poolers like pgbouncer don't
// support advanced options on connection.
// If you set those in the database then
// the advanced settings will not be sent.
'dbcollation' => 'utf8mb4_unicode_ci', // MySQL has partial and full UTF-8
$CFG->wwwroot = 'http://10.2.9.7/moodle';
$CFG->dataroot = '/usr/local/moodledata/';
$CFG->directorypermissions = 02777;
$CFG->admin = 'admin';
ls -lha /usr/local/
drwxr-xr-x. 13 root root 149 Ago 21 23:29 .
drwxr-xr-x. 13 root root 155 Ago 21 19:59 ..
drwxr-xr-x. 2 root root 6 Nov 5 2016 bin
drwxr-xr-x. 2 root root 6 Nov 5 2016 etc
drwxr-xr-x. 2 root root 6 Nov 5 2016 games
drwxr-xr-x. 2 root root 6 Nov 5 2016 include
drwxr-xr-x. 2 root root 6 Nov 5 2016 lib
drwxr-xr-x. 2 root root 6 Nov 5 2016 lib64
drwxr-xr-x. 2 root root 6 Nov 5 2016 libexec
drwxrwsrwx. 2 apache apache 6 Ago 21 23:29 moodledata
drwxr-xr-x. 2 root root 6 Nov 5 2016 sbin
drwxr-xr-x. 5 root root 49 Ago 21 19:59 share
drwxr-xr-x. 2 root root 6 Nov 5 2016 src