home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / dotproject / docs / check.php next >
PHP Script  |  2004-01-08  |  5KB  |  126 lines

  1. <?php /* $Id: check.php,v 1.6 2004/01/08 04:43:29 ajdonnison Exp $ */ ?>
  2. <html>
  3. <head>
  4.     <title>dotProject Roadmap</title>
  5.     <meta name="Generator" content="EditPlus">
  6.     <meta name="Author" content="Andrew Eddie">
  7.     <meta name="Description" content="Troubleshooting dotProject">
  8.  
  9.     <link rel="stylesheet" type="text/css" href="./main.css">
  10. </head>
  11. <body>
  12. <h1>dotProject System Checks</h1>
  13.  
  14. <table cellspacing="0" cellpadding="4" border="1" class="tbl" width="100%">
  15. <?php
  16. error_reporting( E_ALL );
  17.  
  18. require "../includes/config.php";
  19.  
  20. if ($dbok = function_exists( 'mysql_pconnect' )) {
  21.     echo "<tr><td>MySQL</td><td>Available</td><td>OK</td></tr>";
  22.     echo "<tr><td>MySQL Server Version</td><td>" . mysql_get_server_info() . "</td></tr>";
  23.  
  24.     $host = $dPconfig['dbhost'];
  25.     $port = 3306;
  26.     $user = $dPconfig['dbuser'];
  27.     $passwd = $dPconfig['dbpass'];
  28.     $dbname = $dPconfig['dbname'];
  29.  
  30.     if (mysql_pconnect( "$host:$port", $user, $passwd )) {
  31.         echo "<tr><td>MySQL Database Connection</td><td>Connected</td><td>OK</td></tr>";
  32.  
  33.         if ($dbname) {
  34.             if (mysql_select_db( $dbname )) {
  35.                 echo "<tr><td>MySQL Database Select</td><td>Selected</td><td>OK</td></tr>";
  36.             } else {
  37.                 echo "<tr><td>MySQL Database Select</td><td class=error>Failed</td><td class=error>Fatal: could not connect to $dbname</td></tr>";
  38.             }
  39.         } else {
  40.             echo "<tr><td>MySQL Database Select</td><td class=error>Failed</td><td class=error>Fatal: no database name supplied</td></tr>";
  41.         }
  42.     } else {
  43.         echo "<tr><td>MySQL Database Connection</td><td class=error>Failed</td><td class=error>Fatal: Check host, username and password</td></tr>";
  44.     }
  45. } else {
  46.     echo "<tr><td>MySQL</td><td>Not Available</td><td>Fatal: Check MySQL support is compiled with PHP</td></tr>";
  47. }
  48.  
  49. echo "<tr><td>Operating System</td><td>".php_uname()."</td></tr>";
  50.  
  51. $msg = phpversion() < '4.1' ? "<td class=error>To old, upgrade</td>" : "<td>OK</td>";
  52. echo "<tr><td>PHP Version</td><td>".phpversion()."</td>$msg</tr>";
  53.  
  54. $sapi = php_sapi_name();
  55. echo "<tr><td>Server API</td><td>$sapi</td>";
  56. if ($sapi == "cgi") {
  57.   echo "<td class=error>CGI mode is likely to have problems</td></tr>";
  58. } else {
  59.   echo "</tr>";
  60. }
  61. echo "<tr><td>Web Server</td><td>$_SERVER[SERVER_SOFTWARE]</td></tr>";
  62.  
  63. echo "<tr><td>User Agent</td><td>".$_SERVER['HTTP_USER_AGENT']."</td></tr>";
  64.  
  65. echo "<tr><td>default locale</td><td>";
  66. $lc_list = explode(";", setlocale( LC_ALL, 0 ));
  67. foreach ($lc_list as $lc) {
  68.   echo "$lc<br>";
  69. }
  70. echo "</td></tr>";
  71.  
  72. $msg = get_cfg_var( 'session.auto_start' ) > 0 ? "<td class=warning>Try setting to 0 if you are having problems with WSOD</td>" : "<td>OK</td>";
  73. echo "<tr><td>session.auto_start</td><td>".get_cfg_var( 'session.auto_start' )."</td>$msg</tr>";
  74.  
  75. echo "<tr><td>session.save_handler</td><td>".get_cfg_var( 'session.save_handler' )."</td></tr>";
  76.  
  77. $msg = is_dir( get_cfg_var( 'session.save_path' ) ) ? "<td>OK</td>" : "<td class=error>Fatal: Save path does not exist</td>";
  78. echo "<tr><td>session.save_path</td><td>".get_cfg_var( 'session.save_path' )."</td>$msg</tr>";
  79.  
  80. echo "<tr><td>session.serialize_handler</td><td>".get_cfg_var( 'session.serialize_handler' )."</td></tr>";
  81.  
  82. $cookies = intval( get_cfg_var( 'session.use_cookies' ) );
  83. $msg = $cookies ? "<td>OK</td>" : "<td class=warning>Try setting to 0 if you are having problems logging in</td>";
  84. echo "<tr><td>session.use_cookies</td><td>$cookies</td>$msg</tr>";
  85.  
  86. $sid = intval( get_cfg_var( 'session.use_trans_sid' ) );
  87. $msg = $sid ? "<td class=warning>There are security risks with this turned on</td>" : "<td>OK</td>";
  88. echo "<tr><td>session.use_trans_sid</td><td>$sid</td>$msg</tr>";
  89.  
  90. $fup = get_cfg_var( 'file_uploads' );
  91. $msg = $fup ? "<td>OK</td>" : "<td class=warning>You won't be able to upload files</td>";
  92. echo "<tr><td>file_uploads</td><td>$fup</td>$msg</tr>";
  93.  
  94. $iw = is_writable( "{$dPconfig['root_dir']}/locales/en" );
  95. $msg = $iw ? '<td>OK</td>' : '<td class=warning>Warning: you will not be able to save translation files.  Check the directory permissions.</td>';
  96. echo "<tr><td>/locales/en directory writable</td><td>$iw</td>$msg</tr>";
  97.  
  98. $iw = is_writable( "{$dPconfig['root_dir']}/files" );
  99. $msg = $iw ? '<td>OK</td>' : '<td class=warning>Warning: you will not be able to upload files.  Check the directory permissions.</td>';
  100.  
  101. echo "<tr><td>/files directory writable</td><td>$iw</td>$msg</tr>";
  102.  
  103. $iw = is_writable( "{$dPconfig['root_dir']}/files/temp" );
  104. $msg = $iw ? '<td>OK</td>' : '<td class=warning>Warning: you will not be able to make PDF\'s.  Check the directory permissions.</td>';
  105.  
  106. echo "<tr><td>/files/temp directory writable</td><td>$iw</td>$msg</tr>";
  107.  
  108. // Now check to see if the supplied root_dir is the same as the called URL.
  109. $url = preg_replace('/\/docs\/.*$/', '', $_SERVER['PATH_TRANSLATED']);
  110. echo "<tr><td>root_dir</td><td>$dPconfig[root_dir]</td>";
  111. if ($url != $dPconfig['root_dir']) {
  112.   echo "<td class=error>root_dir seems to be incorrect, probably should be $url</td></tr>";
  113. } else {
  114.   echo "<td>OK</td></tr>";
  115. }
  116.  
  117. echo "</table>";
  118.  
  119.  
  120.  
  121.  
  122. ?>
  123. </table>
  124. <body>
  125. </html>
  126.