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