It is currently Sat Jul 04, 2009 7:03 am (All times are UTC )

 





Post new topic Reply to topic  [ 5 posts ] 
Author Message
Posted: Fri Aug 19, 2005 2:36 pm 
User avatar
Joomla! Master
Joomla! Master
Offline

Joined: Thu Aug 18, 2005 8:55 pm
Posts: 12576
Location: Nijmegen, The Netherlands
The following script was posted in the 'other forum' ( http://forum.mamboserver.com/showthread.php?p=76466 ) and has been very helpfull for me. I suggest integrating some sort of fault finder script within the installation procedure of the new CMS


Cut and paste, save it into your root as whatever.php
Here it is:
Code:
<?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 ?&gt; 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>

_________________
Kind Regards,
Peter Martin
http://www.db8.nl - Joomla specialist from Nijmegen, Nederland
http://twitter.com/pe7er


Top
   
 
Posted: Mon Jul 03, 2006 9:47 am 
User avatar
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Sat Jul 01, 2006 7:32 pm
Posts: 13
Location: Dordt
Waar Moest je dit script plaatsen want ik krijg een error als ik hem in de wwwroot map doe

_________________
Luke, I am your Brother. T.ho M.as


Top
   
 
Posted: Mon Jul 03, 2006 11:09 am 
User avatar
Joomla! Master
Joomla! Master
Offline

Joined: Thu Aug 18, 2005 8:55 pm
Posts: 12576
Location: Nijmegen, The Netherlands
SomeBodyNew wrote:
Waar Moest je dit script plaatsen want ik krijg een error als ik hem in de wwwroot map doe

You are currently in the International section, please use English.


Dit bericht staat in het Internationale gedeelte, gebruik hier svp Engels.

Als je het script in dezelfde map zet als je configuration.php van Joomla, dan zou het moeten werken...

_________________
Kind Regards,
Peter Martin
http://www.db8.nl - Joomla specialist from Nijmegen, Nederland
http://twitter.com/pe7er


Top
   
 
Posted: Fri Sep 22, 2006 11:07 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Aug 31, 2006 8:21 pm
Posts: 5
this is awesome
thank you,

migchao1967
at
hotmail


Top
   
 
Posted: Tue Nov 06, 2007 9:25 am 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Sun Nov 04, 2007 4:51 pm
Posts: 2
You've just saved me so much time!

Many Thanks!!


Top
  E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

Quick reply

 



Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group