a_bertrand Posted February 4, 2009 Posted February 4, 2009 A little script to get the HDD activity and memory / cpu usage. I used popen but you may use other functions as well. <?PHP echo "<PRE>\n"; echo "[b]IO STATS[/b]\n"; $handle=popen("/usr/bin/iostat -k sda 1 2","r"); fread($handle,16000); $lines=explode("\n",fread($handle,16000)); array_shift($lines); array_shift($lines); array_shift($lines); echo implode("\n",$lines); pclose($handle); echo "[b]Top[/b]\n"; $handle=popen("/usr/bin/top -b -n 1","r"); echo fread($handle,16000); pclose($handle); echo "</PRE>\n"; ?> Quote
Lithium Posted February 4, 2009 Posted February 4, 2009 Re: Monitor your server from PHP Only *nix systems apply here though ;) Quote
a_bertrand Posted February 4, 2009 Author Posted February 4, 2009 Re: Monitor your server from PHP Honestly you would run your PHP scripts on a windows server? Would be a non-sense... I would run on a windows server only for ASPX applications (with IIS) but certainly not for a PHP installation. I do use PHP on windows but only for the development ;) Why? Well simply check the memory usage of your server with just the OS loaded, and tell me which of a Linux box or a Windows box use less memory, add to that cron and ssh and you know why I use Linux as servers. Quote
Jeff Posted February 4, 2009 Posted February 4, 2009 Re: Monitor your server from PHP Nice little tip, thanks for sharing Quote
Lithium Posted February 4, 2009 Posted February 4, 2009 Re: Monitor your server from PHP a_bertrand: true enough, but then again there is still people that often use windows hosting instead ;) Quote
Tonka Posted February 4, 2009 Posted February 4, 2009 Re: Monitor your server from PHP Very nice a_bertrand Quote
yuriorlov Posted February 5, 2009 Posted February 5, 2009 Re: Monitor your server from PHP Honestly you would run your PHP scripts on a windows server? Would be a non-sense... I would run on a windows server only for ASPX applications (with IIS) but certainly not for a PHP installation. I do use PHP on windows but only for the development ;) Why? Well simply check the memory usage of your server with just the OS loaded, and tell me which of a Linux box or a Windows box use less memory, add to that cron and ssh and you know why I use Linux as servers. I'll give you a few reasons: 1.) GUI 2.) Compatibility with some nifty backend things you dont / cant get with unix / linux 3.) Memory is cheap 2gb DDR2 sticks are like $20 Quote
a_bertrand Posted February 5, 2009 Author Posted February 5, 2009 Re: Monitor your server from PHP - Remote GUI is not good due to his slowness, unless you are in the same network. - Compatibility with some back-ends, then yes, but I rarely saw a back-end which doesn't offer yet web services. - Server memory is never cheap, specially if you need to rent your dedicated server. Quote
Lithium Posted February 5, 2009 Posted February 5, 2009 Re: Monitor your server from PHP Honestly you would run your PHP scripts on a windows server? Would be a non-sense... I would run on a windows server only for ASPX applications (with IIS) but certainly not for a PHP installation. I do use PHP on windows but only for the development ;) Why? Well simply check the memory usage of your server with just the OS loaded, and tell me which of a Linux box or a Windows box use less memory, add to that cron and ssh and you know why I use Linux as servers. I'll give you a few reasons: 1.) GUI 2.) Compatibility with some nifty backend things you dont / cant get with unix / linux 3.) Memory is cheap 2gb DDR2 sticks are like $20 GUI, let's see... windows windows windows... (for Windows) Xwindows, gnome, kde, and that tiny awesome fluxbox, among a few dozen more (for *nix). Backend things you can't do with *nix flavours? name a couple... Memory cheap... well as a_bertrand stated... Server memory is not cheap. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.