Jump to content

Determine Server Uptime?


random1

Recommended Posts

I have the following function:

 

public function serverUptime()
{
	$uptime = shell_exec("cut -d. -f1 /proc/uptime");
	$days = floor($uptime/60/60/24);
	$hours = $uptime/60/60%24;
	$mins = $uptime/60%60;
	$secs = $uptime%60;
	return "This server is up $days days $hours hours $mins minutes and $secs seconds";
}

 

This is not working on my Windows machine. I think the above is for unix based servers. What's the Windows equivilent of 'cut'?

 

P.S I get:

 

'cut' is not recognized as an internal or external command,

operable program or batch file.

 

in the Apache error log.

Link to comment
https://forums.phpfreaks.com/topic/112904-determine-server-uptime/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.