-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathselfcheck.php
80 lines (80 loc) · 1.67 KB
/
selfcheck.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
<?php
echo "Phpcraft Self Check\n";
if(version_compare(PHP_VERSION, "7.0", "<"))
{
die("Phpcraft requires PHP 7.0 or above.\n");
}
if(!extension_loaded("SPL"))
{
die("How is SPL not loaded?!\n");
}
$i = 0;
$i_limit = 2;
foreach([
"Basic" => [
"gmp" => false,
"json" => false,
"mbstring" => false,
"zlib" => false
],
'"Online mode"' => [
"openssl" => false,
"curl" => false,
"mcrypt" => "more performance"
]
] as $feature => $exts)
{
echo (++$i == $i_limit ? "└ " : "├ ").$feature." functionality ";
$ok = true;
$str = "";
$j = 0;
$j_limit = count($exts);
foreach($exts as $ext => $optional_for)
{
$str .= ($i == $i_limit ? " " : "│ ").(++$j == $j_limit ? "└" : "├")." ".$ext." ";
if($optional_for)
{
$str .= "(optional for ".$optional_for.") ";
}
if(extension_loaded($ext))
{
$str .= "✓\n";
}
else
{
$ok = false;
$nl = "\n".($i == $i_limit ? " " : "│ ").($j == $j_limit ? " " : "│")." ";
$str .= $nl;
if(defined("PHP_WINDOWS_VERSION_MAJOR"))
{
if(in_array($ext, [
"curl",
"gd",
"gmp",
"mbstring",
"sockets"
]))
{
$str .= "├ cone get php-$ext".$nl."└ If you don't have Cone, check the extensions section of your php.ini.\n";
}
else
{
$str .= "└ Check the extensions section of your php.ini.\n";
}
}
else if($ext == "mcrypt" && version_compare(PHP_VERSION, "7.2") >= 0)
{
$str .= "└ sudo apt-get -y install php-dev gcc make autoconf libc-dev pkg-config libmcrypt-dev php-pear && sudo pecl install mcrypt-1.0.1\n";
}
else
{
$str .= "└ sudo apt-get -y install php-$ext\n";
}
}
}
if($ok)
{
echo "✓";
}
echo "\n".$str;
}