alecpl
2010-03-12 b9d751df60a8f0126848a976b6c045a790ee36eb
commit | author | age
b3f9df 1 <form action="index.php" method="get">
354978 2 <?php
T 3
400717 4 $required_php_exts = array('PCRE' => 'pcre', 'DOM' => 'dom',
d62c31 5     'Session' => 'session', 'XML' => 'xml', 'JSON' => 'json');
6557d3 6
e18d04 7 $optional_php_exts = array('FileInfo' => 'fileinfo', 'Libiconv' => 'iconv',
ff5222 8     'Multibyte' => 'mbstring', 'OpenSSL' => 'openssl', 'Mcrypt' => 'mcrypt',
0f9687 9 );
6557d3 10
9e8e5f 11 $required_libs = array('PEAR' => 'PEAR.php', 'MDB2' => 'MDB2.php',
ff5222 12     'Net_SMTP' => 'Net/SMTP.php', 'Mail_mime' => 'Mail/mime.php',
T 13     'iilConnection' => 'lib/imap.inc');
6557d3 14
T 15 $supported_dbs = array('MySQL' => 'mysql', 'MySQLi' => 'mysqli',
16     'PostgreSQL' => 'pgsql', 'SQLite (v2)' => 'sqlite');
c5042d 17
T 18 $ini_checks = array('file_uploads' => 1, 'session.auto_start' => 0,
2d1a45 19     'zend.ze1_compatibility_mode' => 0, 'mbstring.func_overload' => 0,
11e670 20     'suhosin.session.encrypt' => 0);
A 21
22 $optional_checks = array('date.timezone' => '-NOTEMPTY-');
6557d3 23
T 24 $source_urls = array(
d62c31 25     'Sockets' => 'http://www.php.net/manual/en/book.sockets.php',
A 26     'Session' => 'http://www.php.net/manual/en/book.session.php',
27     'PCRE' => 'http://www.php.net/manual/en/book.pcre.php',
28     'FileInfo' => 'http://www.php.net/manual/en/book.fileinfo.php',
29     'Libiconv' => 'http://www.php.net/manual/en/book.iconv.php',
30     'Multibyte' => 'http://www.php.net/manual/en/book.mbstring.php',
31     'Mcrypt' => 'http://www.php.net/manual/en/book.mcrypt.php',
32     'OpenSSL' => 'http://www.php.net/manual/en/book.openssl.php',
33     'JSON' => 'http://www.php.net/manual/en/book.json.php',
34     'DOM' => 'http://www.php.net/manual/en/book.dom.php',
6557d3 35     'PEAR' => 'http://pear.php.net',
T 36     'MDB2' => 'http://pear.php.net/package/MDB2',
37     'Net_SMTP' => 'http://pear.php.net/package/Net_SMTP',
5d725e 38     'Mail_mime' => 'http://pear.php.net/package/Mail_mime',
6557d3 39 );
354978 40
1c4e5d 41 echo '<input type="hidden" name="_step" value="' . ($RCI->configured ? 3 : 2) . '" />';
354978 42 ?>
6557d3 43
T 44 <h3>Checking PHP version</h3>
45 <?php
46
47124c 47 define('MIN_PHP_VERSION', '5.2.0');
70430e 48 if (version_compare(PHP_VERSION, MIN_PHP_VERSION, '>=')) {
S 49     $RCI->pass('Version', 'PHP ' . PHP_VERSION . ' detected');
7635d2 50 } else {
70430e 51     $RCI->fail('Version', 'PHP Version ' . MIN_PHP_VERSION . ' or greater is required ' . PHP_VERSION . ' detected');
6557d3 52 }
T 53 ?>
54
55 <h3>Checking PHP extensions</h3>
56 <p class="hint">The following modules/extensions are <em>required</em> to run RoundCube:</p>
57 <?php
3e2bc6 58
A 59 // get extensions location
60 $ext_dir = ini_get('extension_dir');
61
6557d3 62 $prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : '';
T 63 foreach ($required_php_exts AS $name => $ext) {
64     if (extension_loaded($ext)) {
65         $RCI->pass($name);
7635d2 66     } else {
3e2bc6 67         $_ext = $ext_dir . '/' . $prefix . $ext . '.' . PHP_SHLIB_SUFFIX;
A 68         $msg = @is_readable($_ext) ? 'Could be loaded. Please add in php.ini' : '';
6557d3 69         $RCI->fail($name, $msg, $source_urls[$name]);
T 70     }
71     echo '<br />';
72 }
73
74 ?>
75
11e670 76 <p class="hint">The next couple of extensions are <em>optional</em> and recommended to get the best performance:</p>
6557d3 77 <?php
T 78
79 foreach ($optional_php_exts AS $name => $ext) {
80     if (extension_loaded($ext)) {
81         $RCI->pass($name);
82     }
83     else {
3e2bc6 84         $_ext = $ext_dir . '/' . $prefix . $ext . '.' . PHP_SHLIB_SUFFIX;
A 85         $msg = @is_readable($_ext) ? 'Could be loaded. Please add in php.ini' : '';
6557d3 86         $RCI->na($name, $msg, $source_urls[$name]);
T 87     }
88     echo '<br />';
89 }
90
91 ?>
92
93
94 <h3>Checking available databases</h3>
95 <p class="hint">Check which of the supported extensions are installed. At least one of them is required.</p>
96
97 <?php
98
99 $prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : '';
100 foreach ($supported_dbs AS $database => $ext) {
101     if (extension_loaded($ext)) {
102         $RCI->pass($database);
103     }
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' : 'Not installed';
6557d3 107         $RCI->na($database, $msg, $source_urls[$database]);
T 108     }
109     echo '<br />';
110 }
111
112 ?>
113
114
115 <h3>Check for required 3rd party libs</h3>
116 <p class="hint">This also checks if the include path is set correctly.</p>
117
118 <?php
119
120 foreach ($required_libs as $classname => $file) {
121     @include_once $file;
122     if (class_exists($classname)) {
123         $RCI->pass($classname);
124     }
125     else {
126         $RCI->fail($classname, "Failed to load $file", $source_urls[$classname]);
127     }
128     echo "<br />";
129 }
130
c5042d 131
T 132 ?>
133
134 <h3>Checking php.ini/.htaccess settings</h3>
11e670 135 <p class="hint">The following settings are <em>required</em> to run RoundCube:</p>
c5042d 136
T 137 <?php
138
139 foreach ($ini_checks as $var => $val) {
140     $status = ini_get($var);
f7df6c 141     if ($val === '-NOTEMPTY-') {
T 142         if (empty($status)) {
143             $RCI->fail($var, "cannot be empty and needs to be set");
144         } else {
145             $RCI->pass($var);
146         }
147         echo '<br />';
148         continue;
149     }
c5042d 150     if ($status == $val) {
T 151         $RCI->pass($var);
f7df6c 152     } else {
c5042d 153       $RCI->fail($var, "is '$status', should be '$val'");
T 154     }
155     echo '<br />';
156 }
157 ?>
158
11e670 159 <p class="hint">The following settings are <em>optional</em> and recommended:</p>
A 160
161 <?php
162
163 foreach ($optional_checks as $var => $val) {
164     $status = ini_get($var);
165     if ($val === '-NOTEMPTY-') {
166         if (empty($status)) {
167             $RCI->optfail($var, "Could be set");
168         } else {
169             $RCI->pass($var);
170         }
171         echo '<br />';
172         continue;
173     }
174     if ($status == $val) {
175         $RCI->pass($var);
176     } else {
177       $RCI->optfail($var, "is '$status', could be '$val'");
178     }
179     echo '<br />';
180 }
181 ?>
182
c5042d 183 <?php
T 184
019b5d 185 if ($RCI->failures) {
6557d3 186   echo '<p class="warning">Sorry but your webserver does not meet the requirements for RoundCube!<br />
4a2765 187             Please install the missing modules or fix the php.ini settings according to the above check results.<br />
T 188             Hint: only checks showing <span class="fail">NOT OK</span> need to be fixed.</p>';
019b5d 189 }
6557d3 190 echo '<p><br /><input type="submit" value="NEXT" ' . ($RCI->failures ? 'disabled' : '') . ' /></p>';
T 191
192 ?>
193
354978 194 </form>