PHP Probe (view server details)

Source: Internet
Author: User
Tags arithmetic explode mysql tutorial sqlite database sybase database trim zend oracle database

/

The code is as follows Copy Code

* First, this procedure is based on DIV+CSS tutorial new architecture PHP probe, free open source free software, powerful, clear structure, easy to use.


1. Support Windows,linux,unix,freebsd,sun Solar System


2. Support Ie6,ie7,firefox,google Chrome and other browsers.





Second, the main purpose and applicable objects:


1. The amateur and professional developer who are familiar with PHP programming.


2. The computer room management personnel configures the Linux (Windows) +php+mysql Tutorial +zend system environment, detects whether the system configures successfully.


3. For users who purchase a virtual host, test server performance.


^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


*/


The following two variables can be modified for compounding


If you are using this probe for verification, you can enter the relevant information in the variable below (it will appear at the bottom of the page


Header ("content-type:text/html; Charset=utf-8 ");


Error_reporting (e_error | e_warning | e_parse);


Ob_start ();





$valint = (False = = Empty ($_post[' pint '))? $_post[' Pint ']: "Not tested";


$valfloat = (False = = Empty ($_post[' pfloat '))? $_post[' Pfloat ']: "Not tested";


$valio = (False = = Empty ($_post[' Pio '))? $_post[' Pio ': "Not tested";


$mysqlreshow = "None";


$mailreshow = "None";


$funreshow = "None";


$opreshow = "None";


$sysreshow = "None";


============ defines constants for replacing template output variables =======================


Define ("Yes", "<span class= ' Resyes ' >yes</span>");


Define ("No", "<span class= ' Resno ' >no</span>");


Define ("Yes", "<span class= ' Resyes ' >√</span>");


Define ("No", "<span class= ' Resno ' >x</span>");

//=================================================================


Define ("icon", "<span class= ' icon ' >2</span> ");


$phps Tutorial Elf = $_server[php_self]? $_server[php_self]: $_server[script_name];


Define ("Phpself", Preg_replace ("/(. { 0,}?/+)/"," ", $phpself));





if ($_get[' act '] = = "Phpinfo")


{


Phpinfo ();


Exit ();


}


ElseIf ($_post[' act ') = = "Integral type test")


{


$valint = Test_int ();


}


ElseIf ($_post[' act ' = = "float test")


{


$valfloat = Test_float ();


}


ElseIf ($_post[' act ' = = "io Test")


{


$valio = Test_io ();


}


ElseIf ($_post[' act ' = = "Connect")


{


$mysqlreshow = "show";


$mysqlre = "MySQL connection test result:";


$mysqlre. = (False!== @mysql_connect ($_post[' mysqlhost '], $_post[' Mysqluser '], $_post[' Mysqlpassword '))? " MySQL server connection is normal, ":" MySQL server connection failed, ";


$mysqlre. = "Database Tutorials <b>". $_post[' MySQLdb ']. " </b> ";


$mysqlre. = (False!= @mysql_select_db ($_post[' mysqldb '))? " Connect normally ": Connection Failed";


}


ElseIf ($_post[' act ') = = "SendMail")


{


$mailreshow = "show";


$mailre = "mail message sends test result: send";


$mailre. = (False!== @mail ($_post["Mailreceiver"], "Uenuprobe Mail server Test.", "This email is sent by Uenuprobe." Copyright uenucom http://www.uenu.com ")"? " Complete ":" Failure ";


}


ElseIf ($_post[' act ') = = "Function_check")


{


$funreshow = "show";


$funre = "function <b>". $_post[' Funname ']. " </b> Support Status Test results: ". Isfun ($_post[' funname '));


}


ElseIf ($_post[' act ') = = "Configuration_check")


{


$opreshow = "show";


$opre = "Configuration Parameters <b>". $_post[' Opname ']. " </b> test results: ". Getcon ($_post[' opname '));


}





//========================================================================

//========================================================================


Switch (PHP_OS)


{


Case "Linux":


$sysreshow = (False!= ($sysinfo = Sys_linux ()))? " Show ": none";


Break


Case "FreeBSD":


$sysreshow = (False!= ($sysinfo = Sys_freebsd ()))? " Show ": none";


Break


Case "Windows":


$sysreshow = (False!= ($sysinfo = Sys_windows ()))? " Show ": none";


$sysinfo [' uptime '] = "Sorry windows system does not support";


Break


Default


Break


}





//========================================================================

?>


<!doctype HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/ Xhtml1-transitional.dtd ">


<html xmlns= "http://www.w3.org/1999/xhtml" >


<head>


<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>


<link type= "Text/css" rel= "stylesheet" href= "Common/control.css" >


<script type= "text/web Effects" language= "JavaScript" src= "Common/admin.otable.js" ></script>


<script type= "Text/javascript" language= "JavaScript" src= "Common/include.func.js" ></script>


<title> Server Information </title>


<style type= "Text/css" >


. resyes {


font-size:12px;


Color: #090;


Font-weight:bold;


Font-family:verdana;


}


. resno {


font-size:12px;


Color: #f00;


Font-weight:bold;


Font-family:verdana;


}


. check00{


Color: #630;


}


</style>


<script type= "Text/javascript" >


Window.onload=function () {


var Otable=document.getelementbyid ("otable");


for (Var i=0;i<otable.rows.length;i++) {


if (i%2==0)//even rows


Otable.rows[i].classname= "Altrow";


}





var Otable2=document.getelementbyid ("Otable2");


for (Var i=0;i<otable2.rows.length;i++) {


if (i%2==0)//even rows


Otable2.rows[i].classname= "Altrow";


}





var Otable3=document.getelementbyid ("Otable3");


for (Var i=0;i<otable3.rows.length;i++) {


if (i%2==0)//even rows


Otable3.rows[i].classname= "Altrow";


}





var Otable4=document.getelementbyid ("Otable4");


for (Var i=0;i<otable4.rows.length;i++) {


if (i%2==0)//even rows


Otable4.rows[i].classname= "Altrow";


}





var Otable5=document.getelementbyid ("Otable5");


for (Var i=0;i<otable5.rows.length;i++) {


if (i%2==0)//even rows


Otable5.rows[i].classname= "Altrow";


}


}


</script>


</head>

<body class= "Contentbody" >
<div class= "Maindiv" >
<span class= "Ctitle" > Server information </span>
<ul class= "CMenu" >
<li><a href= "server_info.php?action=" > Server features </a></li>
<li><a href= The basic characteristics of "server_info.php?action=phpinfo" >php </a></li>
<li><a href= "Server_info.php?action=otherinfo" >php component support status </a></li>
<li><a href= "Server_info.php?action=dbinfo" > Database support Status </a></li>
<li><a href= "Server_info.php?action=testinfo" > Performance Testing </a></li>
<li><a href= "server_moreinfo.php" > Server details </a></li>
</ul>

&lt;div class= "Concontent" &gt;


&lt;?php


Switch ($_get[' action ']) {


Case ':


?&gt;


&lt;table cellpadding= "0" cellspacing= "0" border= "0" width= "100%" class= "CTable" id= "otable" align= "Center" &gt;


&lt;tr&gt;


&lt;th colspan= "2" align= "Center" &gt; Server features &lt;/th&gt;


&lt;/tr&gt;


&lt;tr&gt;


&LT;TD width= &gt; Server Time &lt;/td&gt;


&lt;td&gt;&lt;?php echo gmdate ("Y-year m-month D-Day H:i:s", Time ());? &gt;&amp;nbsp; (Greenwich Mean Time) &amp;nbsp;&amp;nbsp;&lt;?php echo gmdate ("Y-year N-month J-day H:i:s", Time () +8*3600)?&gt;&amp;nbsp; ( Beijing time) &lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt; Server domain &lt;/td&gt;


&lt;td&gt;&lt;?php Echo ("&lt;a href=" Http://$_server[server_name] "title= Access this domain name Target=_blank&gt;$_server[server_ Name]&lt;/a&gt; ");?&gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt; Server IP Address &lt;/td&gt;


&lt;td&gt;&lt;?php $host _ip=gethostbyname ($_server["SERVER_NAME"]); Echo ($host _ip);? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt; server operating System &lt;/td&gt;


&lt;td&gt;&lt;?php $os = Explode ("", Php_uname ()); echo $os [0]; echo "&amp;nbsp;&amp;nbsp;";


if ($os [0] = = "Windows" {echo "host name:". $os [2];} else {echo "kernel version:". $os [2];}? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt; Server Run Time &lt;/td&gt;


&lt;td&gt;&lt;?php if ($sysinfo [' Uptime ']!= ") {echo $sysinfo [' uptime '];} else echo" Sorry Windows does not support ";? &gt;&lt;/td &gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt; server operating system text encoding &lt;/td&gt;


&lt;td&gt;&lt;?php Echo ($_server["http_accept_language"]);?&gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt; Server Interpreter engine &lt;/td&gt;


&lt;td&gt;&lt;?php Echo ($_server["Server_software"]);?&gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt;web Service Port &lt;/td&gt;


&lt;td&gt;&lt;?php Echo ($_server["Server_port"]);?&gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt; server Administrator &lt;/td&gt;


&lt;td&gt;&lt;a href= "mailto:&lt;?php echo $_server[' server_admin '";? &gt; "&gt;&lt;?php echo $_server[' server_admin '];? &gt;&lt;/a&gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt; This file path &lt;/td&gt;


&lt;td&gt;&lt;?php Echo ($_server["Script_filename"]);? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt; service-Side remaining space &lt;/td&gt;


&lt;td&gt;&lt;?php Echo intval (Diskfreespace (".")/(1024 * 1024)). ' MB ';? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt; System Current User name &lt;/td&gt;


&lt;td&gt;&lt;?php echo @get_current_user ();? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;/table&gt;


&lt;br/&gt;


&lt;!--output--&gt; only in Windows environment


&lt;?php if (("Show"!== $sysreshow) &amp; ("0"!= $_env["Number_of_processors"]) &amp; ("!= $_env[" number_of_processors "]) {?&gt;


&lt;div class= "Info3" &gt; Server processor &lt;/div&gt;&lt;div class= "Info4" &gt;cpu number: &lt;?php echo $_env["Number_of_ Processors "]?&gt; &lt;?php echo" &amp;nbsp;&amp;nbsp;. $_env["Processor_identifier"]; echo "&amp;nbsp;&amp;nbsp; Run Level:". $_env["Processor_level"]; echo "&amp;nbsp;&amp;nbsp; version:". $_env["Processor_revision"];? &gt;&lt;/div&gt;


&lt;?php}?&gt;


&lt;!--output end--&gt; only in Windows environment


&lt;!--Linux or UNIX parameter output--&gt;


&lt;?php if ("show" = = $sysreshow) &amp; ("0"!= $sysinfo [' CPU '] [' num ']) &amp; (""!= $sysinfo [' CPU '] [' num ']) {?&gt;


&lt;div class= "Info3" &gt; Server processor &lt;/div&gt;&lt;div class= "Info4" &gt;cpu number: &lt;?php echo $sysinfo [' CPU '] [' num ']? &gt; &amp;nbsp;&amp;nbsp;&lt;?php echo $sysinfo [' CPU '] [' detail ']?&gt;&lt;/div&gt;


&lt;?php}?&gt;


&lt;?php if ("show" = = $sysreshow) {?&gt;


&lt;div class= "Info3" &gt; Memory usage &lt;/div&gt;&lt;div class= "Info4" &gt;


&lt;?php echo $sysinfo [' Memtotal ']?&gt;m, already in use


&lt;?php echo $sysinfo [' memused ']?&gt;m, idle


&lt;?php echo $sysinfo [' Memfree ']?&gt;m, usage


&lt;?php echo $sysinfo [' Mempercent ']?&gt;%&lt;/div&gt;


&lt;div class= "Info3" &gt;swap District &lt;/div&gt;&lt;div class= "Info4" &gt;


Total &lt;?php echo $sysinfo [' swaptotal ']?&gt;m, used


&lt;?php echo $sysinfo [' swapused ']?&gt;m, idle


&lt;?php echo $sysinfo [' Swapfree ']?&gt;m, usage


&lt;?php echo $sysinfo [' Swappercent ']?&gt;%&lt;/div&gt;


&lt;div class= "Info3" &gt; System average Load &lt;/div&gt;&lt;div class= "Info4" &gt;&lt;?php echo $sysinfo [' Loadavg ']?&gt;&lt;/div &gt;


&lt;?php}?&gt;


&lt;!--Linux or UNIX parameter output end--&gt;


&lt;?php


Break


Case ' phpinfo ':


?&gt;


&lt;table cellpadding= "0" cellspacing= "0" border= "0" width= "100%" class= "CTable" id= "otable" align= "Center" &gt;


&lt;tr&gt;


&lt;th colspan= "4" align= "Center" &gt;php Basic features &lt;/th&gt;


&lt;/tr&gt;


&lt;tr&gt;


&LT;TD width= "30%" &gt;php version &lt;/td&gt;


&LT;TD width= "20%" &gt;&lt;?php echo php_version;? &gt;&lt;/td&gt;


&LT;TD width= "30%" &gt;php operation mode &lt;/td&gt;


&lt;td&gt;&lt;?php/**strtoupper (Php_sapi_name ()); **/Echo Ucwords (Php_sapi_name ()); &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt; support Zend Compile run &amp;nbsp;&amp;nbsp; (&lt;?php if ($zend = "yes") {echo "version:"; echo zend_version ();}? &gt;) &lt;/td&gt;


&lt;td&gt;&lt;?php echo $zend = (Get_cfg_var ("Zend_optimizer.optimization_level") | | Get_cfg_var ("Zend_extension_manager.optimizer_ts") | | Get_cfg_var ("Zend_extension_ts"))?yes:no?&gt;&lt;/td&gt;


&lt;td&gt; run in Safe mode &lt;/td&gt;


&lt;td&gt;&lt;?php if (Get_cfg_var ("SafeMode")) {echo ("yes");} else echo ("no");?&gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt; automatically define global variables &amp;nbsp;register_globals&lt;/td&gt;


&lt;td&gt;&lt;?php Echo @get_cfg_var ("Register_globals")? On ': ' Off ';? &gt;&lt;/td&gt;


&lt;td&gt; allow files to be opened using URLs allow_url_fopen&lt;/td&gt;


&lt;td&gt;&lt;?php Echo Get_cfg_var ("allow_url_fopen") = = "1"?yes:no?&gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt; allow dynamically loaded link libraries enable_dl&lt;/td&gt;


&lt;td&gt;&lt;?php Echo Get_cfg_var ("enable_dl") = = "1"?yes:no?&gt;&lt;/td&gt;


&lt;td&gt; Display error Messages &amp;nbsp;display_errors&lt;/td&gt;


&lt;td&gt;&lt;?php Echo Get_cfg_var ("display_errors") = = "1"?yes:no?&gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt; short Mark &amp;lt;? ?&amp;gt; Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo @get_cfg_var ("Short_open_tag")? Yes:no;? &gt;&lt;/td&gt;


&lt;td&gt; Mark &amp;lt;%%&amp;gt; support &lt;/td&gt;


&lt;td&gt;&lt;?php echo @get_cfg_var ("ASP tutorial _tags")? Yes:no &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt;cookie Support &lt;/td&gt;


&lt;td&gt;&lt;?php echo isset ($http _cookie_vars)? yes:no &gt;&lt;/td&gt;


&lt;td&gt;session Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (session_start) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt; floating-point operations effective digital display digits &lt;/td&gt;


&lt;td&gt;&lt;?php echo @get_cfg_var ("precision");? &gt;&lt;/td&gt;


&lt;td&gt; Forced Y2K compatibility &lt;/td&gt;


&lt;td&gt;&lt;?php Echo @get_cfg_var ("Y2k_compliance")? Yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt; disabled Functions disable_functions&lt;/td&gt;


&lt;td&gt;&lt;?php $disused = @get_cfg_var ("Disable_functions")? 1 ":" 0 ";


if ($disused = = "1")


{echo ' &lt;a href= "#" title= "


'. @get_cfg_var ("Disable_functions"). '


"&gt;". More ". ' &lt;/a&gt; ';}


else {echo ' none ';}? &gt;&lt;/td&gt;


The longest running time of the &lt;td&gt; program max_execution_time&lt;/td&gt;


&lt;td&gt;&lt;?php Echo (Get_cfg_var ("Max_execution_time"). " Seconds ");? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt; procedures allow the maximum amount of memory to be used memory_limit&lt;/td&gt;


&lt;td&gt;&lt;?php Echo @get_cfg_var ("Memory_limit");? &gt;&lt;/td&gt;


&lt;td&gt;post maximum number of bytes &amp;nbsp;post_max_size&lt;/td&gt;


&lt;td&gt;&lt;?php Echo @get_cfg_var ("post_max_size");? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt; allow maximum upload file &amp;nbsp;upload_max_filesize&lt;/td&gt;


&lt;td&gt;&lt;?php Echo @get_cfg_var ("File_uploads")? @get_cfg_var ("Upload_max_filesize"): $error;? &gt;&lt;/td&gt;


&lt;td&gt;php Information phpinfo&lt;/td&gt;


&lt;td&gt;&lt;?php Echo (False!==eregi ("Phpinfo", $disfuns)) No: "&lt;a href= ' $phpself? act=phpinfo ' target= ' _blank ' class= ' static ' &gt;phpinfo&lt;/a&gt; '?&gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt;html Error Display &lt;/td&gt;


&lt;td&gt;&lt;?php Echo @get_cfg_var ("Html_errors")? Yes:no;? &gt;&lt;/td&gt;


&lt;td&gt; Debugger Address/Port &lt;/td&gt;


&lt;td&gt;&lt;?php echo $debugerhost = @get_cfg_var ("Debugger.host")? yes:no;if ($debugerhost = = "Yes") {echo @get_cfg_ var ("Debugger.port")? Yes:no}? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&LT;TD&GT;SMTP Support &lt;/td&gt;


&lt;td&gt;&lt;?php echo @get_cfg_var ("SMTP")? Yes:no &gt;&lt;/td&gt;


&LT;TD&GT;SMTP Address &lt;/td&gt;


&lt;td&gt;&lt;?php echo @get_cfg_var ("SMTP");? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;/table&gt;


&lt;?php


Break


Case ' Otherinfo ':


?&gt;


&lt;table cellpadding= "0" cellspacing= "0" border= "0" width= "100%" class= "CTable" id= "otable" align= "Center" &gt;


&lt;tr&gt;


&lt;th colspan= "4" align= "Center" &gt;php Component support status &lt;/th&gt;


&lt;/tr&gt;


&lt;tr&gt;


&LT;TD width= "30%" &gt; Spell check Aspell library&lt;/td&gt;


&LT;TD width= "20%" &gt;&lt;?php Echo function_exists (aspell_new) yes:no;? &gt;&lt;/td&gt;


&LT;TD width= "30%" &gt; high-precision mathematical Operation bcmath&lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (Bcadd) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt; Calendar Operation calendar&lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (jdtofrench) yes:no;? &gt;&lt;/td&gt;


&lt;td&gt; Graphics processing GD library&lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (imageline) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt; class/Object Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (class_exists) yes:no;? &gt;&lt;/td&gt;


&lt;td&gt; String type detection support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (ctype_upper) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt;iconv Coding Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (iconv) yes:no;? &gt;&lt;/td&gt;


&lt;td&gt;mcrypt Encryption Processing Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (MCRYPT_CBC) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt; ha Dilute Computing mhash&lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (Mhash) yes:no;? &gt;&lt;/td&gt;


&LT;TD&GT;OPENSSL Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (Openssl_open) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt;prel compatible Syntax pcre&lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (Preg_match) yes:no;? &gt;&lt;/td&gt;


&lt;td&gt; Regular Extensions (compatible Perl) support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (Preg_match) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt;socket Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (fsockopen) yes:no;? &gt;&lt;/td&gt;


&lt;td&gt; Streaming Media Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (stream_context_create) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt;tokenizer Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (token_name) yes:no;? &gt;&lt;/td&gt;


&lt;td&gt;url Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (Parse_url) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&LT;TD&GT;WDDX Support (Web Distributed data Exchange) &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (wddx_add_vars) yes:no;? &gt;&lt;/td&gt;


&lt;td&gt; compressed file support (zlib) &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (gzclose) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt;xml Analytics &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (xml_set_object) yes:no;? &gt;&lt;/td&gt;


&lt;td&gt;ftp&lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (ftp_login) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt; Directory Access Protocol (LDAP) support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (ldap_close) yes:no;? &gt;&lt;/td&gt;


&lt;td&gt;yellow Page System Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (Yp_match) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt;php and Java Integrated Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (java_last_exception_get) yes:no;? &gt;&lt;/td&gt;


&lt;td&gt;imap e-mail system support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (imap_close) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&LT;TD&GT;SNMP Network Management Protocol support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (snmpget) yes:no;? &gt;&lt;/td&gt;


&lt;td&gt;vmailmgr Mail Processing Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (vm_adduser) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt;pdf Documentation Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (pdf_close) yes:no;? &gt;&lt;/td&gt;


&LT;TD&GT;FDF form data format support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (fdf_close) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;/table&gt;


&lt;?php


Break


Case ' Dbinfo ':


?&gt;


&lt;table cellpadding= "0" cellspacing= "0" border= "0" width= "100%" class= "CTable" id= "otable" align= "Center" &gt;


&lt;tr&gt;


&lt;th colspan= "4" align= "Center" &gt; Database Support Status &lt;/th&gt;


&lt;/tr&gt;


&lt;tr&gt;


&LT;TD width= "30%" &gt;mysql database support &lt;/td&gt;


&LT;TD width= "20%" &gt;&lt;?php Echo function_exists (mysql_close) yes:no;? &gt;&lt;/td&gt;


&LT;TD width= "30%" &gt;mysql database continuous Connection &lt;/td&gt;


&lt;td&gt;&lt;?php Echo @get_cfg_var ("Mysql.allow_persistent")? Yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt;mysql Maximum Connection number &lt;/td&gt;


&lt;td&gt;&lt;?php Echo @get_cfg_var ("Mysql.max_links") ==-1? "Unlimited": @get_cfg_var ("mysql.max_links");? &gt;&lt;/td&gt;


&LT;TD&GT;ODBC Database Connection &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (odbc_close) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt;sql Server database Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (mssql_close) yes:no;? &gt;&lt;/td&gt;


&lt;td&gt;msql Database Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (msql_close) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt;postgre SQL database Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (pg_close) yes:no;? &gt;&lt;/td&gt;


&lt;td&gt;oracle Database Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (ora_close) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt;oracle 8 Database Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (Ocilogoff) yes:no;? &gt;&lt;/td&gt;


&lt;td&gt;dbase Database Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (dbase_close) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt;sybase Database Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (sybase_close) yes:no;? &gt;&lt;/td&gt;


&LT;TD&GT;DBA Database Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (dba_close) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&LT;TD&GT;DBM Database Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (dbmclose) yes:no;? &gt;&lt;/td&gt;


&LT;TD&GT;DBX Database Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (dbx_close) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt;db++ Database Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (dbplus_close) yes:no;? &gt;&lt;/td&gt;


&lt;td&gt;frontbase Database Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (fbsql_close) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt;filepro Database Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (Filepro) yes:no;? &gt;&lt;/td&gt;


&lt;td&gt;informix Database Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (ifx_close) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt;lotus Notes Database Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (notes_version) yes:no;? &gt;&lt;/td&gt;


&lt;td&gt;interbase Database Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (ibase_close) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt;ingres Database Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (ingres_close) yes:no;? &gt;&lt;/td&gt;


&lt;td&gt;hyperwave Database Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (hw_close) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt;ovrimos SQL database connection support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (ovrimos_close) yes:no;? &gt;&lt;/td&gt;


&lt;td&gt;sesam Database connection Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (sesam_disconnect) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&lt;td&gt;sqlite Database connection Support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (sqlite_close) yes:no;? &gt;&lt;/td&gt;


&lt;td&gt;adabas d database connection support &lt;/td&gt;


&lt;td&gt;&lt;?php Echo function_exists (ada_close) yes:no;? &gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;/table&gt;


&lt;?php


Break


Case ' TestInfo ':


?&gt;


&lt;form action= "&lt;?php echo phpself"? action=testinfo&amp;icon= $icon &amp; #testinfo1 "?&gt;" method= "POST" &gt;


&lt;!--server Performance testing--&gt;


&lt;div id= "Testinfo1" &gt;


&lt;table cellpadding= "0" cellspacing= "0" border= "0" width= "100%" class= "CTable" id= "otable" align= "Center" &gt;


&lt;tr&gt;&lt;th colspan= "4" &gt; Server performance Detection &lt;/th&gt;&lt;/tr&gt;


&LT;TR align= "center" &gt;


&LT;TD width= "25%" &gt; Reference Object &lt;/td&gt;


&LT;TD width= "25%" &gt; Integer arithmetic Capability detection (1+1 operation 3 million times) &lt;/td&gt;


&LT;TD width= "25%" &gt; Floating-point arithmetic Capability Detection (square 3 million) &lt;/td&gt;


&LT;TD width= "25%" &gt; Data I/O capability detection (read 10k files 10,000 times) &lt;/td&gt;


&lt;/tr&gt;


&LT;TR align= "center" &gt;


&lt;td&gt; Red Host single-line (dual-core) &lt;/td&gt;


&lt;td&gt;0.33 sec &lt;/td&gt;


&lt;td&gt;0.95 sec &lt;/td&gt;


&lt;td&gt;0.03 sec &lt;/td&gt;


&lt;/tr&gt;


&LT;TR align= "center" &gt;


&lt;td&gt; Red Host dual Line (quad core) &lt;/td&gt;


&lt;td&gt;0.25 sec &lt;/td&gt;


&lt;td&gt;0.79 sec &lt;/td&gt;


&lt;td&gt;0.03 sec &lt;/td&gt;


&lt;/tr&gt;


&LT;TR align= "center" &gt;


&lt;td&gt;xeon (tm) 2.80*2+4g+centos 5.2&lt;/td&gt;


&lt;td&gt;0.068 sec &lt;/td&gt;


&lt;td&gt;0.086 sec &lt;/td&gt;


&lt;td&gt; less than 0.100 sec &lt;/td&gt;


&lt;/tr&gt;


&LT;TR align= "center" &gt;


&lt;td&gt;xeon (tm) 2.80ghz+2g+freebsd 4.0&lt;/td&gt;


&lt;td&gt;0.501 sec &lt;/td&gt;


&lt;td&gt;0.694 sec &lt;/td&gt;


&lt;td&gt; less than 0.100 sec &lt;/td&gt;


&lt;/tr&gt;


&LT;TR align= "center" height= "M" &gt;


&lt;td&gt; This server &lt;/td&gt;


&lt;td&gt;&lt;span style= "color: #390" &gt;&lt;?php echo $valint;? &gt;&lt;/span&gt; &lt;input type= "submit" value= "integral Test" name= "act" class= "button"/&gt;&lt;/td&gt;


&lt;td&gt;&lt;span style= "color: #06c" &gt;&lt;?php echo $valfloat;? &gt;&lt;/span&gt; &lt;input type= "Submit" value= "floating-point test" name= "act" class= "button"/&gt;&lt;/td&gt;


&lt;td&gt;&lt;span style= "color: #f60" &gt;&lt;?php echo $valio;? &gt;&lt;/span&gt; &lt;input type= "Submit" value= "IO Test" name= "act" class= "button"/&gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;/table&gt;


&lt;/div&gt;


&lt;input type= "hidden" name= pint "value=" &lt;?php echo $valint;? &gt; "/&gt;


&lt;input type= "hidden" name= pfloat "value=" &lt;?php echo $valfloat;? &gt; "/&gt;


&lt;input type= "hidden" name= "Pio" value= "&lt;?php echo $valio;? &gt; "/&gt;


&lt;/form&gt;


&lt;?php


$ismysql = (false!== function_exists ("mysql_query"))? "": "Disabled";


$ismail = (false!== function_exists ("Mail"))? "": "Disabled";


?&gt;


&lt;br/&gt;


&lt;form action= "&lt;?php echo phpself"? action=testinfo&amp;icon= $icon &amp; #testinfo2 "?&gt;" method= "POST" &gt;


&lt;div id= "Testinfo2" &gt;


&lt;!--MySQL database connection detection--&gt;&lt;br/&gt;&lt;br/&gt;


&lt;table cellpadding= "0" cellspacing= "0" border= "0" width= "80%" class= "CTable" id= "Otable2" align= "Center" &gt;


&lt;tr&gt;&lt;th colspan= "2" &gt;mysql Database connection detection &lt;/th&gt;&lt;/tr&gt;


&lt;tr&gt;


&LT;TD width= "30%" align= "right" &gt;mysql server:&lt;/td&gt;


&lt;td&gt;&lt;input name= "Mysqlhost" type= "text" id= "mysqlhost" value= "localhost" "size=" class= "Text2"/&gt;&lt;/ Td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&LT;TD align= "right" &gt;mysql username:&lt;/td&gt;


&lt;td&gt;&lt;input name= "Mysqluser" type= "text" id= "Mysqluser" value= "root" size= "no" class= "Text2"/&gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&LT;TD align= "Right" &gt;mysql user password:&lt;/td&gt;


&lt;td&gt;&lt;input type= "text" name= "Mysqlpassword" &lt;?php echo $ismysql?&gt; size= "*" class= "Text2"/&gt;&lt;/td &gt;


&lt;/tr&gt;


&lt;tr&gt;


&LT;TD align= "right" &gt;mysql database name:&lt;/td&gt;


&lt;td&gt;&lt;input type= "text" name= "MySQLdb" "size=" class= "Text2"/&gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&LT;TD align= "Right" height= "&gt;&lt;input type=" Submit "class=" button "value=" Connect "&lt;?php Echo $ismysql?&gt; Name= "Act"/&gt;&lt;/td&gt;


&lt;td&gt;&lt;div class= "check00" &gt;&lt;?php if ("show" = = $mysqlreshow) {echo $mysqlre}? &gt; &lt;/div&gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;/table&gt;


&lt;/div&gt;


&lt;/form&gt;


&lt;br/&gt;&lt;br/&gt;


&lt;form action= "&lt;?php echo phpself"? action=testinfo&amp;icon= $icon &amp; #testinfo5 "?&gt;" method= "POST" &gt;


&lt;div id= "Testinfo5" &gt;


&lt;!--message Send detection--&gt;


&lt;table cellpadding= "0" cellspacing= "0" border= "0" width= "80%" class= "CTable" id= "Otable3" align= "Center" &gt;


&lt;tr&gt;&lt;th colspan= "2" &gt;php configuration parameter status &lt;/th&gt;&lt;/tr&gt;


&lt;tr&gt;


&LT;TD width= "30%" align= "right" &gt; Please enter the name of the parameter you want to detect:&lt;/td&gt;


&lt;td&gt;&lt;input type= "text" name= "Opname" "size=" class= "Text2"/&gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&LT;TD align= "Right" height= "&gt;&lt;input type=" Submit "class=" button "value=" Configuration_check "name=" Act " &gt;&lt;/td&gt;


&lt;td&gt;&lt;div class= "check00" &gt;&lt;?php if ("show" = = $opreshow) {echo $opre}? &gt;&lt;/div&gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;/table&gt;


&lt;/div&gt;


&lt;/form&gt;


&lt;br/&gt;&lt;br/&gt;


&lt;form action= "&lt;?php echo phpself"? action=testinfo&amp;icon= $icon &amp; #testinfo3 "?&gt;" method= "POST" &gt;


&lt;div id= "Testinfo3" &gt;


&lt;!--function Detection--&gt;


&lt;table cellpadding= "0" cellspacing= "0" border= "0" width= "80%" class= "CTable" id= "otable4" align= "Center" &gt;


&lt;tr&gt;&lt;th colspan= "2" &gt; Function detection &lt;/th&gt;&lt;/tr&gt;


&lt;tr&gt;


&LT;TD width= "30%" align= "right" &gt; Please enter the name of the function you want to detect:&lt;/td&gt;


&lt;td&gt;&lt;input type= "text" name= "Funname" "size=" class= "Text2"/&gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;tr&gt;


&LT;TD align= "Right" height= "&gt;&lt;input type=" Submit "class=" button "value=" Function_check "name=" act "/&gt; &lt;/td&gt;


&lt;td&gt;&lt;div class= "check00" &gt;&lt;?php if ("show" = = $funreshow) {echo $funre}? &gt; &lt;/div&gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;/table&gt;


&lt;/div&gt;


&lt;/form&gt;


&lt;br/&gt;&lt;br/&gt;


&lt;form action= "&lt;?php echo phpself"? action=testinfo&amp;icon= $icon &amp; #testinfo4 "?&gt;" method= "POST" &gt;


&lt;div id= "Testinfo4" &gt;


&lt;!--message Send detection--&gt;


&lt;table cellpadding= "0" cellspacing= "0" border= "0" width= "80%" class= "CTable" id= "otable5" align= "Center" &gt;


&lt;tr&gt;&lt;th colspan= "2" &gt;mail Mail send test &lt;/th&gt;&lt;/tr&gt;


&lt;tr&gt;


&LT;TD width= "30%" align= "right" &gt; Please enter the email address you want to detect:&lt;/td&gt;


&lt;td&gt;&lt;input type= "text" name= "Mailreceiver" size= "" &lt;?php echo $ismail?&gt; class= "Text2"/&gt;&lt;/td &gt;


&lt;/tr&gt;


&lt;tr&gt;


&LT;TD align= "Right" height= "&gt;&lt;input type=" Submit "class=" button "value=" SendMail "&lt;?php Echo $ismail?&gt; Name= "Act"/&gt;&lt;/td&gt;


&lt;td&gt;&lt;div class= "check00" &gt;&lt;?php if ("show" = = $mailreshow) {echo $mailre}? &gt;&lt;/div&gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;/table&gt;


&lt;/div&gt;


&lt;/form&gt;

<?php
Break
}?>
</div>

</div>
</body>
<?php

/*=============================================================
function library
=============================================================*/

/*-------------------------------------------------------------------------------------------------------------


instrumentation function Support


--------------------------------------------------------------------------------------------------------------* /


function Isfun ($funname)


{


Return (False!== function_exists ($funname))? Yes:no;


}


/*-------------------------------------------------------------------------------------------------------------


Detecting PHP Setup parameters


--------------------------------------------------------------------------------------------------------------* /


function Getcon ($varname)


{


Switch ($res = Get_cfg_var ($varname))


{


Case 0:


return no;


Break


Case 1:


return yes;


Break


Default


return $res;


Break


}





}


/*-------------------------------------------------------------------------------------------------------------


Integer arithmetic capability test


--------------------------------------------------------------------------------------------------------------* /


function Test_int ()


{


$timestart = Gettimeofday ();


for ($i = 0; $i &lt;= 3000000; $i + +);


{


$t = 1+1;


}


$timeend = Gettimeofday ();


$time = ($timeend ["USEC"]-$timestart ["USEC"])/1000000+ $timeend [sec]]-$timestart [sec];


$time = Round ($time, 6). " Seconds ";


return $time;


}


/*-------------------------------------------------------------------------------------------------------------


Floating point arithmetic capability test


--------------------------------------------------------------------------------------------------------------* /


function Test_float ()


{


$t = Pi ();


$timestart = Gettimeofday ();


for ($i = 0; $i &lt; 3000000; $i + +);


{


sqrt ($t);


}


$timeend = Gettimeofday ();


$time = ($timeend ["USEC"]-$timestart ["USEC"])/1000000+ $timeend [sec]]-$timestart [sec];


$time = Round ($time, 6). " Seconds ";


return $time;


}


/*-------------------------------------------------------------------------------------------------------------


Data IO capability test


--------------------------------------------------------------------------------------------------------------* /


function Test_io ()


{


$fp = @fopen (phpself, "R");


$timestart = Gettimeofday ();


for ($i = 0; $i &lt; 10000; $i + +)


{


@fread ($fp, 10240);


@rewind ($FP);


}


$timeend = Gettimeofday ();


@fclose ($FP);


$time = ($timeend ["USEC"]-$timestart ["USEC"])/1000000+ $timeend [sec]]-$timestart [sec];


$time = Round ($time, 6). " Seconds ";


return ($time);


}


/*-------------------------------------------------------------------------------------------------------------


Ratio Bar


--------------------------------------------------------------------------------------------------------------* /


function Bar ($percent)


{


Echo ' &lt;br/&gt;&lt;ul class= "bar" &gt;


&lt;li style= "width:";


echo $percent. " % "&gt;";


Echo ' &amp;nbsp;&lt;/li&gt;


&lt;/ul&gt; ';


}


/*-------------------------------------------------------------------------------------------------------------


Get CPU-related information from different systems


--------------------------------------------------------------------------------------------------------------* /


Switch (php_os) {


Case "Linux":


$sysreshow = (False!== ($sysinfo = Sys_linux ()))? " Show ": none";


Break


Case "FreeBSD":


$sysreshow = (False!== ($sysinfo = Sys_freebsd ()))? " Show ": none";


Break


Case "Winnt":


$sysreshow = (False!== ($sysinfo = Sys_windows ()))? " Show ": none";


Break


Default


Break


}

/*-------------------------------------------------------------------------------------------------------------


System parameter Detection Linux


--------------------------------------------------------------------------------------------------------------* /


function Sys_linux ()


{


Cpu


if (false = = ($str = @file ("/proc/cpuinfo")) return false;


$str = Implode ("", $str);


@preg_match_all ("/models+names{0,}:+s{0,}" ([WS) (.] +) []+/, $str, $model);


@preg_match_all ("/cpus+mhzs{0,}:+s{0,}" ([D.] +) []+/, $str, $mhz);


@preg_match_all ("/caches+sizes{0,}:+s{0,}" ([D.] +s{0,}[a-z]+[]+)/", $str, $cache);


if (False!== Is_array ($model [1]))


{


$res [' CPU '] [' num '] = sizeof ($model [1]);


for ($i = 0; $i &lt; $res [' CPU '] [' num ']; $i + +)


{


$res [' CPU '] [' detail '] = ' type: '. $model [1][$i]. "Caching:". $cache [1][$i];


}


if (False!== Is_array ($res [' CPU '] [' detail ']) $res [' CPU '] [' detail '] = implode ("&lt;br/&gt;", $res [' CPU '] [' detail ']);


}





Uptime


if (false = = ($str = @file ("/proc/uptime")) return false;


$str = Explode ("", Implode ("", $str));


$str = Trim ($str [0]);


$min = $STR/60;


$hours = $min/60;


$days = Floor ($hours/24);


$hours = Floor ($hours-($days * 24));


$min = Floor ($min-($days *)-($hours * 60));


if ($days!= 0) {$res [' uptime '] = $days. " Days ";}


if ($hours!= 0) {$res [' uptime ']. = $hours. " Hours ";}


$res [' uptime ']. = $min. " Minutes ";





Memory


if (false = = ($str = @file ("/proc/meminfo")) return false;


$str = Implode ("", $str);


Preg_match_all ("/memtotals{0,}:+s{0,}" ([D.] +). +?memfrees{0,}:+s{0,} ([D.] +). +?swaptotals{0,}:+s{0,} ([D.] +). +?swapfrees{0,}:+s{0,} ([D.] +)/S ", $str, $buf);





$res [' memtotal '] = round ($buf [1][0]/1024, 2);


$res [' memfree '] = round ($buf [2][0]/1024, 2);


$res [' memused '] = ($res [' Memtotal ']-$res [' Memfree ']);


$res [' mempercent '] = (floatval ($res [' memtotal '])!=0)? Round ($res [' memused ']/$res [' Memtotal ']*100,2]: 0;





$res [' swaptotal '] = round ($buf [3][0]/1024, 2);


$res [' swapfree '] = round ($buf [4][0]/1024, 2);


$res [' swapused '] = ($res [' Swaptotal ']-$res [' Swapfree ']);


$res [' swappercent '] = (floatval ($res [' swaptotal '])!=0)? Round ($res [' swapused ']/$res [' Swaptotal ']*100,2]: 0;





Load avg


if (false = = ($str = @file ("/proc/loadavg")) return false;


$str = Explode ("", Implode ("", $str));


$str = Array_chunk ($str, 3);


$res [' loadavg '] = Implode ("", $str [0]);





return $res;


}


/*-------------------------------------------------------------------------------------------------------------


System parameter Detection FreeBSD


--------------------------------------------------------------------------------------------------------------* /


function Sys_freebsd ()


{


Cpu


if (false = = = = ($res [' CPU '] [' num '] = Get_key ("Hw.ncpu")) return false;


$res [' CPU '] [' detail '] = Get_key ("Hw.model");





Load avg


if (false = = = ($res [' loadavg '] = Get_key ("Vm.loadavg")) return false;


$res [' loadavg '] = Str_replace ("{", "", $res [' loadavg ']);


$res [' loadavg '] = Str_replace ("}", "", $res [' loadavg ']);





Uptime


if (false = = ($buf = Get_key ("Kern.boottime")) return false;


$buf = Explode (", $buf);


$sys _ticks = time ()-Intval ($buf [3]);


$min = $sys _ticks/60;


$hours = $min/60;


$days = Floor ($hours/24);


$hours = Floor ($hours-($days * 24));


$min = Floor ($min-($days *)-($hours * 60));


if ($days!= 0) $res [' uptime '] = $days. " Days ";


if ($hours!= 0) $res [' uptime ']. = $hours. " Hours ";


$res [' uptime ']. = $min. " Minutes ";





Memory


if (false = = ($buf = Get_key ("Hw.physmem")) return false;


$res [' memtotal '] = round ($buf/1024/1024, 2);


$buf = Explode ("", Do_command ("Vmstat", ""));


$buf = Explode ("", Trim ($buf [2]));





$res [' memfree '] = round ($buf [5]/1024, 2);


$res [' memused '] = ($res [' Memtotal ']-$res [' Memfree ']);


$res [' mempercent '] = (floatval ($res [' memtotal '])!=0)? Round ($res [' memused ']/$res [' Memtotal ']*100,2]: 0;





$buf = Explode ("", Do_command ("Swapinfo", "K"));


$buf = $buf [1];


Preg_match_all ("/([0-9]+) s+ ([0-9]+) s+ ([0-9]+)/", $buf, $bufarr);


$res [' swaptotal '] = round ($bufarr [1][0]/1024, 2);


$res [' swapused '] = round ($bufarr [2][0]/1024, 2);


$res [' swapfree '] = round ($bufarr [3][0]/1024, 2);


$res [' swappercent '] = (floatval ($res [' swaptotal '])!=0)? Round ($res [' swapused ']/$res [' Swaptotal ']*100,2]: 0;





return $res;


}





/*-------------------------------------------------------------------------------------------------------------


Get parameter Value FreeBSD


--------------------------------------------------------------------------------------------------------------* /


function Get_key ($keyname)


{


Return Do_command (' Sysctl ', "-N $keyname");


}





/*-------------------------------------------------------------------------------------------------------------


Determine the execution file location FreeBSD


--------------------------------------------------------------------------------------------------------------* /


function Find_command ($commandname)


{


$path = Array ('/bin ', '/sbin ', '/usr/bin ', '/usr/sbin ', '/usr/local/bin ', '/usr/local/sbin ');


foreach ($path as $p)


{


if (@is_executable ("$p/$commandname") return "$p/$commandname";


}


return false;


}





/*-------------------------------------------------------------------------------------------------------------


Execute system Command FreeBSD


--------------------------------------------------------------------------------------------------------------* /


function Do_command ($commandname, $args)


{


$buffer = "";


if (false = = ($command = Find_command ($commandname)) return false;


if ($fp = @popen ("$command $args", ' R '))


{


while (! @feof ($FP))


{


$buffer. = @fgets ($fp, 4096);


}


Return trim ($buffer);


}


return false;


}

/*-------------------------------------------------------------------------------------------------------------
System parameter Probes Windows
--------------------------------------------------------------------------------------------------------------* /
function Sys_windows ()
{
$phpos =php_os;
$sysinfo [' uptime '] = "Sorry windows system does not support";

}
?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.