@ 2014-01-19T21:51:31Z <?php
class CheckPlateform
{
//All values if not explicit
//PHP version
const MIN_ALLOWED_PHP_VERSION = "5.0.0";
const MAX_ALLOWED_PHP_VERSION = null;//excluded
//Memory
const MIN_ALLOWED_MEMORY_CLI = 512;//In M
const MAX_ALLOWED_MEMORY_CLI = null;//In M
const MIN_ALLOWED_MEMORY_WEB = 128;//In M
const MAX_ALLOWED_MEMORY_WEB = null;//In M
//Execution time
const MIN_ALLOWED_EXECUTION_TIME_CLI = 30;//in s
const MAX_ALLOWED_EXECUTION_TIME_CLI = null;//in s
const MIN_ALLOWED_EXECUTION_TIME_WEB = 30;//in s
const MAX_ALLOWED_EXECUTION_TIME_WEB = null;//in s
//Internet access
const CHECK_INTERNET_ACCESS = true;//or false
//MySql
const MYSQL_HOST = 'localhost';//or null
const MIN_ALLOWED_MYSQL_VERSION = "5.5.0";
const MAX_ALLOWED_MYSQL_VERSION = null;//excluded
//List of allowed handlers
protected $expectedApi = array(
'cli',
'apache2handler'
);
//List of necessary Apache modules
protected $expectedApacheModules = array(
'mod_rewrite'
);
//List of allowed operating systems
protected $expectedOS = array(
'windows',
'linux'
);
//List of allowed architectures
protected $expectedArchitecture = array(
'amd64',
'x86_64'
);
//List of necessary PHP extensions
protected $expectedExtensions = array(//Extension name
'json',
'SPL',
'PDO',
'SimpleXML',
'curl',
'xsl'
);
//List of necessary PHP classes
protected $expectedClasses = array(//Class name
'Silex\Application',
'Monolog\Logger',
'Symfony\Component\Console\Application',
'Symfony\Component\Form\Form',
'Symfony\Component\Security\Core\SecurityContext',
'Symfony\Component\Translation\Translator',
'Symfony\Component\Validator\Validator',
'Swift_Mailer',
'Knp\Snappy\Pdf',
'Doctrine\ORM\EntityManager',
'Carbon\Carbon'
);
//List of necessary files with access rights
protected $expectedFileFolders = array(//Folder relative path form project root
'vendor/h4cc/wkhtmltopdf-amd64/bin/' => 'R',
'var/log' => 'RW',
'var' => 'RW'
);
/*
* DO NOT EDIT BELOW
*/
const METHOD_PREFIX = 'assert';
private $lineBreak;
private $apiSuffix;
public function __construct()
{
$this->lineBreak = ('cli' == php_sapi_name() ? "\n" : "<br/>");
$this->apiSuffix = ('cli' == php_sapi_name() ? "_CLI" : "_WEB");
}
public function execute()
{
//Loop through all check methods by introspection
$methods = get_class_methods(__CLASS__);
$finalReturn = true;
foreach ($methods as $method) {
if (self::METHOD_PREFIX == substr($method, 0, strlen(self::METHOD_PREFIX))) {
$return = $this->$method();
$finalReturn = $finalReturn && $return;
echo str_pad($method, 50, '.') . ($return ? 'OK' : 'KO <<<') . $this->lineBreak;
}
}
return $finalReturn;
}
protected function assertApi()
{
$api = php_sapi_name();
foreach ($this->expectedApi as $expectedApi) {
if (0 == strcasecmp($api, $expectedApi)) {
return true;
}
}
echo 'Current API : ' . $api . $this->lineBreak;
return false;
}
protected function assertOS()
{
$os = php_uname("s");
foreach ($this->expectedOS as $expectedOS) {
if ( false !== stripos($os, $expectedOS)) {
return true;
}
}
echo 'Current OS : ' . $os . $this->lineBreak;
return false;
}
protected function assertArchitecture()
{
$archi = php_uname("m");
foreach ($this->expectedArchitecture as $expectedArchitecture) {
if (0 == strcasecmp($archi, $expectedArchitecture)) {
return true;
}
}
echo 'Current Architecture : ' . $archi . $this->lineBreak;
return false;
}
protected function assertPhpVersion()
{
$return = true;
if (!is_null(self::MIN_ALLOWED_PHP_VERSION)) {
$return = version_compare(PHP_VERSION, self::MIN_ALLOWED_PHP_VERSION, '>=');
}
if (!is_null(self::MAX_ALLOWED_PHP_VERSION)) {
$return = $return && version_compare(PHP_VERSION, self::MAX_ALLOWED_PHP_VERSION, '<');
}
if(!$return) {
echo 'Current PHP version : ' . phpversion() . $this->lineBreak;
}
return $return;
}
protected function assertMemory()
{
$mem = intval(ini_get('memory_limit'));
$min = constant('self::MIN_ALLOWED_MEMORY' . $this->apiSuffix);
$max = constant('self::MAX_ALLOWED_MEMORY' . $this->apiSuffix);
$return = true;
if (!is_null($min)) {
$return = $mem >= $min;
}
if (!is_null($max)) {
$return = $return && ($mem <= $max);
}
if(!$return) {
echo 'Current memory : ' . $mem . $this->lineBreak;
}
return $return;
}
protected function assertExecutionTime()
{
$time = ini_get('max_execution_time');
$time = (0 != $time) ? $time : PHP_INT_MAX;
$min = constant('self::MIN_ALLOWED_EXECUTION_TIME' . $this->apiSuffix);
$max = constant('self::MAX_ALLOWED_EXECUTION_TIME' . $this->apiSuffix);
$return = true;
if (!is_null($min)) {
$return = $time >= $max;
}
if (!is_null($max)) {
$return = $time && ($mem <= $max);
}
if(!$return) {
echo 'Current execution time : ' . $time . $this->lineBreak;
}
return $return;
}
protected function assertApacheModules()
{
if (!function_exists('apache_get_modules')) {//By-pass
return true;
}
$modules = apache_get_modules();
foreach ($this->expectedApacheModules as $expectedApacheModule) {
if (!in_array($expectedApacheModule, $modules)) {
echo 'Missing module : ' . $expectedApacheModule . $this->lineBreak;
return false;
}
}
return true;
}
protected function assertExtensions()
{
$extensions = get_loaded_extensions();
foreach ($this->expectedExtensions as $expectedExtension) {
if (!in_array($expectedExtension, $extensions)) {
echo 'Missing extension : ' . $expectedExtension . $this->lineBreak;
return false;
}
}
return true;
}
protected function assertInternetAccess()
{
if (!self::CHECK_INTERNET_ACCESS) {
return true;
}
$connected = @fsockopen("www.free.fr", 80);
if ($connected){
fclose($connected);
return true;
}
return false;
}
}
//Launch check
return ((new CheckPlateform())->execute() ? 0 : -1);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 7.2.0 0.006 0.009 19.61 7.1.10 0.006 0.006 18.54 7.1.7 0.000 0.010 17.29 7.1.6 0.006 0.006 17.57 7.1.5 0.022 0.008 17.37 7.1.0 0.000 0.037 22.65 7.0.20 0.004 0.011 16.84 7.0.14 0.007 0.073 22.36 7.0.10 0.050 0.073 20.47 7.0.9 0.053 0.083 20.27 7.0.8 0.047 0.083 20.38 7.0.7 0.053 0.073 20.64 7.0.6 0.057 0.083 20.32 7.0.5 0.060 0.070 20.61 7.0.4 0.007 0.053 20.30 7.0.3 0.000 0.067 20.55 7.0.2 0.017 0.060 20.48 7.0.1 0.017 0.040 20.41 7.0.0 0.010 0.080 20.55 5.6.28 0.013 0.067 21.41 5.6.25 0.013 0.077 20.96 5.6.24 0.007 0.087 21.05 5.6.23 0.007 0.083 21.04 5.6.22 0.003 0.087 20.93 5.6.21 0.010 0.080 21.09 5.6.20 0.007 0.083 21.54 5.6.19 0.010 0.077 21.29 5.6.18 0.007 0.083 21.50 5.6.17 0.007 0.057 21.27 5.6.16 0.007 0.083 21.51 5.6.15 0.007 0.090 21.47 5.6.14 0.003 0.087 21.46 5.6.13 0.003 0.057 21.50 5.6.12 0.007 0.083 21.46 5.6.11 0.003 0.093 21.49 5.6.10 0.013 0.050 21.45 5.6.9 0.010 0.077 21.44 5.6.8 0.003 0.043 20.98 5.6.7 0.013 0.070 20.82 5.6.6 0.013 0.073 20.78 5.6.5 0.003 0.080 20.76 5.6.4 0.003 0.087 20.82 5.6.3 0.000 0.087 20.66 5.6.2 0.007 0.080 20.94 5.6.1 0.007 0.083 20.86 5.6.0 0.003 0.080 20.84 5.5.38 0.003 0.073 20.80 5.5.37 0.013 0.070 20.74 5.5.36 0.013 0.043 20.74 5.5.35 0.007 0.057 20.82 5.5.34 0.010 0.083 21.05 5.5.33 0.007 0.080 21.23 5.5.32 0.010 0.077 21.27 5.5.31 0.007 0.080 21.23 5.5.30 0.013 0.070 21.39 5.5.29 0.013 0.077 21.34 5.5.28 0.013 0.050 21.33 5.5.27 0.010 0.080 21.13 5.5.26 0.010 0.073 21.02 5.5.25 0.003 0.090 21.14 5.5.24 0.003 0.043 20.57 5.5.23 0.003 0.080 20.70 5.5.22 0.007 0.080 20.70 5.5.21 0.010 0.073 20.75 5.5.20 0.007 0.073 20.73 5.5.19 0.017 0.080 20.59 5.5.18 0.003 0.083 20.69 5.5.16 0.007 0.080 20.66 5.5.15 0.017 0.073 20.73 5.5.14 0.013 0.070 20.44 5.5.13 0.013 0.073 20.69 5.5.12 0.017 0.073 20.59 5.5.11 0.003 0.070 20.68 5.5.10 0.010 0.077 20.31 5.5.9 0.010 0.073 20.62 5.5.8 0.007 0.070 20.47 5.5.7 0.007 0.043 20.46 5.5.6 0.010 0.073 20.46 5.5.5 0.013 0.063 20.46 5.5.4 0.013 0.070 20.30 5.5.3 0.017 0.067 20.45 5.5.2 0.013 0.070 20.30 5.5.1 0.010 0.073 20.35 5.5.0 0.000 0.087 20.50 5.4.45 0.007 0.080 19.76 5.4.44 0.010 0.077 19.61 5.4.43 0.010 0.073 19.72 5.4.42 0.010 0.047 19.71 5.4.41 0.010 0.077 19.51 5.4.40 0.007 0.077 19.50 5.4.39 0.003 0.083 19.39 5.4.38 0.000 0.063 19.32 5.4.37 0.013 0.070 19.39 5.4.36 0.013 0.057 19.36 5.4.35 0.003 0.083 19.48 5.4.34 0.010 0.063 19.48 5.4.32 0.003 0.083 19.48 5.4.31 0.017 0.070 19.31 5.4.30 0.017 0.057 19.31 5.4.29 0.007 0.080 19.61 5.4.28 0.003 0.080 19.39 5.4.27 0.003 0.083 19.38 5.4.26 0.003 0.070 19.35 5.4.25 0.010 0.063 19.48 5.4.24 0.003 0.083 19.50 5.4.23 0.010 0.070 19.38 5.4.22 0.000 0.057 19.35 5.4.21 0.017 0.070 19.63 5.4.20 0.007 0.077 19.38 5.4.19 0.010 0.077 19.29 5.4.18 0.013 0.070 19.48 5.4.17 0.007 0.073 19.48 5.4.16 0.003 0.080 19.56 5.4.15 0.010 0.080 19.33 5.4.14 0.010 0.063 16.90 5.4.13 0.013 0.067 16.79 5.4.12 0.007 0.070 16.89 5.4.11 0.000 0.080 16.86 5.4.10 0.007 0.063 16.83 5.4.9 0.017 0.063 16.70 5.4.8 0.007 0.070 16.76 5.4.7 0.017 0.060 16.77 5.4.6 0.007 0.070 16.66 5.4.5 0.010 0.057 16.80 5.4.4 0.013 0.067 16.78 5.4.3 0.013 0.070 16.84 5.4.2 0.013 0.063 16.79 5.4.1 0.003 0.070 16.65 5.4.0 0.007 0.070 16.25 5.3.29 0.003 0.077 14.85 5.3.28 0.013 0.067 14.63 5.3.27 0.000 0.047 14.80 5.3.26 0.007 0.047 14.59 5.3.25 0.007 0.080 14.77 5.3.24 0.010 0.073 14.74 5.3.23 0.007 0.077 14.67 5.3.22 0.013 0.037 14.62 5.3.21 0.007 0.070 14.69 5.3.20 0.020 0.063 14.56 5.3.19 0.010 0.073 14.55 5.3.18 0.007 0.047 14.75 5.3.17 0.010 0.040 14.75 5.3.16 0.010 0.067 14.68 5.3.15 0.010 0.073 14.76 5.3.14 0.013 0.063 14.62 5.3.13 0.003 0.067 14.71 5.3.12 0.003 0.077 14.57 5.3.11 0.007 0.073 14.54 5.3.10 0.013 0.067 14.09 5.3.9 0.003 0.060 14.01 5.3.8 0.007 0.073 14.09 5.3.7 0.007 0.070 14.14 5.3.6 0.003 0.067 14.00 5.3.5 0.003 0.080 13.95 5.3.4 0.003 0.067 14.13 5.3.3 0.000 0.073 13.89 5.3.2 0.013 0.067 13.87 5.3.1 0.010 0.067 13.79 5.3.0 0.010 0.070 13.82
preferences:dark mode live preview
31.72 ms | 401 KiB | 5 Q