commit | author | age
|
619c32
|
1 |
<?php |
TB |
2 |
|
eea11e
|
3 |
if (!class_exists('rcmail_install', false) || !is_object($RCI)) { |
619c32
|
4 |
die("Not allowed! Please open installer/index.php instead."); |
TB |
5 |
} |
|
6 |
|
|
7 |
?> |
b3f9df
|
8 |
<form action="index.php" method="get"> |
354978
|
9 |
<?php |
T |
10 |
|
59c216
|
11 |
$required_php_exts = array( |
A |
12 |
'PCRE' => 'pcre', |
|
13 |
'DOM' => 'dom', |
|
14 |
'Session' => 'session', |
|
15 |
'XML' => 'xml', |
398bff
|
16 |
'JSON' => 'json', |
AM |
17 |
'PDO' => 'PDO', |
0f9687
|
18 |
); |
6557d3
|
19 |
|
59c216
|
20 |
$optional_php_exts = array( |
A |
21 |
'FileInfo' => 'fileinfo', |
|
22 |
'Libiconv' => 'iconv', |
|
23 |
'Multibyte' => 'mbstring', |
|
24 |
'OpenSSL' => 'openssl', |
|
25 |
'Mcrypt' => 'mcrypt', |
e99991
|
26 |
'Intl' => 'intl', |
2f88b1
|
27 |
'Exif' => 'exif', |
b6f89a
|
28 |
'LDAP' => 'ldap', |
59c216
|
29 |
); |
6557d3
|
30 |
|
59c216
|
31 |
$required_libs = array( |
a98a4f
|
32 |
'PEAR' => 'pear.php.net', |
TB |
33 |
'Auth_SASL' => 'pear.php.net', |
|
34 |
'Net_SMTP' => 'pear.php.net', |
|
35 |
'Net_IDNA2' => 'pear.php.net', |
|
36 |
'Mail_mime' => 'pear.php.net', |
b6f89a
|
37 |
); |
TB |
38 |
|
|
39 |
$optional_libs = array( |
|
40 |
'Net_LDAP3' => 'git.kolab.org', |
59c216
|
41 |
); |
11e670
|
42 |
|
59c216
|
43 |
$ini_checks = array( |
A |
44 |
'file_uploads' => 1, |
|
45 |
'session.auto_start' => 0, |
|
46 |
'mbstring.func_overload' => 0, |
|
47 |
'suhosin.session.encrypt' => 0, |
0b6d02
|
48 |
'magic_quotes_runtime' => 0, |
AM |
49 |
'magic_quotes_sybase' => 0, |
59c216
|
50 |
); |
A |
51 |
|
|
52 |
$optional_checks = array( |
2b21b9
|
53 |
// required for utils/modcss.inc, should we require this? |
AM |
54 |
'allow_url_fopen' => 1, |
7a7c25
|
55 |
'date.timezone' => '-VALID-', |
a5b79b
|
56 |
'register_globals' => 0, // #1489157 |
59c216
|
57 |
); |
6557d3
|
58 |
|
T |
59 |
$source_urls = array( |
e99991
|
60 |
'Sockets' => 'http://www.php.net/manual/en/book.sockets.php', |
A |
61 |
'Session' => 'http://www.php.net/manual/en/book.session.php', |
|
62 |
'PCRE' => 'http://www.php.net/manual/en/book.pcre.php', |
|
63 |
'FileInfo' => 'http://www.php.net/manual/en/book.fileinfo.php', |
|
64 |
'Libiconv' => 'http://www.php.net/manual/en/book.iconv.php', |
d62c31
|
65 |
'Multibyte' => 'http://www.php.net/manual/en/book.mbstring.php', |
e99991
|
66 |
'Mcrypt' => 'http://www.php.net/manual/en/book.mcrypt.php', |
A |
67 |
'OpenSSL' => 'http://www.php.net/manual/en/book.openssl.php', |
|
68 |
'JSON' => 'http://www.php.net/manual/en/book.json.php', |
|
69 |
'DOM' => 'http://www.php.net/manual/en/book.dom.php', |
|
70 |
'Intl' => 'http://www.php.net/manual/en/book.intl.php', |
2f88b1
|
71 |
'Exif' => 'http://www.php.net/manual/en/book.exif.php', |
c23457
|
72 |
'oci8' => 'http://www.php.net/manual/en/book.oci8.php', |
398bff
|
73 |
'PDO' => 'http://www.php.net/manual/en/book.pdo.php', |
b6f89a
|
74 |
'LDAP' => 'http://www.php.net/manual/en/book.ldap.php', |
398c9d
|
75 |
'pdo_mysql' => 'http://www.php.net/manual/en/ref.pdo-mysql.php', |
AM |
76 |
'pdo_pgsql' => 'http://www.php.net/manual/en/ref.pdo-pgsql.php', |
|
77 |
'pdo_sqlite' => 'http://www.php.net/manual/en/ref.pdo-sqlite.php', |
|
78 |
'pdo_sqlite2' => 'http://www.php.net/manual/en/ref.pdo-sqlite.php', |
|
79 |
'pdo_sqlsrv' => 'http://www.php.net/manual/en/ref.pdo-sqlsrv.php', |
|
80 |
'pdo_dblib' => 'http://www.php.net/manual/en/ref.pdo-dblib.php', |
e99991
|
81 |
'PEAR' => 'http://pear.php.net', |
A |
82 |
'Net_SMTP' => 'http://pear.php.net/package/Net_SMTP', |
5d725e
|
83 |
'Mail_mime' => 'http://pear.php.net/package/Mail_mime', |
2f88b1
|
84 |
'Net_IDNA2' => 'http://pear.php.net/package/Net_IDNA2', |
618823
|
85 |
'Net_LDAP3' => 'https://git.kolab.org/diffusion/PNL', |
6557d3
|
86 |
); |
354978
|
87 |
|
1c4e5d
|
88 |
echo '<input type="hidden" name="_step" value="' . ($RCI->configured ? 3 : 2) . '" />'; |
354978
|
89 |
?> |
6557d3
|
90 |
|
T |
91 |
<h3>Checking PHP version</h3> |
|
92 |
<?php |
|
93 |
|
8cc567
|
94 |
define('MIN_PHP_VERSION', '5.3.7'); |
70430e
|
95 |
if (version_compare(PHP_VERSION, MIN_PHP_VERSION, '>=')) { |
0596f7
|
96 |
if (PHP_MAJOR_VERSION != 5) { |
AM |
97 |
$RCI->fail('Version', 'PHP5 is required, ' . PHP_VERSION . ' detected'); |
|
98 |
} |
|
99 |
else { |
|
100 |
$RCI->pass('Version', 'PHP ' . PHP_VERSION . ' detected'); |
|
101 |
} |
|
102 |
} |
|
103 |
else { |
70430e
|
104 |
$RCI->fail('Version', 'PHP Version ' . MIN_PHP_VERSION . ' or greater is required ' . PHP_VERSION . ' detected'); |
6557d3
|
105 |
} |
T |
106 |
?> |
|
107 |
|
|
108 |
<h3>Checking PHP extensions</h3> |
e019f2
|
109 |
<p class="hint">The following modules/extensions are <em>required</em> to run Roundcube:</p> |
6557d3
|
110 |
<?php |
3e2bc6
|
111 |
|
A |
112 |
// get extensions location |
|
113 |
$ext_dir = ini_get('extension_dir'); |
|
114 |
|
6557d3
|
115 |
$prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : ''; |
073543
|
116 |
foreach ($required_php_exts as $name => $ext) { |
6557d3
|
117 |
if (extension_loaded($ext)) { |
T |
118 |
$RCI->pass($name); |
7635d2
|
119 |
} else { |
3e2bc6
|
120 |
$_ext = $ext_dir . '/' . $prefix . $ext . '.' . PHP_SHLIB_SUFFIX; |
A |
121 |
$msg = @is_readable($_ext) ? 'Could be loaded. Please add in php.ini' : ''; |
6557d3
|
122 |
$RCI->fail($name, $msg, $source_urls[$name]); |
T |
123 |
} |
|
124 |
echo '<br />'; |
|
125 |
} |
|
126 |
|
|
127 |
?> |
|
128 |
|
11e670
|
129 |
<p class="hint">The next couple of extensions are <em>optional</em> and recommended to get the best performance:</p> |
6557d3
|
130 |
<?php |
T |
131 |
|
073543
|
132 |
foreach ($optional_php_exts as $name => $ext) { |
6557d3
|
133 |
if (extension_loaded($ext)) { |
T |
134 |
$RCI->pass($name); |
|
135 |
} |
|
136 |
else { |
3e2bc6
|
137 |
$_ext = $ext_dir . '/' . $prefix . $ext . '.' . PHP_SHLIB_SUFFIX; |
A |
138 |
$msg = @is_readable($_ext) ? 'Could be loaded. Please add in php.ini' : ''; |
6557d3
|
139 |
$RCI->na($name, $msg, $source_urls[$name]); |
T |
140 |
} |
|
141 |
echo '<br />'; |
|
142 |
} |
|
143 |
|
|
144 |
?> |
|
145 |
|
|
146 |
|
|
147 |
<h3>Checking available databases</h3> |
|
148 |
<p class="hint">Check which of the supported extensions are installed. At least one of them is required.</p> |
|
149 |
|
|
150 |
<?php |
|
151 |
|
|
152 |
$prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : ''; |
398bff
|
153 |
foreach ($RCI->supported_dbs as $database => $ext) { |
6557d3
|
154 |
if (extension_loaded($ext)) { |
8cc567
|
155 |
$RCI->pass($database); |
AM |
156 |
$found_db_driver = true; |
6557d3
|
157 |
} |
T |
158 |
else { |
3e2bc6
|
159 |
$_ext = $ext_dir . '/' . $prefix . $ext . '.' . PHP_SHLIB_SUFFIX; |
398bff
|
160 |
$msg = @is_readable($_ext) ? 'Could be loaded. Please add in php.ini' : ''; |
AM |
161 |
$RCI->na($database, $msg, $source_urls[$ext]); |
6557d3
|
162 |
} |
T |
163 |
echo '<br />'; |
|
164 |
} |
e7fa2c
|
165 |
if (empty($found_db_driver)) { |
AM |
166 |
$RCI->failures++; |
|
167 |
} |
6557d3
|
168 |
|
T |
169 |
?> |
|
170 |
|
|
171 |
|
|
172 |
<h3>Check for required 3rd party libs</h3> |
|
173 |
<p class="hint">This also checks if the include path is set correctly.</p> |
|
174 |
|
|
175 |
<?php |
|
176 |
|
a98a4f
|
177 |
foreach ($required_libs as $classname => $vendor) { |
6557d3
|
178 |
if (class_exists($classname)) { |
T |
179 |
$RCI->pass($classname); |
|
180 |
} |
|
181 |
else { |
a98a4f
|
182 |
$RCI->fail($classname, "Failed to load class $classname from $vendor", $source_urls[$classname]); |
6557d3
|
183 |
} |
T |
184 |
echo "<br />"; |
|
185 |
} |
|
186 |
|
b6f89a
|
187 |
foreach ($optional_libs as $classname => $vendor) { |
TB |
188 |
if (class_exists($classname)) { |
|
189 |
$RCI->pass($classname); |
|
190 |
} |
|
191 |
else { |
|
192 |
$RCI->na($classname, "Recommended to install $classname from $vendor", $source_urls[$classname]); |
|
193 |
} |
|
194 |
echo "<br />"; |
|
195 |
} |
c5042d
|
196 |
|
T |
197 |
?> |
|
198 |
|
|
199 |
<h3>Checking php.ini/.htaccess settings</h3> |
e019f2
|
200 |
<p class="hint">The following settings are <em>required</em> to run Roundcube:</p> |
c5042d
|
201 |
|
T |
202 |
<?php |
|
203 |
|
|
204 |
foreach ($ini_checks as $var => $val) { |
|
205 |
$status = ini_get($var); |
f7df6c
|
206 |
if ($val === '-NOTEMPTY-') { |
T |
207 |
if (empty($status)) { |
c22a52
|
208 |
$RCI->fail($var, "empty value detected"); |
7a7c25
|
209 |
} |
AM |
210 |
else { |
f7df6c
|
211 |
$RCI->pass($var); |
T |
212 |
} |
|
213 |
} |
7a7c25
|
214 |
else if (filter_var($status, FILTER_VALIDATE_BOOLEAN) == $val) { |
c5042d
|
215 |
$RCI->pass($var); |
7a7c25
|
216 |
} |
AM |
217 |
else { |
c5042d
|
218 |
$RCI->fail($var, "is '$status', should be '$val'"); |
T |
219 |
} |
|
220 |
echo '<br />'; |
|
221 |
} |
|
222 |
?> |
|
223 |
|
11e670
|
224 |
<p class="hint">The following settings are <em>optional</em> and recommended:</p> |
A |
225 |
|
|
226 |
<?php |
|
227 |
|
|
228 |
foreach ($optional_checks as $var => $val) { |
|
229 |
$status = ini_get($var); |
|
230 |
if ($val === '-NOTEMPTY-') { |
|
231 |
if (empty($status)) { |
|
232 |
$RCI->optfail($var, "Could be set"); |
|
233 |
} else { |
|
234 |
$RCI->pass($var); |
|
235 |
} |
|
236 |
echo '<br />'; |
|
237 |
continue; |
|
238 |
} |
7a7c25
|
239 |
if ($val === '-VALID-') { |
AM |
240 |
if ($var == 'date.timezone') { |
|
241 |
try { |
|
242 |
$tz = new DateTimeZone($status); |
|
243 |
$RCI->pass($var); |
|
244 |
} |
|
245 |
catch (Exception $e) { |
|
246 |
$RCI->optfail($var, empty($status) ? "not set" : "invalid value detected: $status"); |
|
247 |
} |
|
248 |
} |
|
249 |
else { |
|
250 |
$RCI->pass($var); |
|
251 |
} |
|
252 |
} |
|
253 |
else if (filter_var($status, FILTER_VALIDATE_BOOLEAN) == $val) { |
11e670
|
254 |
$RCI->pass($var); |
7a7c25
|
255 |
} |
AM |
256 |
else { |
11e670
|
257 |
$RCI->optfail($var, "is '$status', could be '$val'"); |
A |
258 |
} |
|
259 |
echo '<br />'; |
|
260 |
} |
|
261 |
?> |
|
262 |
|
c5042d
|
263 |
<?php |
T |
264 |
|
019b5d
|
265 |
if ($RCI->failures) { |
e019f2
|
266 |
echo '<p class="warning">Sorry but your webserver does not meet the requirements for Roundcube!<br /> |
4a2765
|
267 |
Please install the missing modules or fix the php.ini settings according to the above check results.<br /> |
T |
268 |
Hint: only checks showing <span class="fail">NOT OK</span> need to be fixed.</p>'; |
019b5d
|
269 |
} |
6557d3
|
270 |
echo '<p><br /><input type="submit" value="NEXT" ' . ($RCI->failures ? 'disabled' : '') . ' /></p>'; |
T |
271 |
|
|
272 |
?> |
|
273 |
|
354978
|
274 |
</form> |