source: subversion/trunk/roundcubemail/installer/check.php @ 3429

Last change on this file since 3429 was 3429, checked in by alec, 3 years ago
  • Fix bugs on unexpected IMAP connection close (#1486190, #1486270)
  • Iloha's imap.inc rewritten into rcube_imap_generic class
  • rcube_imap code re-formatting
File size: 5.9 KB
Line 
1<form action="index.php" method="get">
2<?php
3
4$required_php_exts = array(
5    'PCRE'      => 'pcre',
6    'DOM'       => 'dom',
7    'Session'   => 'session',
8    'XML'       => 'xml',
9    'JSON'      => 'json'
10);
11
12$optional_php_exts = array(
13    'FileInfo'  => 'fileinfo',
14    'Libiconv'  => 'iconv',
15    'Multibyte' => 'mbstring',
16    'OpenSSL'   => 'openssl',
17    'Mcrypt'    => 'mcrypt',
18);
19
20$required_libs = array(
21    'PEAR'      => 'PEAR.php',
22    'MDB2'      => 'MDB2.php',
23    'Net_SMTP'  => 'Net/SMTP.php',
24    'Mail_mime' => 'Mail/mime.php',
25);
26
27$supported_dbs = array(
28    'MySQL'         => 'mysql',
29    'MySQLi'        => 'mysqli',
30    'PostgreSQL'    => 'pgsql',
31    'SQLite (v2)'   => 'sqlite',
32);
33
34$ini_checks = array(
35    'file_uploads'                  => 1,
36    'session.auto_start'            => 0,
37    'zend.ze1_compatibility_mode'   => 0,
38    'mbstring.func_overload'        => 0,
39    'suhosin.session.encrypt'       => 0,
40);
41
42$optional_checks = array(
43    'date.timezone' => '-NOTEMPTY-',
44);
45
46$source_urls = array(
47    'Sockets' => 'http://www.php.net/manual/en/book.sockets.php',
48    'Session' => 'http://www.php.net/manual/en/book.session.php',
49    'PCRE' => 'http://www.php.net/manual/en/book.pcre.php',
50    'FileInfo' => 'http://www.php.net/manual/en/book.fileinfo.php',
51    'Libiconv' => 'http://www.php.net/manual/en/book.iconv.php',
52    'Multibyte' => 'http://www.php.net/manual/en/book.mbstring.php',
53    'Mcrypt' => 'http://www.php.net/manual/en/book.mcrypt.php',
54    'OpenSSL' => 'http://www.php.net/manual/en/book.openssl.php',
55    'JSON' => 'http://www.php.net/manual/en/book.json.php',
56    'DOM' => 'http://www.php.net/manual/en/book.dom.php',
57    'PEAR' => 'http://pear.php.net',
58    'MDB2' => 'http://pear.php.net/package/MDB2',
59    'Net_SMTP' => 'http://pear.php.net/package/Net_SMTP',
60    'Mail_mime' => 'http://pear.php.net/package/Mail_mime',
61);
62
63echo '<input type="hidden" name="_step" value="' . ($RCI->configured ? 3 : 2) . '" />';
64?>
65
66<h3>Checking PHP version</h3>
67<?php
68
69define('MIN_PHP_VERSION', '5.2.0');
70if (version_compare(PHP_VERSION, MIN_PHP_VERSION, '>=')) {
71    $RCI->pass('Version', 'PHP ' . PHP_VERSION . ' detected');
72} else {
73    $RCI->fail('Version', 'PHP Version ' . MIN_PHP_VERSION . ' or greater is required ' . PHP_VERSION . ' detected');
74}
75?>
76
77<h3>Checking PHP extensions</h3>
78<p class="hint">The following modules/extensions are <em>required</em> to run RoundCube:</p>
79<?php
80
81// get extensions location
82$ext_dir = ini_get('extension_dir');
83
84$prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : '';
85foreach ($required_php_exts AS $name => $ext) {
86    if (extension_loaded($ext)) {
87        $RCI->pass($name);
88    } else {
89        $_ext = $ext_dir . '/' . $prefix . $ext . '.' . PHP_SHLIB_SUFFIX;
90        $msg = @is_readable($_ext) ? 'Could be loaded. Please add in php.ini' : '';
91        $RCI->fail($name, $msg, $source_urls[$name]);
92    }
93    echo '<br />';
94}
95
96?>
97
98<p class="hint">The next couple of extensions are <em>optional</em> and recommended to get the best performance:</p>
99<?php
100
101foreach ($optional_php_exts AS $name => $ext) {
102    if (extension_loaded($ext)) {
103        $RCI->pass($name);
104    }
105    else {
106        $_ext = $ext_dir . '/' . $prefix . $ext . '.' . PHP_SHLIB_SUFFIX;
107        $msg = @is_readable($_ext) ? 'Could be loaded. Please add in php.ini' : '';
108        $RCI->na($name, $msg, $source_urls[$name]);
109    }
110    echo '<br />';
111}
112
113?>
114
115
116<h3>Checking available databases</h3>
117<p class="hint">Check which of the supported extensions are installed. At least one of them is required.</p>
118
119<?php
120
121$prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : '';
122foreach ($supported_dbs AS $database => $ext) {
123    if (extension_loaded($ext)) {
124        $RCI->pass($database);
125    }
126    else {
127        $_ext = $ext_dir . '/' . $prefix . $ext . '.' . PHP_SHLIB_SUFFIX;
128        $msg = @is_readable($_ext) ? 'Could be loaded. Please add in php.ini' : 'Not installed';
129        $RCI->na($database, $msg, $source_urls[$database]);
130    }
131    echo '<br />';
132}
133
134?>
135
136
137<h3>Check for required 3rd party libs</h3>
138<p class="hint">This also checks if the include path is set correctly.</p>
139
140<?php
141
142foreach ($required_libs as $classname => $file) {
143    @include_once $file;
144    if (class_exists($classname)) {
145        $RCI->pass($classname);
146    }
147    else {
148        $RCI->fail($classname, "Failed to load $file", $source_urls[$classname]);
149    }
150    echo "<br />";
151}
152
153
154?>
155
156<h3>Checking php.ini/.htaccess settings</h3>
157<p class="hint">The following settings are <em>required</em> to run RoundCube:</p>
158
159<?php
160
161foreach ($ini_checks as $var => $val) {
162    $status = ini_get($var);
163    if ($val === '-NOTEMPTY-') {
164        if (empty($status)) {
165            $RCI->fail($var, "cannot be empty and needs to be set");
166        } else {
167            $RCI->pass($var);
168        }
169        echo '<br />';
170        continue;
171    }
172    if ($status == $val) {
173        $RCI->pass($var);
174    } else {
175      $RCI->fail($var, "is '$status', should be '$val'");
176    }
177    echo '<br />';
178}
179?>
180
181<p class="hint">The following settings are <em>optional</em> and recommended:</p>
182
183<?php
184
185foreach ($optional_checks as $var => $val) {
186    $status = ini_get($var);
187    if ($val === '-NOTEMPTY-') {
188        if (empty($status)) {
189            $RCI->optfail($var, "Could be set");
190        } else {
191            $RCI->pass($var);
192        }
193        echo '<br />';
194        continue;
195    }
196    if ($status == $val) {
197        $RCI->pass($var);
198    } else {
199      $RCI->optfail($var, "is '$status', could be '$val'");
200    }
201    echo '<br />';
202}
203?>
204
205<?php
206
207if ($RCI->failures) {
208  echo '<p class="warning">Sorry but your webserver does not meet the requirements for RoundCube!<br />
209            Please install the missing modules or fix the php.ini settings according to the above check results.<br />
210            Hint: only checks showing <span class="fail">NOT OK</span> need to be fixed.</p>';
211}
212echo '<p><br /><input type="submit" value="NEXT" ' . ($RCI->failures ? 'disabled' : '') . ' /></p>';
213
214?>
215
216</form>
Note: See TracBrowser for help on using the repository browser.