]> git.donarmstrong.com Git - roundcube.git/blob - installer/check.php
Merge commit 'upstream/0.2.2' into unstable-import
[roundcube.git] / installer / check.php
1 <form action="index.php" method="get">
2 <?php
3
4 $required_php_exts = array('PCRE' => 'pcre', 'DOM' => 'dom', 'Session' => 'session');
5
6 $optional_php_exts = array('FileInfo' => 'fileinfo', 'Libiconv' => 'iconv',
7     'Multibyte' => 'mbstring', 'OpenSSL' => 'openssl', 'Mcrypt' => 'mcrypt',
8     'GD' => 'gd');
9
10 $required_libs = array('PEAR' => 'PEAR.php', 'MDB2' => 'MDB2.php',
11     'Net_SMTP' => 'Net/SMTP.php', 'Mail_mime' => 'Mail/mime.php',
12     'iilConnection' => 'lib/imap.inc');
13
14 $supported_dbs = array('MySQL' => 'mysql', 'MySQLi' => 'mysqli',
15     'PostgreSQL' => 'pgsql', 'SQLite (v2)' => 'sqlite');
16
17 $ini_checks = array('file_uploads' => 1, 'session.auto_start' => 0,
18     'zend.ze1_compatibility_mode' => 0, 'mbstring.func_overload' => 0);
19
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',
27     'Mcrypt' => 'http://www.php.net/manual/en/ref.mcrypt.php',
28     'OpenSSL' => 'http://www.php.net/manual/en/ref.openssl.php',
29     'GD' => 'http://www.php.net/manual/en/ref.image.php',
30     'PEAR' => 'http://pear.php.net',
31     'MDB2' => 'http://pear.php.net/package/MDB2',
32     'Net_SMTP' => 'http://pear.php.net/package/Net_SMTP',
33     'Mail_mime' => 'http://pear.php.net/package/Mail_mime',
34     'DOM' => 'http://www.php.net/manual/en/intro.dom.php'
35 );
36
37 echo '<input type="hidden" name="_step" value="' . ($RCI->configured ? 3 : 2) . '" />';
38 ?>
39
40 <h3>Checking PHP version</h3>
41 <?php
42
43 define('MIN_PHP_VERSION', '5.2.0');
44 if (version_compare(PHP_VERSION, MIN_PHP_VERSION, '>=')) {
45     $RCI->pass('Version', 'PHP ' . PHP_VERSION . ' detected');
46 } else {
47     $RCI->fail('Version', 'PHP Version ' . MIN_PHP_VERSION . ' or greater is required ' . PHP_VERSION . ' detected');
48 }
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);
59     } else {
60         $_ext = $prefix . $ext . '.' . PHP_SHLIB_SUFFIX;
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
69 <p class="hint">The next couple of extensions are <em>optional</em> but recommended to get the best performance:</p>
70 <?php
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 {
119         $RCI->fail($classname, "Failed to load $file", $source_urls[$classname]);
120     }
121     echo "<br />";
122 }
123
124
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
145 if ($RCI->failures) {
146   echo '<p class="warning">Sorry but your webserver does not meet the requirements for RoundCube!<br />
147             Please install the missing modules or fix the php.ini settings according to the above check results.<br />
148             Hint: only checks showing <span class="fail">NOT OK</span> need to be fixed.</p>';
149 }
150 echo '<p><br /><input type="submit" value="NEXT" ' . ($RCI->failures ? 'disabled' : '') . ' /></p>';
151
152 ?>
153
154 </form>