alecpl
2008-07-01 e6e5c60aae745a580a2d7fca1e2b7104c3907352
commit | author | age
b3f9df 1 <form action="index.php" method="get">
354978 2 <?php
T 3
337694 4 $required_php_exts = array('PCRE' => 'pcre', 'DOM' => 'dom', 'Session' => 'session');
6557d3 5
e18d04 6 $optional_php_exts = array('FileInfo' => 'fileinfo', 'Libiconv' => 'iconv',
ff5222 7     'Multibyte' => 'mbstring', 'OpenSSL' => 'openssl', 'Mcrypt' => 'mcrypt',
T 8     'GD' => 'gd');
6557d3 9
T 10 $required_libs = array('PEAR' => 'PEAR.php', 'DB' => 'DB.php', 'MDB2' => 'MDB2.php',
ff5222 11     'Net_SMTP' => 'Net/SMTP.php', 'Mail_mime' => 'Mail/mime.php',
T 12     'iilConnection' => 'lib/imap.inc');
6557d3 13
T 14 $supported_dbs = array('MySQL' => 'mysql', 'MySQLi' => 'mysqli',
15     'PostgreSQL' => 'pgsql', 'SQLite (v2)' => 'sqlite');
c5042d 16
T 17 $ini_checks = array('file_uploads' => 1, 'session.auto_start' => 0,
019b5d 18     'magic_quotes_gpc' => 0, 'magic_quotes_sybase' => 0);
6557d3 19
T 20 $source_urls = array(
21     'Sockets' => 'http://www.php.net/manual/en/ref.sockets.php',
22     'Session' => 'http://www.php.net/manual/en/ref.session.php',
23     'PCRE' => 'http://www.php.net/manual/en/ref.pcre.php',
24     'FileInfo' => 'http://www.php.net/manual/en/ref.fileinfo.php',
25     'Libiconv' => 'http://www.php.net/manual/en/ref.iconv.php',
26     'Multibyte' => 'http://www.php.net/manual/en/ref.mbstring.php',
e18d04 27     'Mcrypt' => 'http://www.php.net/manual/en/ref.mcrypt.php',
6557d3 28     'OpenSSL' => 'http://www.php.net/manual/en/ref.openssl.php',
e18d04 29     'GD' => 'http://www.php.net/manual/en/ref.image.php',
6557d3 30     'PEAR' => 'http://pear.php.net',
T 31     'MDB2' => 'http://pear.php.net/package/MDB2',
32     'Net_SMTP' => 'http://pear.php.net/package/Net_SMTP',
5d725e 33     'Mail_mime' => 'http://pear.php.net/package/Mail_mime',
T 34     'DOM' => 'http://www.php.net/manual/en/intro.dom.php'
6557d3 35 );
354978 36
1c4e5d 37 echo '<input type="hidden" name="_step" value="' . ($RCI->configured ? 3 : 2) . '" />';
354978 38 ?>
6557d3 39
T 40 <h3>Checking PHP version</h3>
41 <?php
42
47124c 43 define('MIN_PHP_VERSION', '5.2.0');
70430e 44 if (version_compare(PHP_VERSION, MIN_PHP_VERSION, '>=')) {
S 45     $RCI->pass('Version', 'PHP ' . PHP_VERSION . ' detected');
7635d2 46 } else {
70430e 47     $RCI->fail('Version', 'PHP Version ' . MIN_PHP_VERSION . ' or greater is required ' . PHP_VERSION . ' detected');
6557d3 48 }
T 49 ?>
50
51 <h3>Checking PHP extensions</h3>
52 <p class="hint">The following modules/extensions are <em>required</em> to run RoundCube:</p>
53 <?php
54     
55 $prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : '';
56 foreach ($required_php_exts AS $name => $ext) {
57     if (extension_loaded($ext)) {
58         $RCI->pass($name);
7635d2 59     } else {
6557d3 60         $_ext = $prefix . $ext . '.' . PHP_SHLIB_SUFFIX;
T 61         $msg = @dl($_ext) ? 'Could be loaded. Please add in php.ini' : '';
62         $RCI->fail($name, $msg, $source_urls[$name]);
63     }
64     echo '<br />';
65 }
66
67 ?>
68
308f41 69 <p class="hint">The next couple of extensions are <em>optional</em> but recommended to get the best performance:</p>
6557d3 70 <?php
T 71
72 foreach ($optional_php_exts AS $name => $ext) {
73     if (extension_loaded($ext)) {
74         $RCI->pass($name);
75     }
76     else {
77         $_ext = $prefix . $ext . '.' . PHP_SHLIB_SUFFIX;
78         $msg = @dl($_ext) ? 'Could be loaded. Please add in php.ini' : '';
79         $RCI->na($name, $msg, $source_urls[$name]);
80     }
81     echo '<br />';
82 }
83
84 ?>
85
86
87 <h3>Checking available databases</h3>
88 <p class="hint">Check which of the supported extensions are installed. At least one of them is required.</p>
89
90 <?php
91
92 $prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : '';
93 foreach ($supported_dbs AS $database => $ext) {
94     if (extension_loaded($ext)) {
95         $RCI->pass($database);
96     }
97     else {
98         $_ext = $prefix . $ext . '.' . PHP_SHLIB_SUFFIX;
99         $msg = @dl($_ext) ? 'Could be loaded. Please add in php.ini' : 'Not installed';
100         $RCI->na($database, $msg, $source_urls[$database]);
101     }
102     echo '<br />';
103 }
104
105 ?>
106
107
108 <h3>Check for required 3rd party libs</h3>
109 <p class="hint">This also checks if the include path is set correctly.</p>
110
111 <?php
112
113 foreach ($required_libs as $classname => $file) {
114     @include_once $file;
115     if (class_exists($classname)) {
116         $RCI->pass($classname);
117     }
118     else if ($classname == 'DB' || ($classname == 'MDB2' && class_exists('DB'))) {
119         $RCI->na($classname, 'Use ' . ($classname == 'DB' ? 'MDB2' : 'DB') . ' instead');
120     }
121     else {
122         $RCI->fail($classname, "Failed to load $file", $source_urls[$classname]);
123     }
124     echo "<br />";
125 }
126
c5042d 127
T 128 ?>
129
130 <h3>Checking php.ini/.htaccess settings</h3>
131
132 <?php
133
134 foreach ($ini_checks as $var => $val) {
135     $status = ini_get($var);
136     if ($status == $val) {
137         $RCI->pass($var);
138     }
139     else {
140       $RCI->fail($var, "is '$status', should be '$val'");
141     }
142     echo '<br />';
143 }
144 ?>
145
146 <?php
147
019b5d 148 if ($RCI->failures) {
6557d3 149   echo '<p class="warning">Sorry but your webserver does not meet the requirements for RoundCube!<br />
4a2765 150             Please install the missing modules or fix the php.ini settings according to the above check results.<br />
T 151             Hint: only checks showing <span class="fail">NOT OK</span> need to be fixed.</p>';
019b5d 152 }
6557d3 153 echo '<p><br /><input type="submit" value="NEXT" ' . ($RCI->failures ? 'disabled' : '') . ' /></p>';
T 154
155 ?>
156
354978 157 </form>