| 9 | | |
|---|
| 10 | | |
|---|
| 11 | | |
|---|
| 12 | | |
|---|
| 13 | | // Sanity checks - conditions under which Elgg will refuse to run |
|---|
| 14 | | // TODO - this'll no doubt want polishing and gettexting :) - Sven |
|---|
| 15 | | |
|---|
| 16 | | $diemessages = array(); |
|---|
| 17 | | |
|---|
| 18 | | if (!defined("path") || (substr(path, -1) != "/")) { |
|---|
| 19 | | $diemessages[] = "Configuration problem: The 'path' setting in includes.php must end with a forward slash (/)."; |
|---|
| 20 | | } |
|---|
| 21 | | if (!defined("url") || (substr(url, -1) != "/")) { |
|---|
| 22 | | $diemessages[] = "Configuration problem: The 'url' setting in includes.php must end with a forward slash (/)."; |
|---|
| 23 | | } |
|---|
| 24 | | if (ini_get('register_globals')) { |
|---|
| 25 | | // this shouldn't be needed due to the htaccess file, but just in case... |
|---|
| 26 | | $diemessages[] = " |
|---|
| 27 | | Configuration problem: The PHP setting 'register_globals', which is a huge security risk, is turned on. |
|---|
| 28 | | There should be a line in the .htaccess file as follows: <code>php_flag register_globals off</code> |
|---|
| 29 | | If the line is present but has a # at the start, remove the # character. |
|---|
| 30 | | "; |
|---|
| 31 | | } |
|---|
| 32 | | switch ($CFG->dbtype) { |
|---|
| 33 | | case 'mysql': |
|---|
| 34 | | $funcheck = 'mysql_query'; |
|---|
| 35 | | break; |
|---|
| 36 | | case 'postgres7': |
|---|
| 37 | | $funcheck = 'pg_query'; |
|---|
| 38 | | break; |
|---|
| 39 | | } |
|---|
| 40 | | if (!function_exists($funcheck)) { |
|---|
| 41 | | // people have been having a spot of trouble installing elgg without the mysql php module... |
|---|
| 42 | | $diemessages[] = " |
|---|
| 43 | | Installation problem: Can't find the PHP MySQL or Postgresql module. |
|---|
| 44 | | Even with PHP and MySQL or Postgresql installed, sometimes the module to connect them is missing. |
|---|
| 45 | | Please check your PHP installation. |
|---|
| 46 | | "; |
|---|
| 47 | | } |
|---|
| 48 | | |
|---|
| 49 | | |
|---|
| 50 | | if (count($diemessages)) { |
|---|
| 51 | | $diebody = '<html><body><h1>Error - Elgg cannot run</h1><ul>'; |
|---|
| 52 | | $diebody .= '<li>' . implode("</li><li>", $diemessages) . '</li>'; |
|---|
| 53 | | $diebody .= '</ul><p>Please read the INSTALL file for more information.</p></body></html>'; |
|---|
| 54 | | die($diebody); |
|---|
| 55 | | } else { |
|---|
| 56 | | unset($diemessages); |
|---|
| 57 | | } |
|---|
| 58 | | |
|---|
| 59 | | |
|---|
| 60 | | |
|---|
| 61 | | |
|---|