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