]> git.donarmstrong.com Git - roundcube.git/blob - installer/check.php
Imported Upstream version 0.1
[roundcube.git] / installer / check.php
1 <form action="index.php" method="get">
2 <?php
3
4 $required_php_exts = array('PCRE' => 'pcre', 'Session' => 'session', 'Sockets' => 'sockets');
5
6 $optional_php_exts = array('FileInfo' => 'fileinfo', 'Libiconv' => 'iconv',
7     'Multibyte' => 'mbstring', 'OpenSSL' => 'openssl', 'Mcrypt' => 'mcrypt', 'GD' => 'gd');
8
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');
14
15 $ini_checks = array('file_uploads' => 1, 'session.auto_start' => 0,
16     'magic_quotes_gpc' => 0, 'magic_quotes_sybase' => 0);
17
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',
25     'Mcrypt' => 'http://www.php.net/manual/en/ref.mcrypt.php',
26     'OpenSSL' => 'http://www.php.net/manual/en/ref.openssl.php',
27     'GD' => 'http://www.php.net/manual/en/ref.image.php',
28     'PEAR' => 'http://pear.php.net',
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 );
33
34 echo '<input type="hidden" name="_step" value="' . ($RCI->configured ? 3 : 2) . '" />';
35 ?>
36
37 <h3>Checking PHP version</h3>
38 <?php
39
40 if (phpversion() > 4.3) {
41     $RCI->pass('Version', 'PHP ' . phpversion() . ' detected');
42 }
43 else {
44     $RCI->fail('Version', 'PHP Version 4.3.1 or greater is required');
45 }
46
47 ?>
48
49 <h3>Checking PHP extensions</h3>
50 <p class="hint">The following modules/extensions are <em>required</em> to run RoundCube:</p>
51 <?php
52     
53 $prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : '';
54 foreach ($required_php_exts AS $name => $ext) {
55     if (extension_loaded($ext)) {
56         $RCI->pass($name);
57     }
58     else {
59         $_ext = $prefix . $ext . '.' . PHP_SHLIB_SUFFIX;
60         $msg = @dl($_ext) ? 'Could be loaded. Please add in php.ini' : '';
61         $RCI->fail($name, $msg, $source_urls[$name]);
62     }
63     echo '<br />';
64 }
65
66 ?>
67
68 <p class="hint">These extensions are <em>optional</em> but recommended to get the best performance:</p>
69 <?php
70
71 foreach ($optional_php_exts AS $name => $ext) {
72     if (extension_loaded($ext)) {
73         $RCI->pass($name);
74     }
75     else {
76         $_ext = $prefix . $ext . '.' . PHP_SHLIB_SUFFIX;
77         $msg = @dl($_ext) ? 'Could be loaded. Please add in php.ini' : '';
78         $RCI->na($name, $msg, $source_urls[$name]);
79     }
80     echo '<br />';
81 }
82
83 ?>
84
85
86 <h3>Checking available databases</h3>
87 <p class="hint">Check which of the supported extensions are installed. At least one of them is required.</p>
88
89 <?php
90
91 $prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : '';
92 foreach ($supported_dbs AS $database => $ext) {
93     if (extension_loaded($ext)) {
94         $RCI->pass($database);
95     }
96     else {
97         $_ext = $prefix . $ext . '.' . PHP_SHLIB_SUFFIX;
98         $msg = @dl($_ext) ? 'Could be loaded. Please add in php.ini' : 'Not installed';
99         $RCI->na($database, $msg, $source_urls[$database]);
100     }
101     echo '<br />';
102 }
103
104 ?>
105
106
107 <h3>Check for required 3rd party libs</h3>
108 <p class="hint">This also checks if the include path is set correctly.</p>
109
110 <?php
111
112 foreach ($required_libs as $classname => $file) {
113     @include_once $file;
114     if (class_exists($classname)) {
115         $RCI->pass($classname);
116     }
117     else if ($classname == 'DB' || ($classname == 'MDB2' && class_exists('DB'))) {
118         $RCI->na($classname, 'Use ' . ($classname == 'DB' ? 'MDB2' : 'DB') . ' instead');
119     }
120     else {
121         $RCI->fail($classname, "Failed to load $file", $source_urls[$classname]);
122     }
123     echo "<br />";
124 }
125
126
127 ?>
128
129 <h3>Checking php.ini/.htaccess settings</h3>
130
131 <?php
132
133 foreach ($ini_checks as $var => $val) {
134     $status = ini_get($var);
135     if ($status == $val) {
136         $RCI->pass($var);
137     }
138     else {
139       $RCI->fail($var, "is '$status', should be '$val'");
140     }
141     echo '<br />';
142 }
143 ?>
144
145 <?php
146
147 if ($RCI->failures) {
148   echo '<p class="warning">Sorry but your webserver does not meet the requirements for RoundCube!<br />
149             Please install the missing modules or fix the php.ini settings according to the above check results.<br />
150             Hint: only checks showing <span class="fail">NOT OK</span> need to be fixed.</p>';
151 }
152 echo '<p><br /><input type="submit" value="NEXT" ' . ($RCI->failures ? 'disabled' : '') . ' /></p>';
153
154 ?>
155
156 </form>