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