From 6f0c8b88b498bef47682071700b5641badd90a4b Mon Sep 17 00:00:00 2001 From: moodler Date: Sat, 6 Dec 2003 06:43:21 +0000 Subject: [PATCH] A little script to quickly check compatibility on servers. --- lib/compatible.php | 109 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 lib/compatible.php diff --git a/lib/compatible.php b/lib/compatible.php new file mode 100644 index 0000000000..057a539509 --- /dev/null +++ b/lib/compatible.php @@ -0,0 +1,109 @@ + + + + +Moodle Environment Test + + + +"; + echo "$name"; + echo "$value"; + if ($badcomment) { + echo "$badcomment"; + } else { + echo "Looks good"; + } + echo ""; +} + +function ini_get_bool($ini_get_arg) { +/// This function makes the return value of ini_get consistent if you are +/// setting server directives through the .htaccess file in apache. +/// Current behavior for value set from php.ini On = 1, Off = [blank] +/// Current behavior for value set from .htaccess On = On, Off = Off +/// Contributed by jdell@unr.edu + + $temp = ini_get($ini_get_arg); + + if ($temp == "1" or strtolower($temp) == "on") { + return true; + } + return false; +} + +function check_php_version($version="4.1.0") { +/// Returns true is the current version of PHP is greater that the specified one + $minversion = intval(str_replace(".", "", $version)); + $curversion = intval(str_replace(".", "", phpversion())); + return ($curversion >= $minversion); +} + + + +///////////////////////////////////////////////////////////////////////////////////// + + $error = 0; + + echo "

Moodle compatibility tester

"; + + echo ""; + +/// Check that PHP is of a sufficient version + + if (!check_php_version("4.1.0")) { + print_row("PHP Version", "Old", "Moodle requires PHP 4.1.0 or later"); + } else { + print_row("PHP Version", "OK"); + } + +/// Check some PHP server settings + + if (ini_get_bool('safe_mode')) { + print_row("safe_mode", "On", "Moodle can not handle files properly with safe mode on"); + $error++; + } else { + print_row("safe_mode", "Off"); + } + + if (ini_get_bool('session.auto_start')) { + print_row("session.auto_start", "On", "This should be Off"); + $error++; + } else { + print_row("session.auto_start", "Off"); + } + + if (ini_get_bool('magic_quotes_runtime')) { + print_row("magic_quotes_runtime", "On", "This should be Off"); + $error++; + } else { + print_row("magic_quotes_runtime", "Off"); + } + + if (!ini_get_bool('file_uploads')) { + print_row("file_uploads", "Off", "This should be On"); + $error++; + } else { + print_row("file_uploads", "On"); + } + + if (!is_readable(ini_get('session.save_path'))) { + print_row("session.save_path", "Broken", "It seems your server does not support sessions"); + $error++; + } else { + print_row("session.save_path", "Works"); + } + + echo "
"; + + if ($error == 1) { + echo "

$error error was found. See http://moodle.org/doc

"; + } else if ($error) { + echo "

$error errors were found. See http://moodle.org/doc

"; + } else { + echo "

Server looks good - clear to install!

"; + } +?> -- 2.39.5