diff --git a/install.php b/install.php index a34214c48a..18fc362b62 100644 --- a/install.php +++ b/install.php @@ -3,7 +3,11 @@ define('INSTALLDIR', dirname(__FILE__)); function main() { - checkPrereqs(); + if (!checkPrereqs()) + { + return; + } + if ($_SERVER['REQUEST_METHOD'] == 'POST') { handlePost(); } else { @@ -13,6 +17,55 @@ function main() function checkPrereqs() { + if (file_exists(INSTALLDIR.'/config.php')) { + ?>
Config file "config.php" already exists.
+ + return false; + } + + if (version_compare(PHP_VERSION, '5.0.0', '<')) { + ?>Require PHP version 5 or greater.
+ return false; + } + + $reqs = array('gd', 'mysql', 'curl', + 'xmlwriter', 'mbstring', + 'gettext'); + + foreach ($reqs as $req) { + if (!checkExtension($req)) { + ?>Cannot load required extension "= $req ?>".
+ return false; + } + } + + if (!is_writable(INSTALLDIR)) { + ?>Cannot write config file to "= INSTALLDIR ?>".
+On your server, try this command:
+chmod a+w = INSTALLDIR ?>+ + return false; + } + + if (!is_writable(INSTALLDIR.'/avatar/')) { + ?>
Cannot write avatar directory "= INSTALLDIR ?>/avatar/".
+On your server, try this command:
+chmod a+w = INSTALLDIR ?>/avatar/+ + return false; + } + + return true; +} + +function checkExtension($name) +{ + if (!extension_loaded($name)) { + if (!dl($name.'.so')) { + return false; + } + } + return true; } function showForm()