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