-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.php
266 lines (247 loc) · 5.79 KB
/
install.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
<html>
<head>
<style>
body {
font-family:Helvetica, Arial, sans-serif;
background:#ccc;
}
.good {
border:1px solid green;
background:#fff;
padding:10px;
margin:10px;
color:green;
font-size:12px;
}
.error {
border:1px solid red;
background:red;
color:#fff;
margin:10px;
padding:10px;
font-size:12px;
}
.notice {
border:1px solid #ccc;
background:#fff;
color:#ccc;
margin:10px;
padding:10px;
font-size:12px;
}
hr {
border-bottom:none;
}
h1 {
font-size:18px;
}
h2, h3 {
font-size:14px;
padding:0;
margin:0 0 6px 0;
}
h3, strong {
font-size:12px;
}
ul {
padding:0 0 0 12px;
margin:0 0 12px 12px;
}
li {
font-size:11px;
}
</style>
</head>
<body>
<h1>Sourcemap Install Checker</h1>
<?php
define('PATH', dirname(__FILE__));
require_once PATH . "/application/config/general.php";
?>
<h2>Checking PHP Version</h2>
<?php phpversioncheck(); ?>
<h2>Checking PHP INI</h2>
<?php checkini(); ?>
<h2>Checking PHP Extensions</h2>
<?php checkextensions(); ?>
<h2>Checking Database Support</h2>
<?php checkdatabasesupport(); ?>
<h2>Checking Apache Modules</h2>
<?php modrewritecheck(); ?>
<h2>Checking Sourcemap Configuration</h2>
<?php readwritecheck($config, $min_cachePath, $db); ?>
<?php
function checkdatabasesupport() {
$extensions = get_loaded_extensions();
if(in_array("mysql", $extensions)) {
print "<div class='good'>";
print "Mysql is enabled.";
print "</div>";
}
else {
print "<div class='error'>";
print "Mysql is not currently enabled.";
print "</div>";
}
if(in_array("pgsql", $extensions)) {
print "<div class='good'>";
print "Postgres is enabled.";
print "</div>";
}
else {
print "<div class='error'>";
print "Postgres is not currently enabled.";
print "</div>";
}
}
function checkextensions() {
$extensions = get_loaded_extensions();
if(in_array("pcre", $extensions)) {
print "<div class='good'>";
print "Pcre is enabled.";
print "</div>";
}
else {
print "<div class='error'>";
print "Pcre is not currently enabled.";
print "</div>";
}
if(in_array("xml", $extensions)) {
print "<div class='good'>";
print "Xml is enabled.";
print "</div>";
}
else {
print "<div class='error'>";
print "Xml is not currently enabled.";
print "</div>";
}
if(in_array("zlib", $extensions)) {
print "<div class='good'>";
print "Zglib is enabled.";
print "</div>";
}
else {
print "<div class='error'>";
print "Zglib is not currently enabled.";
print "</div>";
}
if(in_array("mbstring", $extensions)) {
print "<div class='good'>";
print "Mbstring is enabled.";
print "</div>";
}
else {
print "<div class='error'>";
print "Mbstring is not currently enabled.";
print "</div>";
}
if(in_array("curl", $extensions)) {
print "<div class='good'>";
print "Curl is enabled.";
print "</div>";
}
else {
print "<div class='notice'>";
print "Curl is not currently enabled.";
print "</div>";
}
}
function checkini() {
if(ini_get('short_open_tag') == "1") {
print "<div class='good'>";
print "Short tags are on.";
print "</div>";
}
else {
print "<div class='error'>";
print "Short tags are off in the php.ini";
print "</div>";
}
if(ini_get('max_execution_time') >= 60) {
print "<div class='good'>";
print "Execution time is great than 60 seconds.";
print "</div>";
}
else {
print "<div class='notice'>";
print "Execution time is less than 60 seconds.";
print "</div>";
}
if(ini_get('max_input_time') >= 120) {
print "<div class='good'>";
print "Max input time is greater than 120 seconds.";
print "</div>";
}
else {
print "<div class='notice'>";
print "Max input time is less than 120 seconds.";
print "</div>";
}
if(ini_get('memory_limit') >= 128) {
print "<div class='good'>";
print "Memory limit is greater than 128mb.";
print "</div>";
}
else {
print "<div class='error'>";
print "Memory limit is less than 128mb.";
print "</div>";
}
}
function modrewritecheck() {
$modules = apache_get_modules();
if(in_array("mod_rewrite", $modules)) {
print "<div class='good'>";
print "ModRewrite is enabled.";
print "</div>";
}
else {
print "<div class='notice'>";
print "ModRewrite is not currently enabled.";
print "</div>";
}
}
function phpversioncheck() {
if(!(phpversion() >= 5.2)) {
print "<div class='error'>";
print "PHP Version not up to date (" . phpversion() . "). You should update to the latest version of PHP.";
print "</div>";
} else {
print "<div class='good'>";
print "PHP version up to date (" . phpversion() . ")";
print "</div>";
}
}
function readwritecheck($config, $min, $db) {
if(!isset($config['cache_path']) || $config['cache_path'] == "") {
print "<div class='error'>";
print "You have not yet entered a value for the cache_path in application/config/general.php.";
print "</div>";
} else{
print "<div class='good'>";
print "Your cache_path is set.";
print "</div>";
}
if(!isset($config['log_path']) || $config['log_path'] == "") {
print "<div class='error'>";
print "You have not yet entered a value for the log_path in application/config/general.php";
print "</div>";
} else {
print "<div class='good'>";
print "Your log_path is set.";
print "</div>";
}
if(is_writable($config['cache_path'])) {
print "<div class='good'>";
print "Your cache_path is writable.";
print "</div>";
} else {
print "<div class='error'>";
print "Your cache_path is not writable.";
print "</div>";
}
}
?>
</body>
</html>