3 // Sanity checks - conditions under which Elgg will refuse to run
7 $diemessages = array();
9 if ($CFG->dirroot
== "") {
10 $diemessages[] = 'Configuration problem: The <code>$CFG->dirroot</code> setting in config.php is empty.';
11 } elseif (substr($CFG->dirroot
, -1) != "/") {
12 $diemessages[] = 'Configuration problem: The <code>$CFG->dirroot</code> setting in config.php must end with a forward slash (/).';
13 } elseif (!file_exists($CFG->dirroot
)) {
14 //this needs checking now, because includes.php needs it to work
15 $diemessages[] = 'Configuration problem: The <code>$CFG->dirroot</code> setting in config.php points to a directory that does not exist.';
16 } elseif (!is_dir($CFG->dirroot
)) {
17 $diemessages[] = 'Configuration problem: The <code>$CFG->dirroot</code> setting in config.php points to a location that is not a directory.';
20 if (!preg_match('#^https?://.+#', $CFG->wwwroot
)) {
21 $diemessages[] = 'Configuration problem: The <code>$CFG->wwwroot</code> setting in config.php is empty or not a valid URL.';
22 } elseif (substr($CFG->wwwroot
, -1) != "/") {
23 $diemessages[] = 'Configuration problem: The <code>$CFG->wwwroot</code> setting in config.php must end with a forward slash (/).';
26 if ($CFG->dataroot
== "") {
27 $diemessages[] = 'Configuration problem: The <code>$CFG->dataroot</code> setting in config.php is empty.';
28 } elseif (substr($CFG->dataroot
, -1) != "/") {
29 $diemessages[] = 'Configuration problem: The <code>$CFG->dataroot</code> setting in config.php must end with a forward slash (/).';
32 if (ini_get('register_globals')) {
33 // this shouldn't be needed due to the htaccess file, but just in case...
35 Configuration problem: The PHP setting 'register_globals', which is a huge security risk, is turned on.
36 There should be a line in the .htaccess file as follows: <code>php_flag register_globals off</code>
37 If the line is present but has a # at the start, remove the # character.
42 switch ($CFG->dbtype
) {
44 $funcheck = 'mysql_query';
47 $funcheck = 'pg_query';
50 if (!function_exists($funcheck)) {
51 // people have been having a spot of trouble installing elgg without the mysql php module...
53 Installation problem: Can't find the PHP MySQL or Postgresql module.
54 Even with PHP and MySQL or Postgresql installed, sometimes the module to connect them is missing.
55 Please check your PHP installation.
60 if (count($diemessages)) {
61 $diebody = '<html><body><h1>Error - Elgg cannot run</h1><ul>';
62 $diebody .= '<li>' . implode("</li><li>", $diemessages) . '</li>';
63 $diebody .= '</ul><p>Please read the INSTALL and config-dist.php files for more information.</p></body></html>';