4 * SquirrelMail configtest script
6 * @copyright © 2003-2006 The SquirrelMail Project Team
7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
9 * @package squirrelmail
13 /************************************************************
14 * NOTE: you do not need to change this script! *
15 * If it throws errors you need to adjust your config. *
16 ************************************************************/
18 // This script could really use some restructuring as it has grown quite rapidly
19 // but is not very 'clean'. Feel free to get some structure into this thing.
22 function do_err($str, $fatal = TRUE) {
23 global $IND, $warnings;
24 $level = $fatal ?
'FATAL ERROR:' : 'WARNING:';
25 echo '<p>'.$IND.'<font color="red"><b>' . $level . '</b></font> ' .$str. "</p>\n";
27 echo '</body></html>';
34 $IND = str_repeat(' ',4);
38 define('SM_PATH', '../');
40 /* set default value in order to block remote access to script */
41 $allow_remote_configtest=false;
44 * Load config before output begins. functions/strings.php depends on
45 * functions/globals.php. functions/global.php needs to be run before
46 * any html output starts. If config.php is missing, error will be displayed
49 if (file_exists(SM_PATH
. 'config/config.php')) {
50 require(SM_PATH
. 'config/config.php');
52 require(SM_PATH
. 'functions/global.php');
53 require(SM_PATH
. 'functions/strings.php');
56 * get_location starts session and must be run before output is started.
58 $test_location = get_location();
60 ?
><!DOCTYPE HTML
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
61 "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
64 <meta name
="robots" content
="noindex,nofollow">
65 <title
>SquirrelMail configtest
</title
>
68 <h1
>SquirrelMail configtest
</h1
>
70 <p
>This script will
try to check some aspects of your SquirrelMail configuration
71 and point you to errors whereever it can find them
. You need to go run
<tt
>conf
.pl
</tt
>
72 in the
<tt
>config
/</tt
> directory first before you run this script
.</p
>
76 $included = array_map('basename', get_included_files() );
77 if(!in_array('config.php', $included)) {
78 if(!file_exists(SM_PATH
. 'config/config.php')) {
79 do_err('Config file '.SM_PATH
. 'config/config.php does not exist!<br />'.
80 'You need to run <tt>conf.pl</tt> first.');
82 do_err('Could not read '.SM_PATH
.'config/config.php! Check file permissions.');
84 if(!in_array('strings.php', $included)) {
85 do_err('Could not include '.SM_PATH
.'functions/strings.php!<br />'.
86 'Check permissions on that file.');
89 /* Block remote use of script */
90 if (! $allow_remote_configtest) {
91 sqGetGlobalVar('REMOTE_ADDR',$client_ip,SQ_SERVER
);
92 sqGetGlobalVar('SERVER_ADDR',$server_ip,SQ_SERVER
);
94 if ((! isset($client_ip) ||
$client_ip!='127.0.0.1') &&
95 (! isset($client_ip) ||
! isset($server_ip) ||
$client_ip!=$server_ip)) {
96 do_err('Enable "Allow remote configtest" option in squirrelmail configuration in order to use this script.');
99 /* checking PHP specs */
101 echo "<p><table>\n<tr><td>SquirrelMail version:</td><td><b>" . $version . "</b></td></tr>\n" .
102 '<tr><td>Config file version:</td><td><b>' . $config_version . "</b></td></tr>\n" .
103 '<tr><td>Config file last modified:</td><td><b>' .
104 date ('d F Y H:i:s', filemtime(SM_PATH
. 'config/config.php')) .
105 "</b></td></tr>\n</table>\n</p>\n\n";
107 /* check $config_version */
108 if ($config_version!='1.4.0') {
109 do_err('Configuration file version does not match required version. Please update your configuration file.');
112 echo "Checking PHP configuration...<br />\n";
114 if(!check_php_version(4,1,0)) {
115 do_err('Insufficient PHP version: '. PHP_VERSION
. '! Minimum required: 4.1.0');
118 echo $IND . 'PHP version ' . PHP_VERSION
. ' OK. (You have: ' . phpversion() . ". Minimum: 4.1.0)<br />\n";
119 /* test for boolean false and any string that is not equal to 'off' */
120 if ((bool) ini_get('register_globals') &&
121 strtolower(ini_get('register_globals'))!='off') {
122 do_err('You have register_globals turned on. This is not an error, but it CAN be a security hazard. Consider turning register_globals off.', false);
124 $php_exts = array('session','pcre');
125 $diff = array_diff($php_exts, get_loaded_extensions());
127 do_err('Required PHP extensions missing: '.implode(', ',$diff) );
130 echo $IND . "PHP extensions OK.<br />\n";
132 /* dangerous php settings */
134 * mbstring.func_overload allows to replace original string and regexp functions
135 * with their equivalents from php mbstring extension. It causes problems when
136 * scripts analyze 8bit strings byte after byte or use 8bit strings in regexp tests.
137 * Setting can be controlled in php.ini (php 4.2.0), webserver config (php 4.2.0)
138 * and .htaccess files (php 4.3.5).
140 if (function_exists('mb_internal_encoding') &&
141 check_php_version(4,2,0) &&
142 (int)ini_get('mbstring.func_overload')!=0) {
143 $mb_error='You have enabled mbstring overloading.'
144 .' It can cause problems with SquirrelMail scripts that rely on single byte string functions.';
150 echo "Checking paths...<br />\n";
152 if(!file_exists($data_dir)) {
153 // data_dir is not that important in db_setups.
154 if (isset($prefs_dsn) && ! empty($prefs_dsn)) {
155 $data_dir_error = "Data dir ($data_dir) does not exist!\n";
156 echo $IND .'<font color="red"><b>ERROR:</b></font> ' . $data_dir_error;
158 do_err("Data dir ($data_dir) does not exist!");
161 // don't check if errors
162 if(!isset($data_dir_error) && !is_dir($data_dir)) {
163 if (isset($prefs_dsn) && ! empty($prefs_dsn)) {
164 $data_dir_error = "Data dir ($data_dir) is not a directory!\n";
165 echo $IND . '<font color="red"><b>ERROR:</b></font> ' . $data_dir_error;
167 do_err("Data dir ($data_dir) is not a directory!");
170 // datadir should be executable - but no clean way to test on that
171 if(!isset($data_dir_error) && !is_writable($data_dir)) {
172 if (isset($prefs_dsn) && ! empty($prefs_dsn)) {
173 $data_dir_error = "Data dir ($data_dir) is not writable!\n";
174 echo $IND . '<font color="red"><b>ERROR:</b></font> ' . $data_dir_error;
176 do_err("Data dir ($data_dir) is not writable!");
180 if (isset($data_dir_error)) {
181 echo " Some plugins might need access to data directory.<br />\n";
183 // todo_ornot: actually write something and read it back.
184 echo $IND . "Data dir OK.<br />\n";
187 if($data_dir == $attachment_dir) {
188 echo $IND . "Attachment dir is the same as data dir.<br />\n";
189 if (isset($data_dir_error)) {
190 do_err($data_dir_error);
193 if(!file_exists($attachment_dir)) {
194 do_err("Attachment dir ($attachment_dir) does not exist!");
196 if (!is_dir($attachment_dir)) {
197 do_err("Attachment dir ($attachment_dir) is not a directory!");
199 if (!is_writable($attachment_dir)) {
200 do_err("I cannot write to attachment dir ($attachment_dir)!");
202 echo $IND . "Attachment dir OK.<br />\n";
206 /* check plugins and themes */
207 $bad_plugins = array(
208 'attachment_common', // Integrated into SquirrelMail 1.2 core
209 'auto_prune_sent', // Obsolete: See Proon Automatic Folder Pruning plugin
210 'compose_new_window', // Integrated into SquirrelMail 1.4 core
211 'delete_move_next', // Integrated into SquirrelMail 1.5 core
212 'disk_quota', // Obsolete: See Check Quota plugin
213 'email_priority', // Integrated into SquirrelMail 1.2 core
214 'emoticons', // Obsolete: See HTML Mail plugin
215 'focus_change', // Integrated into SquirrelMail 1.2 core
216 'folder_settings', // Integrated into SquirrelMail 1.5.1 core
217 'global_sql_addressbook', // Integrated into SquirrelMail 1.4 core
218 'hancock', // Not Working: See Random Signature Taglines plugin
219 'msg_flags', // Integrated into SquirrelMail 1.5.1 core
220 'message_source', // Added to SquirrelMail 1.4 Core Plugins (message_details)
221 'motd', // Integrated into SquirrelMail 1.2 core
222 'paginator', // Integrated into SquirrelMail 1.2 core
223 'printer_friendly', // Integrated into SquirrelMail 1.2 core
224 'procfilter', // Obsolete: See Server Side Filter plugin
225 'redhat_php_cgi_fix', // Integrated into SquirrelMail 1.1.1 core
226 'send_to_semicolon', // Integrated into SquirrelMail 1.4.1 core
227 'spamassassin', // Not working beyond SquirrelMail 1.2.7: See Spamassassin SpamFilter (Frontend) v2 plugin
228 'sqcalendar', // Added to SquirrelMail 1.2 Core Plugins (calendar)
229 'sqclock', // Integrated into SquirrelMail 1.2 core
230 'sql_squirrel_logger', // Obsolete: See Squirrel Logger plugin
231 'tmda', // Obsolete: See TMDA Tools plugin
232 'vacation', // Obsolete: See Vacation Local plugin
233 'view_as_html', // Integrated into SquirrelMail 1.5.1 core
234 'xmailer' // Integrated into SquirrelMail 1.2 core
237 if (isset($plugins[0])) {
238 foreach($plugins as $plugin) {
239 if(!file_exists(SM_PATH
.'plugins/'.$plugin)) {
240 do_err('You have enabled the <i>'.$plugin.'</i> plugin, but I cannot find it.', FALSE);
241 } elseif (!is_readable(SM_PATH
.'plugins/'.$plugin.'/setup.php')) {
242 do_err('You have enabled the <i>'.$plugin.'</i> plugin, but I cannot read its setup.php file.', FALSE);
243 } elseif (in_array($plugin, $bad_plugins)) {
244 do_err('You have enabled the <i>'.$plugin.'</i> plugin, which causes problems with this version of SquirrelMail. Please check the ReleaseNotes or other documentation for more information.', false);
247 // load plugin functions
248 include_once(SM_PATH
. 'functions/plugin.php');
249 // turn on output buffering in order to prevent output of new lines
251 foreach ($plugins as $name) {
254 // get output and remove whitespace
255 $output = trim(ob_get_contents());
257 // if plugins output more than newlines and spacing, stop script execution.
258 if (!empty($output)) {
259 $plugin_load_error = 'Some output is produced when plugins are loaded.'
260 .' Usually it means error. Output said: '.htmlspecialchars($output);
261 do_err($plugin_load_error);
264 * Hook is added in 1.5.2. Plugins should print error message and return true
265 * if there is an error in plugin.
267 $plugin_err = boolean_hook_function('configtest');
269 do_err('Some plugin tests failed.');
271 echo $IND . "Plugins OK.<br />\n";
274 echo $IND . "Plugins are not enabled in config.<br />\n";
276 foreach($theme as $thm) {
277 if(!file_exists($thm['PATH'])) {
278 do_err('You have enabled the <i>'.$thm['NAME'].'</i> theme but I cannot find it ('.$thm['PATH'].').', FALSE);
279 } elseif(!is_readable($thm['PATH'])) {
280 do_err('You have enabled the <i>'.$thm['NAME'].'</i> theme but I cannot read it ('.$thm['PATH'].').', FALSE);
284 echo $IND . "Themes OK.<br />\n";
286 if ( $squirrelmail_default_language != 'en_US' ) {
287 $loc_path = SM_PATH
.'locale/'.$squirrelmail_default_language.'/LC_MESSAGES/squirrelmail.mo';
288 if( ! file_exists( $loc_path ) ) {
289 do_err('You have set <i>' . $squirrelmail_default_language .
290 '</i> as your default language, but I cannot find this translation (should be '.
291 'in <tt>' . $loc_path . '</tt>). Please note that you have to download translations '.
292 'separately from the main SquirrelMail package.', FALSE);
293 } elseif ( ! is_readable( $loc_path ) ) {
294 do_err('You have set <i>' . $squirrelmail_default_language .
295 '</i> as your default language, but I cannot read this translation (file '.
296 'in <tt>' . $loc_path . '</tt> unreadable).', FALSE);
298 echo $IND . "Default language OK.<br />\n";
301 echo $IND . "Default language OK.<br />\n";
304 echo $IND . "Base URL detected as: <tt>" . htmlspecialchars($test_location) . "</tt><br />\n";
306 /* check minimal requirements for other security options */
309 if($use_smtp_tls == 1 ||
$use_imap_tls == 1) {
310 if(!check_php_version(4,3,0)) {
311 do_err('You need at least PHP 4.3.0 for SMTP/IMAP TLS!');
313 if(!extension_loaded('openssl')) {
314 do_err('You need the openssl PHP extension to use SMTP/IMAP TLS!');
317 /* starttls extensions */
318 if($use_smtp_tls === 2 ||
$use_imap_tls === 2) {
319 if (! function_exists('stream_socket_enable_crypto')) {
320 do_err('If you want to use STARTTLS extension, you need stream_socket_enable_crypto() function from PHP 5.1.0 and newer.');
324 if ($smtp_auth_mech=='digest-md5' ||
$imap_auth_mech =='digest-md5') {
325 if (!extension_loaded('xml')) {
326 do_err('You need the PHP XML extension to use Digest-MD5 authentication!');
330 /* check outgoing mail */
332 echo "Checking outgoing mail service....<br />\n";
335 // is_executable also checks for existance, but we want to be as precise as possible with the errors
336 if(!file_exists($sendmail_path)) {
337 do_err("Location of sendmail program incorrect ($sendmail_path)!");
339 if(!is_executable($sendmail_path)) {
340 do_err("I cannot execute the sendmail program ($sendmail_path)!");
343 echo $IND . "sendmail OK<br />\n";
345 $stream = fsockopen( ($use_smtp_tls==1?
'tls://':'').$smtpServerAddress, $smtpPort,
346 $errorNumber, $errorString);
348 do_err("Error connecting to SMTP server \"$smtpServerAddress:$smtpPort\".".
349 "Server error: ($errorNumber) ".htmlspecialchars($errorString));
352 // check for SMTP code; should be 2xx to allow us access
353 $smtpline = fgets($stream, 1024);
354 if(((int) $smtpline{0}) > 3) {
355 do_err("Error connecting to SMTP server. Server error: ".
356 htmlspecialchars($smtpline));
359 /* smtp starttls checks */
360 if ($use_smtp_tls===2) {
361 // if something breaks, script should close smtp connection on exit.
364 fwrite($stream,"EHLO $client_ip\r\n");
368 while ($line=fgets($stream, 1024)){
369 if (preg_match("/^250(-|\s)(\S*)\s+(\S.*)/",$line,$match)||
370 preg_match("/^250(-|\s)(\S*)\s+/",$line,$match)) {
371 if (!isset($match[3])) {
372 // simple one word extension
373 $ehlo[strtoupper($match[2])]='';
375 // ehlo-keyword + ehlo-param
376 $ehlo[strtoupper($match[2])]=trim($match[3]);
378 if ($match[1]==' ') {
390 do_err('SMTP EHLO failed. You need ESMTP support for SMTP STARTTLS');
391 } elseif (!array_key_exists('STARTTLS',$ehlo)) {
392 do_err('STARTTLS support is not declared by SMTP server.');
395 fwrite($stream,"STARTTLS\r\n");
396 $starttls_response=fgets($stream, 1024);
397 if ($starttls_response[0]!=2) {
398 $starttls_cmd_err = 'SMTP STARTTLS failed. Server replied: '
399 .htmlspecialchars($starttls_response);
400 do_err($starttls_cmd_err);
401 } elseif(! stream_socket_enable_crypto($stream,true,STREAM_CRYPTO_METHOD_TLS_CLIENT
)) {
402 do_err('Failed to enable encryption on SMTP STARTTLS connection.');
404 echo $IND . "SMTP STARTTLS extension looks OK.<br />\n";
406 // According to RFC we should second ehlo call here.
409 fputs($stream, 'QUIT');
411 echo $IND . 'SMTP server OK (<tt><small>'.
412 trim(htmlspecialchars($smtpline))."</small></tt>)<br />\n";
414 /* POP before SMTP */
415 if($pop_before_smtp) {
416 $stream = fsockopen($smtpServerAddress, 110, $err_no, $err_str);
418 do_err("Error connecting to POP Server ($smtpServerAddress:110) "
419 . $err_no . ' : ' . htmlspecialchars($err_str));
422 $tmp = fgets($stream, 1024);
423 if (substr($tmp, 0, 3) != '+OK') {
424 do_err("Error connecting to POP Server ($smtpServerAddress:110)"
425 . ' '.htmlspecialchars($tmp));
427 fputs($stream, 'QUIT');
429 echo $IND . "POP-before-SMTP OK.<br />\n";
434 * Check the IMAP server
436 echo "Checking IMAP service....<br />\n";
438 /** Can we open a connection? */
439 $stream = fsockopen( ($use_imap_tls==1?
'tls://':'').$imapServerAddress, $imapPort,
440 $errorNumber, $errorString);
442 do_err("Error connecting to IMAP server \"$imapServerAddress:$imapPort\".".
443 "Server error: ($errorNumber) ".
444 htmlspecialchars($errorString));
447 /** Is the first response 'OK'? */
448 $imapline = fgets($stream, 1024);
449 if(substr($imapline, 0,4) != '* OK') {
450 do_err('Error connecting to IMAP server. Server error: '.
451 htmlspecialchars($imapline));
454 echo $IND . 'IMAP server ready (<tt><small>'.
455 htmlspecialchars(trim($imapline))."</small></tt>)<br />\n";
457 /** Check capabilities */
458 fputs($stream, "A001 CAPABILITY\r\n");
460 while ($line=fgets($stream, 1024)){
461 if (preg_match("/A001.*/",$line)) {
468 /* don't display capabilities before STARTTLS */
469 if ($use_imap_tls===2 && stristr($capline, 'STARTTLS') === false) {
470 do_err('Your server doesn\'t support STARTTLS.');
471 } elseif($use_imap_tls===2) {
472 /* try starting starttls */
473 fwrite($stream,"A002 STARTTLS\r\n");
474 $starttls_line=fgets($stream, 1024);
475 if (! preg_match("/^A002 OK.*/i",$starttls_line)) {
476 $imap_starttls_err = 'IMAP STARTTLS failed. Server replied: '
477 .htmlspecialchars($starttls_line);
478 do_err($imap_starttls_err);
479 } elseif (! stream_socket_enable_crypto($stream,true,STREAM_CRYPTO_METHOD_TLS_CLIENT
)) {
480 do_err('Failed to enable encryption on IMAP connection.');
482 echo $IND . "IMAP STARTTLS extension looks OK.<br />\n";
485 // get new capability line
486 fwrite($stream,"A003 CAPABILITY\r\n");
488 while ($line=fgets($stream, 1024)){
489 if (preg_match("/A003.*/",$line)) {
497 echo $IND . 'Capabilities: <tt>'.htmlspecialchars($capline)."</tt><br />\n";
499 if($imap_auth_mech == 'login' && stristr($capline, 'LOGINDISABLED') !== FALSE) {
500 do_err('Your server doesn\'t allow plaintext logins. '.
501 'Try enabling another authentication mechanism like CRAM-MD5, DIGEST-MD5 or TLS-encryption '.
502 'in the SquirrelMail configuration.', FALSE);
505 /** OK, close connection */
506 fputs($stream, "A004 LOGOUT\r\n");
509 echo "Checking internationalization (i18n) settings...<br />\n";
510 echo "$IND gettext - ";
511 if (function_exists('gettext')) {
512 echo 'Gettext functions are available.'
513 .' On some systems you must have appropriate system locales compiled.'
516 /* optional setlocale() tests. Should work only on glibc systems. */
517 if (sqgetGlobalVar('testlocales',$testlocales,SQ_GET
)) {
518 include_once(SM_PATH
. 'include/languages.php');
519 echo $IND . $IND . 'Testing translations:<br>';
520 foreach ($languages as $lang_code => $lang_data) {
521 /* don't test aliases */
522 if (isset($lang_data['NAME'])) {
523 /* locale can be $lang_code or $lang_data['LOCALE'] */
524 if (isset($lang_data['LOCALE'])) {
525 $setlocale = $lang_data['LOCALE'];
527 $setlocale = $lang_code;
529 /* prepare information about tested locales */
530 if (is_array($setlocale)) {
531 $display_locale = implode(', ',$setlocale);
532 $locale_count = count($setlocale);
534 $display_locale = $setlocale;
537 $tested_locales_msg = 'Tested '.htmlspecialchars($display_locale).' '
538 .($locale_count>1 ?
'locales':'locale'). '.';
540 echo $IND . $IND .$IND . $lang_data['NAME'].' (' .$lang_code. ') - ';
541 $retlocale = sq_setlocale(LC_ALL
,$setlocale);
542 if (is_bool($retlocale)) {
543 echo '<font color="red">unsupported</font>. ';
544 echo $tested_locales_msg;
548 .' setlocale() returned "'.htmlspecialchars($retlocale).'"';
553 echo $IND . $IND . '<a href="configtest.php">Don\'t test translations</a>';
555 echo $IND . $IND . '<a href="configtest.php?testlocales=1">Test translations</a>. '
556 .'This test is not accurate and might work only on some systems.'
560 /* end of translation tests */
562 echo 'Gettext functions are unavailable.'
563 .' SquirrelMail will use slower internal gettext functions.'
566 echo "$IND mbstring - ";
567 if (function_exists('mb_detect_encoding')) {
568 echo "Mbstring functions are available.<br />\n";
570 echo 'Mbstring functions are unavailable.'
571 ." Japanese translation won't work.<br />\n";
573 echo "$IND recode - ";
574 if (function_exists('recode')) {
575 echo "Recode functions are available.<br />\n";
576 } elseif (isset($use_php_recode) && $use_php_recode) {
577 echo "Recode functions are unavailable.<br />\n";
578 do_err('Your configuration requires recode support, but recode support is missing.');
580 echo "Recode functions are unavailable.<br />\n";
582 echo "$IND iconv - ";
583 if (function_exists('iconv')) {
584 echo "Iconv functions are available.<br />\n";
585 } elseif (isset($use_php_iconv) && $use_php_iconv) {
586 echo "Iconv functions are unavailable.<br />\n";
587 do_err('Your configuration requires iconv support, but iconv support is missing.');
589 echo "Iconv functions are unavailable.<br />\n";
591 // same test as in include/init.php + date_default_timezone_set check
592 echo "$IND timezone - ";
593 if ( (!ini_get('safe_mode')) ||
function_exists('date_default_timezone_set') ||
594 !strcmp(ini_get('safe_mode_allowed_env_vars'),'') ||
595 preg_match('/^([\w_]+,)*TZ/', ini_get('safe_mode_allowed_env_vars')) ) {
596 echo "Webmail users can change their time zone settings. \n";
598 echo "Webmail users can't change their time zone settings. \n";
600 if (isset($_ENV['TZ'])) {
601 echo 'Default time zone is '.htmlspecialchars($_ENV['TZ']);
603 echo 'Current time zone is '.date('T');
608 echo "Checking database functions...<br />\n";
609 if($addrbook_dsn ||
$prefs_dsn ||
$addrbook_global_dsn) {
610 @include_once
('DB.php');
611 if (class_exists('DB')) {
612 echo "$IND PHP Pear DB support is present.<br />\n";
614 'dbase' => 'dbase_open',
615 'fbsql' => 'fbsql_connect',
616 'interbase' => 'ibase_connect',
617 'informix' => 'ifx_connect',
618 'msql' => 'msql_connect',
619 'mssql' => 'mssql_connect',
620 'mysql' => 'mysql_connect',
621 'mysqli' => 'mysqli_connect',
622 'oci8' => 'ocilogon',
623 'odbc' => 'odbc_connect',
624 'pgsql' => 'pg_connect',
625 'sqlite' => 'sqlite_open',
626 'sybase' => 'sybase_connect'
631 $dsns['preferences'] = $prefs_dsn;
634 $dsns['addressbook'] = $addrbook_dsn;
636 if($addrbook_global_dsn) {
637 $dsns['global addressbook'] = $addrbook_global_dsn;
640 foreach($dsns as $type => $dsn) {
641 $aDsn = explode(':', $dsn);
642 $dbtype = array_shift($aDsn);
643 if(isset($db_functions[$dbtype]) && function_exists($db_functions[$dbtype])) {
644 echo "$IND$dbtype database support present.<br />\n";
646 // now, test this interface:
648 $dbh = DB
::connect($dsn, true);
649 if (DB
::isError($dbh)) {
650 do_err('Database error: '. htmlspecialchars(DB
::errorMessage($dbh)) .
651 ' in ' .$type .' DSN.');
654 echo "$IND$type database connect successful.<br />\n";
657 do_err($dbtype.' database support not present!');
661 $db_error='Required PHP PEAR DB support is not available.'
662 .' Is PEAR installed and is the include path set correctly to find <tt>DB.php</tt>?'
663 .' The include path is now:<tt>' . ini_get('include_path') . '</tt>.';
667 echo $IND."not using database functionality.<br />\n";
671 echo "Checking LDAP functions...<br />\n";
672 if( empty($ldap_server) ) {
673 echo $IND."not using LDAP functionality.<br />\n";
675 if ( !function_exists('ldap_connect') ) {
676 do_err('Required LDAP support is not available.');
678 echo "$IND LDAP support present.<br />\n";
679 foreach ( $ldap_server as $param ) {
681 $linkid = @ldap_connect
($param['host'], (empty($param['port']) ?
389 : $param['port']) );
684 echo "$IND LDAP connect to ".$param['host']." successful: ".$linkid."<br />\n";
686 if ( !empty($param['protocol']) &&
687 !ldap_set_option($linkid, LDAP_OPT_PROTOCOL_VERSION
, $param['protocol']) ) {
688 do_err('Unable to set LDAP protocol');
691 if ( empty($param['binddn']) ) {
692 $bind = @ldap_bind
($linkid);
694 $bind = @ldap_bind
($param['binddn'], $param['bindpw']);
698 echo "$IND LDAP Bind Successful <br />";
700 do_err('Unable to Bind to LDAP Server');
703 @ldap_close
($linkid);
705 do_err('Connection to LDAP failed');
711 echo '<hr width="75%" align="center">';
712 echo '<h2 align="center">Summary</h2>';
713 $footer = '<hr width="75%" align="center">';
715 echo '<p>No fatal errors were found, but there was at least 1 warning. Please check the flagged issue(s) carefully, as correcting them may prevent erratic, undefined, or incorrect behavior (or flat out breakage).</p>';
719 <p
>Congratulations
, your SquirrelMail setup looks fine to me
!</p
>
721 <p
><a href
="login.php">Login now
</a
></p
>