Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Check that PHP is a recent enough version (ie 4.1.0 or later)

  • Loading branch information...
commit b0cb5e229757db7271c10064180dbe2021fb7657 1 parent 7b3be1b
martin authored
Showing with 15 additions and 0 deletions.
  1. +7 −0 lib/moodlelib.php
  2. +8 −0 lib/setup.php
View
7 lib/moodlelib.php
@@ -1641,6 +1641,13 @@ function iswindows() {
return isset($WINDIR);
}
+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);
+}
+
?>
View
8 lib/setup.php
@@ -63,6 +63,14 @@
setlocale ("LC_TIME", $CFG->lang);
}
+// Check that PHP is of a sufficient version
+
+ if ( ! check_php_version("4.1.0") ) {
+ $version = phpversion();
+ print_heading("Sorry, Moodle requires PHP 4.1.0 or later (currently using version $version)");
+ die;
+ }
+
// The following is a big hack to get around the problem of PHP installations
// that have "register_globals" turned off (default since PHP 4.1.0).
// Eventually I'll go through and upgrade all the code to make this unnecessary
Please sign in to comment.
Something went wrong with that request. Please try again.