@ 2014-01-19T21:52:56Z <?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;
}
}
//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.008 0.008 19.43 7.1.10 0.006 0.006 18.00 7.1.7 0.000 0.007 17.24 7.1.6 0.009 0.015 19.32 7.1.5 0.010 0.013 16.82 7.1.0 0.003 0.077 22.44 7.0.20 0.007 0.000 16.66 7.0.14 0.007 0.073 22.10 7.0.10 0.007 0.040 20.25 7.0.9 0.013 0.033 20.05 7.0.8 0.000 0.043 20.06 7.0.7 0.007 0.040 20.04 7.0.6 0.003 0.043 20.01 7.0.5 0.007 0.037 20.38 7.0.4 0.007 0.030 20.05 7.0.3 0.007 0.030 20.13 7.0.2 0.003 0.037 20.04 7.0.1 0.000 0.047 20.05 7.0.0 0.007 0.037 20.04 5.6.25 0.010 0.033 20.81 5.6.24 0.003 0.043 20.81 5.6.23 0.000 0.037 20.72 5.6.22 0.007 0.040 20.64 5.6.21 0.003 0.040 20.70 5.6.20 0.003 0.043 21.12 5.6.19 0.007 0.033 21.07 5.6.18 0.007 0.037 21.19 5.6.17 0.007 0.033 20.98 5.6.16 0.007 0.037 21.18 5.6.15 0.007 0.043 21.19 5.6.14 0.007 0.037 21.06 5.6.13 0.003 0.087 20.97 5.6.12 0.007 0.087 21.18 5.6.11 0.007 0.080 21.00 5.6.10 0.003 0.057 21.14 5.6.9 0.010 0.083 20.98 5.6.8 0.003 0.077 20.45 5.6.7 0.010 0.080 20.50 5.6.6 0.017 0.067 20.44 5.6.5 0.003 0.037 20.46 5.6.4 0.010 0.077 20.36 5.6.3 0.003 0.077 20.54 5.6.2 0.003 0.057 20.48 5.6.1 0.003 0.037 20.36 5.6.0 0.007 0.080 20.47 5.5.38 0.003 0.047 20.40 5.5.37 0.007 0.037 20.40 5.5.36 0.010 0.037 20.44 5.5.35 0.010 0.037 20.50 5.5.34 0.003 0.033 20.91 5.5.33 0.007 0.030 20.95 5.5.32 0.007 0.040 20.96 5.5.31 0.013 0.027 20.83 5.5.30 0.010 0.030 20.69 5.5.29 0.017 0.073 20.77 5.5.28 0.003 0.077 20.94 5.5.27 0.013 0.050 20.77 5.5.26 0.010 0.077 20.93 5.5.25 0.013 0.070 20.76 5.5.24 0.003 0.057 20.23 5.5.23 0.003 0.087 20.20 5.5.22 0.010 0.030 20.32 5.5.21 0.013 0.067 20.25 5.5.20 0.000 0.080 20.27 5.5.19 0.010 0.037 20.22 5.5.18 0.010 0.063 20.29 5.5.16 0.010 0.067 20.18 5.5.15 0.010 0.040 20.13 5.5.14 0.010 0.077 20.29 5.5.13 0.003 0.073 20.12 5.5.12 0.010 0.080 20.25 5.5.11 0.003 0.083 20.28 5.5.10 0.000 0.043 20.15 5.5.9 0.010 0.077 20.09 5.5.8 0.007 0.060 20.20 5.5.7 0.013 0.063 20.02 5.5.6 0.003 0.050 20.08 5.5.5 0.003 0.070 20.09 5.5.4 0.007 0.073 19.98 5.5.3 0.007 0.070 19.97 5.5.2 0.010 0.070 20.18 5.5.1 0.003 0.050 20.12 5.5.0 0.007 0.087 20.09 5.4.45 0.000 0.043 19.29 5.4.44 0.000 0.077 19.19 5.4.43 0.007 0.063 19.21 5.4.42 0.007 0.093 19.53 5.4.41 0.013 0.043 19.38 5.4.40 0.007 0.060 19.08 5.4.39 0.003 0.070 19.07 5.4.38 0.007 0.067 19.12 5.4.37 0.007 0.033 19.05 5.4.36 0.013 0.070 19.13 5.4.35 0.003 0.067 19.04 5.4.34 0.007 0.067 19.04 5.4.32 0.000 0.087 19.21 5.4.31 0.010 0.067 19.05 5.4.30 0.003 0.057 19.18 5.4.29 0.007 0.043 19.02 5.4.28 0.013 0.077 19.13 5.4.27 0.010 0.070 19.16 5.4.26 0.007 0.070 19.03 5.4.25 0.003 0.083 18.87 5.4.24 0.007 0.073 18.84 5.4.23 0.000 0.097 19.09 5.4.22 0.000 0.053 18.90 5.4.21 0.003 0.070 19.10 5.4.20 0.003 0.037 19.04 5.4.19 0.003 0.060 19.20 5.4.18 0.003 0.037 19.03 5.4.17 0.020 0.053 19.01 5.4.16 0.010 0.050 19.02 5.4.15 0.003 0.037 19.07 5.4.14 0.007 0.083 16.20 5.4.13 0.003 0.033 16.44 5.4.12 0.003 0.067 16.31 5.4.11 0.007 0.070 16.47 5.4.10 0.010 0.050 16.51 5.4.9 0.010 0.030 16.54 5.4.8 0.007 0.080 16.51 5.4.7 0.003 0.033 16.43 5.4.6 0.003 0.077 16.42 5.4.5 0.007 0.070 16.37 5.4.4 0.007 0.070 16.50 5.4.3 0.010 0.027 16.46 5.4.2 0.007 0.073 16.45 5.4.1 0.010 0.073 16.45 5.4.0 0.003 0.067 15.89 5.3.29 0.010 0.080 14.86 5.3.28 0.003 0.060 14.66 5.3.27 0.010 0.030 14.59 5.3.26 0.007 0.077 14.75 5.3.25 0.000 0.050 14.60 5.3.24 0.010 0.073 14.58 5.3.23 0.010 0.073 14.77 5.3.22 0.003 0.080 14.74 5.3.21 0.010 0.067 14.55 5.3.20 0.003 0.073 14.71 5.3.19 0.007 0.050 14.55 5.3.18 0.003 0.077 14.76 5.3.17 0.000 0.087 14.61 5.3.16 0.007 0.043 14.64 5.3.15 0.003 0.037 14.54 5.3.14 0.010 0.063 14.66 5.3.13 0.007 0.073 14.74 5.3.12 0.010 0.030 14.59 5.3.11 0.013 0.047 14.55 5.3.10 0.007 0.047 14.10 5.3.9 0.007 0.073 14.21 5.3.8 0.010 0.057 14.21 5.3.7 0.007 0.077 14.06 5.3.6 0.000 0.080 14.16 5.3.5 0.003 0.063 14.07 5.3.4 0.017 0.043 13.98 5.3.3 0.003 0.077 14.08 5.3.2 0.010 0.070 13.74 5.3.1 0.003 0.043 13.75 5.3.0 0.007 0.040 13.71
preferences:dark mode live preview
32.63 ms | 400 KiB | 5 Q