-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsys-test.php
74 lines (69 loc) · 1.89 KB
/
sys-test.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
<?php
date_default_timezone_set('Europe/Paris');
function formatBytes($size, $precision = 2)
{
$size = intval($size);
$base = log($size, 1024);
$suffixes = array('', 'K', 'M', 'G', 'T');
return round(pow(1024, $base - floor($base)), $precision) .' '. $suffixes[floor($base)];
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Sys test</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" media="screen" href="./css/main.css" />
</head>
<body lang="en">
<div id='content'>
<section>
<h2>PHP</h2>
<table border="1">
<tr><th>ini key</th><th>ini value</th><th>expected</th></tr>
<?php
$phpIniChecks = array(
'short_open_tag' => 'On',
'display_errors' => 'Off',
'upload_max_filesize' => '>=30M',
'memory_limit' => '>=256M',
'memory_limit,post_max_size,upload_max_filesize' => 'x>y>z',
);
foreach ($phpIniChecks as $iniKey => $expected) {
if (strpos($iniKey, ',')!==false) {
$keys = explode(',', $iniKey);
$inis = array();
foreach($keys as $key) {
$inis[] = ini_get($key);
}
$ini = implode(", ", $inis);
} else {
$ini = ini_get($iniKey);
}
echo "\n<tr><td>$iniKey</td><td>$ini</td><td>$expected</td></tr>";
}
?>
</table>
</section>
<section>
<h2>MySQL</h2>
<table border="1">
<tr><th>variable name</th><th>ini value</th><th>expected</th></tr>
<?php
require_once ('./inc/dbConnect.php');
$pv_result = mysql_query("show variables like 'max_allowed_packet'");
$sqlIniChecks = array(
'max_allowed_packet' => '>=50 MB'
);
while ($row = mysql_fetch_array($pv_result, MYSQL_ASSOC))
{
$expected = $sqlIniChecks[$row['Variable_name']];
echo "\n<tr><td>{$row['Variable_name']}</td><td>".formatBytes($row['Value'])."B</td><td>$expected</td></tr>";
}
?>
</table>
</section>
</div>
</body>
</html>