Display Server Uptime Using PHP Script

June 30, 2009 by Mark  
Filed under Tips & Tricks

Start you favorite text editor and type the following text.

<?php system("uptime"); ?>

Now save the file as uptime.php and then upload the file to your server root directory. Once uploaded, open your internet browser and point it to the uptime.php by typing http://yourdomain.com/uptime.php. Change yourdomain.com with your own domain name. This script call the unix system command ‘uptime’ and display the result in html format so that it can be display on your internet browser. Below is the example result display by the script.

22:30:25 up 3 days, 17:02,  1 user,  load average: 0.00, 0.00, 0.00

The first column is the current time of the server (22:23:25), the server uptime is display on the second column (3 days 17 hours and 2 second) and currently the server has 1 user online, whereas the last column display the current load of the server.

Please note that this script is only work on unix compatible operating system only.

Comments

One Response to “Display Server Uptime Using PHP Script”

Trackbacks

Check out what others are saying about this post...
  1. [...] Read the rest here: Display server uptime using PHP script [...]



Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!