How do I see SERVER Stats in php?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Deseree
Forum Commoner
Posts: 84
Joined: Mon Feb 13, 2006 11:35 pm

How do I see SERVER Stats in php?

Post by Deseree »

Hi,
I saw on some php sites they displayed some stats in php, like especially I'm talking about the 1,5,10,15 minute load variables and anything else that is handy, those are extremely important tho....

ty.
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Deseree
Forum Commoner
Posts: 84
Joined: Mon Feb 13, 2006 11:35 pm

Post by Deseree »

hah, but no. I don't believe that shows the server's load, does it?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

no.. and nothing built into php will. The information is pulled from calling various status commands to the operating system. I don't recall the particular commands offhand.
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

I remember that some control panels give this sort of info using their API service. Plesk has its Command Line Interface through which you can get info in php - but I dont know if you can get server load etc.
BTW, the reseller's control like WHM etc should allow you to get info via their API - again I've not really checked - but I've read it elsewhere.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

cPanel (if installed on your server) will show you server load stats, amongst others.

If you're on a shared host, to find out if you have it go to yourdomain.com/cpanel
If you're on a dedicated server and you have it installed... well then you should already know :P But I believe the default port is 2086, so yourdomain.com:2086
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

But I believe the default port is 2086, so yourdomain.com:2086
Port is 2082 but I think the OP was looking for a way to get the results via php in his code. Im not so sure but CPanel may have some APIs for this. I think WHM, DirectAdmin has API for these.
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Post by Dale »

2082 - cPanel
2086 - WHM
2095 - Mail

:)
Deseree
Forum Commoner
Posts: 84
Joined: Mon Feb 13, 2006 11:35 pm

Post by Deseree »

uhm, the idea behind this is a php load balancing script, not to run if the load is high.

So how would I get the load in a php script ? the exec() or system() command CAN BE USED in this case, this script will run at the root level.
phpkar
Forum Newbie
Posts: 4
Joined: Sat Feb 18, 2006 6:53 am
Contact:

Post by phpkar »

Deseree
Forum Commoner
Posts: 84
Joined: Mon Feb 13, 2006 11:35 pm

Post by Deseree »

rightous, much appreciated
Post Reply