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