1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76:
<?php
class ServerConfiguration
{
const MIN_PHP_VERSION = '5.6';
const RECOMMENDED_PHP_VERSION = '7.1';
private static $mod_rewrite = 'mod_rewrite';
public static function get_phpversion()
{
$system_phpversion = phpversion();
$matches = array();
if (preg_match('`^([0-9]+(?:\.[0-9]+){0,2})`u', $system_phpversion, $matches))
{
return $matches[1];
}
return $system_phpversion;
}
public function is_php_compatible()
{
return self::get_phpversion() >= self::MIN_PHP_VERSION;
}
public function has_gd_library()
{
return @extension_loaded('gd');
}
public function has_curl_library()
{
return @extension_loaded('curl');
}
public function has_mbstring_library()
{
return @extension_loaded('mbstring');
}
public function has_url_rewriting()
{
if (function_exists('apache_get_modules'))
{
return in_array(self::$mod_rewrite, apache_get_modules());
}
throw new UnsupportedOperationException('can\'t check url rewriting availability');
}
}
?>