-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathindex.php
executable file
·123 lines (119 loc) · 4.38 KB
/
index.php
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
function result($value, $result)
{
if ($result) {
return array('css' => 'success', 'note' => $value . ': OK');
}
return array('css' => 'danger', 'note' => $value . ': FAIL');
}
function apacheModules()
{
$results = array();
preg_match('/([\d]+\.[\d]+\.[\d]+)/', apache_get_version(), $version);
$results[0] = array('css' => 'danger', 'note' => 'Version: ' . $version[0]);
if (version_compare($version[0], '2.2') >= 0) {
$results[0] = array('css' => 'success', 'note' => 'Version: ' . $version[0]);
}
$requiredModules = array('mod_rewrite','mod_expires');
$apacheModules = apache_get_modules();
foreach ($requiredModules as $req) {
$results[] = result($req, in_array($req, $apacheModules));
}
return $results;
}
function phpExtensions()
{
$results = array();
preg_match('/([\d]+\.[\d]+\.[\d]+)/', phpversion(), $version);
$ver = $version[0];
$results[0] = array('css' => 'danger', 'note' => 'Version: ' . $ver);
if ((version_compare($ver, '5.6.5', '>=') && version_compare($ver, '7.0.0', '<')) || version_compare($ver, '7.0.2',
'==') || version_compare($ver, '7.0.4', '==') || version_compare($ver, '7.0.6', '>=')
) {
$results[0] = array('css' => 'success', 'note' => 'Version: ' . $ver);
}
$requiredExtensions = array(
'curl',
'gd',
'intl',
'mbstring',
'mcrypt',
'openssl',
'PDO',
'SimpleXML',
'soap',
'xml',
'xsl',
'zip',
'json',
'iconv',
'Zend OPcache',
'xdebug',
);
$phpExtensions = get_loaded_extensions();
foreach ($requiredExtensions as $req) {
$results[] = result($req, in_array($req, $phpExtensions));
}
return $results;
}
function phpOptionalExtensions()
{
$optionalExtensions = array(
'imagick',
);
$phpExtensions = get_loaded_extensions();
$results = array();
foreach ($optionalExtensions as $opt) {
$results[] = result($opt, in_array($opt, $phpExtensions));
}
return $results;
}
//apacheModules();
?>
<!DOCTYPE html>
<html>
<head>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css"
integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
</head>
<body>
<div class="container">
<h1>Magento 2 requirements check script</h1>
<div class="panel panel-default">
<div class="panel-heading">Apache</div>
<div class="panel-body">
<?php foreach (apacheModules() as $result): ?>
<div class="alert alert-<?php echo $result['css'] ?>" role="alert"><?php echo $result['note'] ?></div>
<?php endforeach; ?>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">PHP</div>
<div class="panel-body">
<div role="alert" class="alert alert-warning">Loaded php.ini file: <?php echo php_ini_loaded_file()?></div>
<?php foreach (phpExtensions() as $result): ?>
<div class="alert alert-<?php echo $result['css'] ?>" role="alert"><?php echo $result['note'] ?></div>
<?php endforeach; ?>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">Optional PHP Extension</div>
<div class="panel-body">
<?php foreach (phpOptionalExtensions() as $result): ?>
<div class="alert alert-<?php echo $result['css'] ?>" role="alert"><?php echo $result['note'] ?></div>
<?php endforeach; ?>
</div>
</div>
</div>
</body>
</html>