Cut and paste, save it into your root as whatever.php
Here it is:
Code: Select all
<?php require "./configuration.php";
// Automated fault finder v1.0
// author: Gayle
// date: February 25th, 2004, 09:26 PM
// minor edit: RainMan 11-06-04
// - added some layout
// Database connectivity tests
if (!function_exists( 'mysql_connect' )) {
$mysql_support = 0;
}else{
$mysql_support = 1;
if (!(@$mysql = mysql_connect( $mosConfig_host, $mosConfig_user, $mosConfig_password ))){
$mysql_login = 0;
}else{ $mysql_login = 1;
if (!mysql_select_db($mosConfig_db, $mysql)){
$mysql_select = 0;
$mysql_select_errno = mysql_errno($mysql);
$result=mysql_query("SHOW DATABASES", $mysql);
$databases=mysql_num_rows($result);
for ($i=0;$i<$databases;$i++){
$mysql_databases[$i]=mysql_result($result,$i,0);
}
}else{
$mysql_select = 1;
}
}
}
// Absolute path
$abpath = getcwd();
if($mosConfig_absolute_path!=$abpath)
$config_abpath = 0;
else $config_abpath = 1;
// Live site
$host = $_SERVER["HTTP_HOST"];
$path = pathinfo($_SERVER['PHP_SELF']);
$path = $path["dirname"];
if(strlen($path)==1)
$path = "";
$livesite = "http://".$host.$path;
if($mosConfig_live_site!=$livesite)
$config_livesite = 0;
else $config_livesite = 1;
// Spaces in configuration.php
$configfile = implode("", file("configuration.php"));
if(strlen($configfile)!=(strrpos($configfile, ">")+1))
$config_blank = 0;
else $config_blank = 1;
// FTP client filename mangling
if(!file_exists("administrator/includes/js/ThemeOffice")){
if(!file_exists("administrator/includes/js/themeoffice")){
$ftp_mangling = 0;
}else{
// No FTP mangling, still a potential problem though
$ftp_mangling = 1;
}
}else{
$ftp_mangling = 1;
}
// Output gathered data
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Automated fault finder v1.0</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<style type="text/css">
<!--
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
background-color: #CCCCCC;
}
h1 {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
font-style: bold;
}
th {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: bold;
}
/* PASSED */
h2 {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
font-style: bold;
color: green;
}
/* FAILED */
h3 {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
font-style: bold;
color: red;
}
-->
</style>
<body>
<h1>Automated fault finder v1.0</h1>
<hr />
<p>The script
MUST be in your Mambo root and you must have a configuration.php file. It's
kind of hard to diagnose problems without one.<br />
If you are having troubles with the automated installer then create your configuration.php by hand before running
the script.</p>
<p>Current faults it can diagnose are:</p>
<p>
*Incorrect live site<br />
*Incorrect absolute path<br />
*No PHP support for MySQL<br />
*Invalid MySQL username/host/password<br />
*Incorrect database name (suggests valid names)<br />
*Incorrect MySQL user privileges<br />
*Extra whitespace characters after ?> in configuration.php<br />
*Filenames mangled to lower case by FTP client
<br />
<br />
In all cases the script will advise you on what further action to take in an attempt to resolve the issue.</p>
<hr />
<br />
<table border="1">
<tr>
<th>Test</th>
<th>Result</th>
<th>Details</th>
</tr>
<tr>
<td>MySQL support in PHP</td>
<td>
<?php if($mysql_support==0)echo "<h3>Failed</h3>"; else echo "<h2>Passed</h2>";?>
</td>
<td>
<?php if($mysql_support==0) echo "If you are on a hosted webserver then please contact your host.<br/>" ."If you are hosting yourself on Windows then I suggest trying miniserver" ."as your PHP/MySQL/Apache solution. Download from " ."<a href=\"http://miniserver.sourceforge.net\">http://miniserver.sourceforge.net</a>.</br>" ."If you are self hosting on *nix then either recompile PHP with MySQL support or check" ."your distro docs on how to add it in using the provided packages.";?>
</td>
</tr>
<tr>
<td>MySQL login</td>
<td>
<?php if($mysql_login==0)echo "<h3>Failed</h3>"; else echo "<h2>Passed</h2>";?>
</td>
<td>
<?php if($mysql_login==0) echo "Access was refused.<br/>Check your database username/password in configuration.php.<br/>" ."Check that the user exists on your MySQL database and has the correct password." ."Check that the hostname is correct and not being blocked by a firewall.";?>
</td>
</tr>
<tr>
<td>MySQL database selection</td>
<td>
<?php if($mysql_select==0)echo "<h3>Failed</h3>"; else echo "<h2>Passed</h2>";?>
</td>
<td>
<?php if($mysql_select==0){ if($mysql_select_errno==1049){ echo "The database $mosConfig_db does not exist. Current valid databases " ."are listed below</br></br>"; foreach($mysql_databases as $row){ echo "$row<br/>"; } echo "<br/>If none of these is the database you wanted and you are " ."certain the database exists then make sure you have granted the correct " ."permissions to your user.<br/>" ."If the database does not exist then you must first create it."; } if($mysql_select_errno==1044){ echo "User $mosConfig_user does not appear to have the correct permissions granted " ."on database $mosConfig_db.<br/>Grant the user the appropriate privileges."; } }?>
</td>
</tr>
<tr>
<td>Absolute path</td>
<td>
<?php if($config_abpath==0)echo "<h3>Failed</h3>"; else echo "<h2>Passed</h2>";?>
</td>
<td>
<?php if($config_abpath==0) echo "Your absolute path appears to be wrong in configuration.php. Please " ."change it to the following.<br/></br>\$mosConfig_absolute_path = '$abpath';";?>
</td>
</tr>
<tr>
<td>Live site</td>
<td>
<?php if($config_livesite==0)echo "<h3>Failed</h3>"; else echo "<h2>Passed</h2>";?>
</td>
<td>
<?php if($config_livesite==0) echo "Your live site appears to be wrong in configuration.php. Please " ."change it to the following.<br/></br>\$mosConfig_live_site = '$livesite';";?>
</td>
</tr>
<tr>
<td>Extra characters in configuration.php</td>
<td>
<?php if($config_blank==0)echo "<h3>Failed</h3>"; else echo "<h2>Passed</h2>";?>
</td>
<td>
<?php if($config_blank==0) echo "Your configuration.php seems to have characters after the final closing >.<br/>" ."This is not allowed and will cause errors with session handling. Remove everything</br> " ."after the final >.</br>" ."Do not use the cpanel text editor, it hasd a known bug that inserts blank lines at " ."the end of the file.";?>
</td>
</tr>
<tr>
<td>FTP client mangled filenames</td>
<td>
<?php if($ftp_mangling==0)echo "<h3>Failed</h3>"; else echo "<h2>Passed</h2>";?>
</td>
<td>
<?php if($ftp_mangling==0) echo "Files that should be contain upper case characters appear to be all in lower case.<br/>" ."Please ensure your FTP client is not set to convert all filenames to lower case and reupload Mambo.";?>
</td>
</tr>
</table>
<p>made by <a href="http://forum.mamboserver.com/member.php?userid=385">Gayle</a>, February 25th, 2004, 09:26 PM</p>
</body>
</html>