我第一次尝试在本地开发环境中设置 Moodle 3.1。
当我进入设置过程时,出现以下错误:
( ! ) 致命错误:未捕获 dml_exception:表“config”不存在 存在于 /Library/WebServer/Documents/moodle/lib/dml/moodle_database.php 上 621 号线
( ! ) dml_exception: 表“config”不存在于 /Library/WebServer/Documents/moodle/lib/dml/moodle_database.php 上 621 号线
我正在使用 PostgreSql 并配置我的数据库如下:
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-------------+----------+----------+-------------+-------------+-----------------------
moodle | moodle | UTF8 | en_AU.UTF-8 | en_AU.UTF-8 |
postgres | martyfenwick | UTF8 | en_AU.UTF-8 | en_AU.UTF-8 |
template0 | martyfenwick | UTF8 | en_AU.UTF-8 | en_AU.UTF-8 | =c/martyfenwick +
| | | | | martyfenwick=CTc/martyfenwick
template1 | martyfenwick | UTF8 | en_AU.UTF-8 | en_AU.UTF-8 | =c/martyfenwick +
| | | | | martyfenwick=CTc/martyfenwick
testdb | testdb | UTF8 | en_AU.UTF-8 | en_AU.UTF-8 |
(7 rows)
我使用以下命令创建了数据库和数据库用户:
createuser -SRDP moodle
createdb -E utf8 -O moodle moodle
当我创建用户时,我选择了一个密码,我在下面的 config.php 中使用它。
这是我的config.php:
<?php // Moodle configuration file
unset($CFG);
global $CFG;
$CFG = new stdClass();
$CFG->dbtype = 'pgsql';
$CFG->dblibrary = 'native';
$CFG->dbhost = 'localhost';
$CFG->dbname = 'moodle';
$CFG->dbuser = 'moodle';
$CFG->dbpass = 'mypasswordinhere';
$CFG->prefix = 'mdl_';
$CFG->dboptions = array (
'dbpersist' => 0,
'dbport' => 5432,
'dbsocket' => '',
);
$CFG->wwwroot = 'http://moodle.dev';
$CFG->dataroot = '/Library/WebServer/Documents/moodledata';
$CFG->admin = 'admin';
$CFG->directorypermissions = 0777;
// Force a debugging mode regardless the settings in the site administration
@error_reporting(E_ALL | E_STRICT); // NOT FOR PRODUCTION SERVERS!
@ini_set('display_errors', '1'); // NOT FOR PRODUCTION SERVERS!
$CFG->debug = (E_ALL | E_STRICT); // === DEBUG_DEVELOPER - NOT FOR PRODUCTION SERVERS!
$CFG->debugdisplay = 1; // NOT FOR PRODUCTION SERVERS!
require_once(dirname(__FILE__) . '/lib/setup.php');
// There is no php closing tag in this file,
// it is intentional because it prevents trailing whitespace problems!
我还尝试使用
php admin/cli/install.php
从 CLI 运行安装,但随后我得到了这个:
PHP 致命错误:未捕获错误:调用成员函数 is_temptable() 为 null /Library/WebServer/Documents/moodle/lib/dml/pgsql_native_moodle_database.php:393
我不知道我在这里做错了什么,以及为什么我无法构建我的数据库模式(当前为空)。
您可能想先尝试通过 PHP cli 安装数据库。 从moodle目录,以root身份,
sudo -u www-data php admin/cli/install_database.php --agree-license --adminuser=admin --adminpass=admin --fullname=mymoodle --shortname=shortmoodle --summary="moodle install" [email protected]
一定要设置变量 max_input_vars