You surely all know this:
Your website is taking ages to load, the server doesn´t respond at all and your browser tells you that your site cannot be reached. This often, if not always, indicated a problem with the serverload that went through the roof. Not many free hosting services allow you to check server load so it might be a bit hard to tell if the problem is down to the server or if there is a problem with your script.
I can help you with the serverload thing. All you need to do to display the current serverload is create a PHP file (name it whatever you want, for example load.php) and copy this bit of code in it, then save it and upload it to your server:
PHP Code:
<?php
header("Content-Type: application/rss+xml");
echo('<?xml version="1.0" encoding="ISO-8859-1"?>');
$MJ_LINK='http://'.$_SERVER['HTTP_HOST'].$_SERVER["PHP_SELF"];
?>
<rss version="2.0">
<channel>
<title><?php echo $_SERVER['HTTP_HOST']; ?> Server Load</title>
<link><?php echo $MJ_LINK ?></link>
<description>Server Load by <a href="http://www.outlaw-forum.info">Bad Karma[CORE]</a></description>
<pubDate><?php echo date("r"); ?></pubDate>
<?php
if (function_exists('sys_getloadavg')) {
$loadArray = sys_getloadavg();
$load= "Load: ".$loadArray[0]."/".$loadArray[1]."/".$loadArray[2];
} else {
$load=@file_get_contents('/proc/loadavg');
}
if(!$load) {
$load= 'Sorry, no load average available for your server';
$info = 'PHP >= 5.1.3 or access to /proc/loadavg is required.';
} ?>
<item>
<title><?php echo $load;?></title>
<description><![CDATA[<?php echo $info;?>]]></description>
<pubDate><?php echo date("r"); ?></pubDate>
<link><?php echo $MJ_LINK ?></link>
<guid><?php echo $_SERVER['REQUEST_URI']; ?></guid>
</item>
</channel>
</rss>
This will display the current serverload and help to determine whether the problem is with your website or the server. Just upload the file and call it in your browser by opening
Code:
http://www.yourdomain.com/load.php
A live example of it can be seen at
badkarma.000webhost.com Server Load