diff --git a/upgrade.php b/upgrade.php index 69ab2ffdab..a287e3d1de 100644 --- a/upgrade.php +++ b/upgrade.php @@ -1,7 +1,9 @@ =". $php_min_works. " - <".$php_max_wontwork.") \n"; echo "--------------------------------------------------------\n\n"; -if (version_compare(PHP_VERSION, $required_php_min, '<')) { - echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ERROR !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"; - echo "This version of PHP (".PHP_VERSION.") is not compatible with Snipe-IT.\n"; - echo "Snipe-IT requires PHP version ".$required_php_min." or greater. Please upgrade \n"; - echo "your version of PHP (web/php-fcgi and cli) and try running this script again.\n\n\n"; - exit; +if ((version_compare(phpversion(), $php_min_works, '>=')) && (version_compare(phpversion(), $php_max_wontwork, '<'))) { + + echo "√ Current PHP version: (" . phpversion() . ") is at least " . $php_min_works . " and less than ".$php_max_wontwork."! Continuing... \n"; + echo sprintf("FYI: The php.ini used by this PHP is: %s\n\n", get_cfg_var('cfg_file_path')); } else { - echo "Current PHP version: (" . PHP_VERSION . ") is at least ".$required_php_min." - continuing... \n"; - echo sprintf("FYI: The php.ini used by this PHP is: %s\n\n", get_cfg_var('cfg_file_path')); + echo "!!!!!!!!!!!!!!!!!!!!!!!!! PHP VERSION ERROR !!!!!!!!!!!!!!!!!!!!!!!!!\n"; + echo "This version of PHP (".phpversion().") is NOT compatible with Snipe-IT.\n"; + echo "Snipe-IT requires PHP versions between ".$php_min_works." and ".$php_max_wontwork.".\n"; + echo "Please install a compatible version of PHP and re-run this script again. \n"; + echo "!!!!!!!!!!!!!!!!!!!!!!!!! ABORTING THE UPGRADER !!!!!!!!!!!!!!!!!!!!!!\n"; + exit; } - echo "Checking Required PHP extensions... \n\n"; // Get the list of installed extensions