commit | author | age
|
354978
|
1 |
<?php |
T |
2 |
|
6557d3
|
3 |
$docroot = realpath(dirname(__FILE__) . '/../'); |
T |
4 |
$include_path = $docroot . '/program/lib' . PATH_SEPARATOR . $docroot . '/program' . PATH_SEPARATOR . ini_get('include_path'); |
|
5 |
set_include_path($include_path); |
354978
|
6 |
|
6557d3
|
7 |
$required_php_exts = array('PCRE' => 'pcre', 'Session' => 'session', 'Sockets' => 'sockets'); |
T |
8 |
|
|
9 |
$optional_php_exts = array('FileInfo' => 'fileinfo', 'Libiconv' => 'iconv', 'Multibyte' => 'mbstring', 'OpenSSL' => 'openssl'); |
|
10 |
|
|
11 |
$required_libs = array('PEAR' => 'PEAR.php', 'DB' => 'DB.php', 'MDB2' => 'MDB2.php', |
|
12 |
'Net_SMTP' => 'Net/SMTP.php', 'Mail_mime' => 'Mail/mime.php', 'iilConnection' => 'lib/imap.inc'); |
|
13 |
|
|
14 |
$supported_dbs = array('MySQL' => 'mysql', 'MySQLi' => 'mysqli', |
|
15 |
'PostgreSQL' => 'pgsql', 'SQLite (v2)' => 'sqlite'); |
|
16 |
|
|
17 |
$source_urls = array( |
|
18 |
'Sockets' => 'http://www.php.net/manual/en/ref.sockets.php', |
|
19 |
'Session' => 'http://www.php.net/manual/en/ref.session.php', |
|
20 |
'PCRE' => 'http://www.php.net/manual/en/ref.pcre.php', |
|
21 |
'FileInfo' => 'http://www.php.net/manual/en/ref.fileinfo.php', |
|
22 |
'Libiconv' => 'http://www.php.net/manual/en/ref.iconv.php', |
|
23 |
'Multibyte' => 'http://www.php.net/manual/en/ref.mbstring.php', |
|
24 |
'OpenSSL' => 'http://www.php.net/manual/en/ref.openssl.php', |
|
25 |
'PEAR' => 'http://pear.php.net', |
|
26 |
'MDB2' => 'http://pear.php.net/package/MDB2', |
|
27 |
'Net_SMTP' => 'http://pear.php.net/package/Net_SMTP', |
|
28 |
'Mail_mime' => 'http://pear.php.net/package/Mail_mime' |
|
29 |
); |
354978
|
30 |
|
T |
31 |
?> |
6557d3
|
32 |
|
T |
33 |
<form action="index.php" method="get"> |
|
34 |
<input type="hidden" name="_step" value="2" /> |
|
35 |
|
|
36 |
<h3>Checking PHP version</h3> |
|
37 |
<?php |
|
38 |
|
|
39 |
if (phpversion() > 4.3) { |
|
40 |
$RCI->pass('Version', 'PHP ' . phpversion() . ' detected'); |
|
41 |
} |
|
42 |
else { |
|
43 |
$RCI->fail('Version', 'PHP Version 4.3.1 or greater is required'); |
|
44 |
} |
|
45 |
|
|
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); |
|
56 |
} |
|
57 |
else { |
|
58 |
$_ext = $prefix . $ext . '.' . PHP_SHLIB_SUFFIX; |
|
59 |
$msg = @dl($_ext) ? 'Could be loaded. Please add in php.ini' : ''; |
|
60 |
$RCI->fail($name, $msg, $source_urls[$name]); |
|
61 |
} |
|
62 |
echo '<br />'; |
|
63 |
} |
|
64 |
|
|
65 |
?> |
|
66 |
|
|
67 |
<p class="hint">These extensions are <em>optional</em> but recommended to get the best performance:</p> |
|
68 |
<?php |
|
69 |
|
|
70 |
foreach ($optional_php_exts AS $name => $ext) { |
|
71 |
if (extension_loaded($ext)) { |
|
72 |
$RCI->pass($name); |
|
73 |
} |
|
74 |
else { |
|
75 |
$_ext = $prefix . $ext . '.' . PHP_SHLIB_SUFFIX; |
|
76 |
$msg = @dl($_ext) ? 'Could be loaded. Please add in php.ini' : ''; |
|
77 |
$RCI->na($name, $msg, $source_urls[$name]); |
|
78 |
} |
|
79 |
echo '<br />'; |
|
80 |
} |
|
81 |
|
|
82 |
?> |
|
83 |
|
|
84 |
|
|
85 |
<h3>Checking available databases</h3> |
|
86 |
<p class="hint">Check which of the supported extensions are installed. At least one of them is required.</p> |
|
87 |
|
|
88 |
<?php |
|
89 |
|
|
90 |
$prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : ''; |
|
91 |
foreach ($supported_dbs AS $database => $ext) { |
|
92 |
if (extension_loaded($ext)) { |
|
93 |
$RCI->pass($database); |
|
94 |
} |
|
95 |
else { |
|
96 |
$_ext = $prefix . $ext . '.' . PHP_SHLIB_SUFFIX; |
|
97 |
$msg = @dl($_ext) ? 'Could be loaded. Please add in php.ini' : 'Not installed'; |
|
98 |
$RCI->na($database, $msg, $source_urls[$database]); |
|
99 |
} |
|
100 |
echo '<br />'; |
|
101 |
} |
|
102 |
|
|
103 |
?> |
|
104 |
|
|
105 |
|
|
106 |
<h3>Check for required 3rd party libs</h3> |
|
107 |
<p class="hint">This also checks if the include path is set correctly.</p> |
|
108 |
|
|
109 |
<?php |
|
110 |
|
|
111 |
foreach ($required_libs as $classname => $file) { |
|
112 |
@include_once $file; |
|
113 |
if (class_exists($classname)) { |
|
114 |
$RCI->pass($classname); |
|
115 |
} |
|
116 |
else if ($classname == 'DB' || ($classname == 'MDB2' && class_exists('DB'))) { |
|
117 |
$RCI->na($classname, 'Use ' . ($classname == 'DB' ? 'MDB2' : 'DB') . ' instead'); |
|
118 |
} |
|
119 |
else { |
|
120 |
$RCI->fail($classname, "Failed to load $file", $source_urls[$classname]); |
|
121 |
} |
|
122 |
echo "<br />"; |
|
123 |
} |
|
124 |
|
|
125 |
if ($RCI->failures) |
|
126 |
echo '<p class="warning">Sorry but your webserver does not meet the requirements for RoundCube!<br /> |
|
127 |
Please install the missing modules according to the above check results.</p>'; |
|
128 |
|
|
129 |
echo '<p><br /><input type="submit" value="NEXT" ' . ($RCI->failures ? 'disabled' : '') . ' /></p>'; |
|
130 |
|
|
131 |
?> |
|
132 |
|
354978
|
133 |
</form> |