Web Hosting Talk







View Full Version : Load average script


volumeserver
05-17-2002, 09:32 AM
Does anyone know the coding i need to get the page load time?

If you need anymore info please let me know

I hope this is the right forum for this i didnt know what cat. to put this request in

Thanks

Avail
05-17-2002, 03:27 PM
This is untested, but it should work. Save it as a .pl or .cgi script and chmod to 755.


#!/usr/bin/perl

print `uptime`;

AhmedF
05-17-2002, 04:30 PM
or in PHP

<?

echo 'uptime';

?>

:D

volumeserver
05-17-2002, 05:03 PM
Thanks for both of them but i could not get either to work

For server uptime the correct script is

<?
echo shell_exec(uptime);
?>

Shyne
05-17-2002, 05:23 PM
Why? Which and what didn't work? Errors? Be spcific.

There reall is no point of running the perl program because you can just execute that command in shell.

#!/usr/bin/perl

print `uptime`;

volumeserver
05-17-2002, 05:26 PM
500 error is what i get

i need the code so when some opens one of my pages i can put on the bottom

"This page loaded in (EXAMPLE TIME)"

See what i mean

magnafix
05-17-2002, 05:36 PM
This may help:

http://www.php.net/manual/en/function.microtime.php

Avail
05-17-2002, 09:13 PM
Originally posted by volumeserver
500 error is what i get

i need the code so when some opens one of my pages i can put on the bottom

"This page loaded in (EXAMPLE TIME)"

See what i mean

The reason you're getting a 500 error is because you're not printing out HTTP headers.


But I read your inital request incorrectly, I thought you said load average, not load time. Two very different things.

AhmedF
05-18-2002, 01:00 AM
Oops

my mistake

You are suppoused to use ` [backwards quotes ... the key with the tilde] .... this is the same as 'shelling' a program

Therefore

echo `uptime`;

Not

echo 'uptime';

:D

volumeserver
05-18-2002, 07:44 PM
This is what i need

<?php
$shorten = microtime();
print ("Search took ", number_format($shorten,3)");
print (" seconds.");
?>

When i try to run it i get an errorin this line

print ("Search took ", number_format($shorten,3)");

Can you see the error, i cant

xerocity.com
05-18-2002, 07:51 PM
Originally posted by volumeserver
This is what i need

<?php
$shorten = microtime();
print ("Search took ", number_format($shorten,3)");
print (" seconds.");
?>

When i try to run it i get an errorin this line

print ("Search took ", number_format($shorten,3)");

Can you see the error, i cant

Try this:


<?php
$shorten = microtime();
print ("Search took ");
print number_format($shorten,3);
print (" seconds.");
?>

volumeserver
05-18-2002, 08:00 PM
That works GREAT

EVERYONE GO TO MY HOMEPAGE AND ALL OF THE WAY ON THE BOTTOM YOU WILL SEE A LINK FOR CREDITS CLICK IT IF YOU HAVE HELPED ME IN SOME WAY AND WANT TO BE ADDED LET ME KNOW I WILL ADD YOU ASAP


and of course i HAVE addED WHT since if it wasnt for you guys i would not get any help

Thanks

apollo
05-19-2002, 03:17 AM
I would like to know the experience running that script on the Windows platform :=)

Angel78
05-19-2002, 07:26 AM
http://*************.com/credits.php

Exampale
Example?