Home Backend Development PHP Tutorial PHP needle control (view server details)_PHP tutorial

PHP needle control (view server details)_PHP tutorial

Jul 20, 2016 am 11:08 AM
php one based on Tutorial server Check program details

php tutorial needle control (view server details)

/

* 1. This program is based on the div+css tutorial new architecture php probe , free and open source free software, with powerful functions, clear structure and easy to use.
1. Support windows, linux, unix, freebsd, sun solar system
2. Support ie6, ie7, firefox, google chrome and other browsers.

2. Main uses and applicable objects:
1. Amateurs and professional developers who are familiar with PHP programming.
2. The computer room manager configures the linux (windows) + php + mysql tutorial + zend system environment and checks whether the system is configured successfully.
3. For users who purchase virtual hosts, it is used to test server performance.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
////////////////////The following two variables can be modified and configured
//If you are using this probe for verification, you can Enter relevant information in the variables below (will be displayed 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";
//============ Define constants to replace template output variables ============== =========
//define("yes", "yes");
//define("no", "no");
define("yes", "");
define("no", "×");

//================================================ ====================
define("icon", "2 ");
$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'] == "integer test")
{
$valint = test_int();
}
elseif($_post[' act'] == "Floating point test")
{
$valfloat = test_float();
}
elseif($_post['act'] == "io test")
 {
          $valio = test_io(); > $ Mysqlre = "MySQL connection test results:";
$ mysqlre. = (False! == @mysql_connect ($ _ post ['mysqlhost'], $ _post ['mysqluser'], $ _post ['mysqlpas sword '] ; ;
       $mysqlre .= (false != @mysql_select_db($_post['mysqldb']))?"Connection OK": "Connection failed";
    }
  elseif($_post['act' ] == "sendmail")
                                                               $mailreshow =                                          mail($_post["mailreceiver"], "uenuprobe mail server test.", "this email is sent by uenuprobe.rnrnrnrnrncopyright uenucomrnhttp://www.uenu.com"))?"Complete":"Failed";
}
elseif($_post['act'] == "function_check")
{
$funreshow = "show";
$funre = "function".$_post ['funname']." Support status detection results: ".isfun($_post['funname']);
}
elseif($_post['act'] == "configuration_check ")
{
$opreshow = "show";
$opre = "Configuration parameters".$_post['opname']." Detection result: ". 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;
}

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

?>







服务器信息




服务器信息


switch($_get['action']){
case '':
?>


 


 
   


   
   


 
   


 
   


 
   


 
   


 
   


 
   


 
   


 
   


 
   


 
   

服务器特征
服务器时间 (格林威治标准时间) (北京时间)
服务器域名$_server[server_name]"); ?>
服务器ip地址
服务器操作系统 if ($os[0] =="windows") {echo "主机名称:".$os[2];} else {echo "内核版本:".$os[2];}?>
服务器运行时间
服务器操作系统文字编码
服务器解译引擎
web服务端口
服务器管理员
本文件路径
服务端剩余空间
系统当前用户名





服务器处理器
cpu个数:





服务器处理器
cpu个数:



内存使用状况

m, 已使用
m, 空闲
m, 使用率
%

swap区

m, 已使用
m, 空闲
m, 使用率
%

系统平均负载



break;
case 'phpinfo':
?>


 


 
   
 
   


 
   
 
   


 
   
 
   


 
   
 
   


 
   
 
   


 
   
 
   


 
   
 
   


 
   
 
   












< ;/tr>












php基本特征
php版本php运行方式
支持zend编译运行 ()运行于安全模式
自动定义全局变量 register_globals允许使用url打开文件allow_url_fopen
允许动态加载链接库enable_dl显示错误信息 display_errors
短标记<? ?>支持标记<% %>支持
cookie支持session支持
浮点运算有效数字显示位数强制y2k兼容
被禁用的函数disable_functionsif($disused =="1")
{echo '">'."more".'';}
else {echo "none";}?>
程序最长运行时间max_execution_time
The maximum amount of memory a program is allowed to use memory_limit Maximum number of bytes in post post_max_size
Maximum uploaded files allowed upload_max_filesize php information phpinfo phpinfo"?>
html error display Debugger address/port
smtp support smtp address

break;
case 'otherinfo':
?>










< tr>


< td>Graphics processing gd library







< /tr>












   
 
   


 
   
 
   


 
   
 
   


 
   
 
   


 
   
 
   


 
   
 
   


 
   
 
   


 
   
 
   


 
   
 
   

php component support status
Spell check aspell libraryHigh Precision mathematical operations bcmath
Calendar operation calendar
Class/Object Support String type detection support
iconv encoding support < ;/td>
mcrypt encryption processing support
Hash calculation mhash openssl support
prel compatible syntax pcre正则扩展(兼容perl)支持
socket支持流媒体支持
tokenizer支持url支持
wddx支持(web distributed data exchange)压缩文件支持(zlib)
xml解析ftp
目录存取协议(ldap)支持yellow page系统支持
php和java综合支持imap电子邮件系统支持
snmp网络管理协议支持vmailmgr邮件处理支持
pdf文档支持fdf表单资料格式支持

  break;
 case 'dbinfo': 
?>


 


 
   
 
   


 
   
 
   


 
   
 
   


 
   
 
   


 
   
 
   


 
   
 
   


 
   
 
   


 
   
 
   


 
   
 
   


 
   
 
   


 
   
 
   


 
   
 
   


 
   
 
   

数据库支持状况
mysql数据库支持mysql数据库持续连接
mysql最大连接数odbc数据库连接
sql server数据库支持msql数据库支持
postgre sql数据库支持oracle数据库支持
oracle 8 数据库支持dbase数据库支持
sybase数据库支持dba数据库支持
dbm数据库支持dbx数据库支持
db++数据库支持frontbase数据库支持
filepro数据库支持informix数据库支持
lotus notes数据库支持interbase数据库支持
ingres数据库支持hyperwave数据库支持
ovrimos sql数据库连接支持sesam数据库连接支持
sqlite数据库连接支持adabas d数据库连接支持

break;
case 'testinfo':
?>
" method="post">





 
 
 
 


 
 
 
 


 
 
 
 


 
 
 
 


 
 
 
 


 
 
 
 

服务器性能检测
参照对象整数运算能力检测(1+1运算300万次)浮点运算能力检测(开平方300万次)数据i/o能力检测(读取10k文件1万次)
红色主机单线型(双核)0.33 秒0.95 秒0.03 秒
红色主机双线型(四核)0.25 秒0.79 秒0.03 秒
xeon(tm) 2.80*2+4g+centos 5.20.068秒0.086秒小于0.100秒
xeon(tm) 2.80ghz+2g+freebsd 4.00.501秒0.694秒小于0.100秒
本台服务器






$ismysql = (false !== function_exists("mysql_query"))?"":" disabled";
$ismail = (false !== function_exists("mail"))?"":" disabled";
?>


" method="post">







 
 


 
 


 
 


 
 


 
   

mysql数据库连接检测
mysql服务器:
mysql用户名:
mysql用户密码: size="80" class="text2" />
mysql数据库名称:
  name="act" />






" method="post">





   
   


   
   

php配置参数状况
请输入您要检测的参数名称:






" method="post">





 
 


 
   

函数检测
请输入您要检测的函数名称:






" method="post">





   
   


   
   

mail邮件发送测试
请输入您要检测的邮件地址: class="text2" />
  name="act" />


break;
}?>




/*==================== ===========================================
Function library
================================================== ============*/

/*------------------------------------------------ -------------------------------------------------- -------------
Detection function support
-------------------------- -------------------------------------------------- ----------------------------------*/
function isfun($funname)
{
Return (false !== function_exists($funname))?yes:no;
}
/*------------------------ -------------------------------------------------- ------------------------------------
Detect php setting 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 ability test
------------------------- -------------------------------------------------- ----------------------------------*/
function test_int()
{
         $timestart = gettimeofday(); $timeend = gettimeofday();
$time = ($timeend["usec"]-$timestart["usec"])/1000000+$timeend["sec"]-$timestart["sec"];
         $time = round($time, 6)."seconds"; -------------------------------------------------- ------------------------------------------
Floating point computing ability test
-------------------------------------------------- -------------------------------------------------- -------------*/
function test_float()
{
$t = pi();
$timestart = gettimeofday();
for ($i = 0; $i < 3000000; $i++);
sqrt($t);
}
$timeend = gettimeofday(); $timeend["usec"]-$timestart["usec"])/1000000+$timeend["sec"]-$timestart["sec"];
            $time = round($time, 6)." Seconds";
return $time;
}
/*---------------------------------- -------------------------------------------------- ----------------------------
Data io ability test
--------------------- -------------------------------------------------- ----------------------------------------*/
function test_io()
{
$fp = @fopen(phpself, "r");
$timestart = gettimeofday();
for($i = 0; $i < ; 10000; $i++)
                                                                                                                                                                                                                                                                          since}
$timeend = gettimeofday();
@fclose($fp);
$time = ($timeend["usec"]-$timestart["usec"])/1000000+$timeend[ "sec"]-$timestart["sec"];
        $time = round($time, 6)."seconds";
                                                                                                                                                   -------------------------------------------------- -------------------------------------------------- --------
Proportional bar
---------------------------------- -------------------------------------------------- --------------------------*/
function bar($percent)
{
echo '


  • ";
    echo ' 
';
}
/*--------------------------------- -------------------------------------------------- --------------------------
Obtain cpu related information according to 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;
}

/*-------------------------------------------------------------------------------------------------------------
    系统参数探测 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)(.]+)[rn]+/", $str, $model);
        //@preg_match_all("/cpus+mhzs{0,}:+s{0,}([d.]+)[rn]+/", $str, $mhz);
        @preg_match_all("/caches+sizes{0,}:+s{0,}([d.]+s{0,}[a-z]+[rn]+)/", $str, $cache);
        if (false !== is_array($model[1]))
            {
            $res['cpu']['num'] = sizeof($model[1]);
            for($i = 0; $i < $res['cpu']['num']; $i++)
            {
                $res['cpu']['detail'][] = "类型:".$model[1][$i]." 缓存:".$cache[1][$i];
            }
            if (false !== is_array($res['cpu']['detail'])) $res['cpu']['detail'] = implode("
", $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 * 60 * 24) - ($hours * 60));
        if ($days != 0) {$res['uptime'] = $days."天";}
        if ($hours != 0) {$res['uptime'] .= $hours."小时";}
        $res['uptime'] .= $min."分钟";
        
        // 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;
    }
/*-------------------------------------------------------------------------------------------------------------
    系统参数探测 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 * 60 * 24) - ($hours * 60));
        if ($days != 0) $res['uptime'] = $days."天";
        if ($hours != 0) $res['uptime'] .= $hours."小时";
        $res['uptime'] .= $min."分钟";
        
        //memory
        if (false === ($buf = get_key("hw.physmem"))) return false;
        $res['memtotal'] = round($buf/1024/1024, 2);
        $buf = explode("n", 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("n", 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;
    }
    
/*-------------------------------------------------------------------------------------------------------------
    取得参数值 freebsd
--------------------------------------------------------------------------------------------------------------*/
function get_key($keyname)
    {
return do_command('sysctl', "-n $keyname");
}
 
/*--------------------------- -------------------------------------------------- ------------------------------------
Determine the location of the executable file 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;                                  -------------------------------------------------- ---------------------------------------------
Execution 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 detection windows

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

function sys_windows()
{
//$phpos=php_os;
$sysinfo['uptime'] ="Sorry, windows system does not support";

}
?>



http://www.bkjia.com/PHPjc/444855.html

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/444855.htmlTechArticlephp tutorial needle control (view server details) / *1. This program is based on the new architecture of div+css tutorial php Probe, free and open source free software, with powerful functions, clear structure and easy to use...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

How do you parse and process HTML/XML in PHP? How do you parse and process HTML/XML in PHP? Feb 07, 2025 am 11:57 AM

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

PHP Program to Count Vowels in a String PHP Program to Count Vowels in a String Feb 07, 2025 pm 12:12 PM

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

7 PHP Functions I Regret I Didn't Know Before 7 PHP Functions I Regret I Didn't Know Before Nov 13, 2024 am 09:42 AM

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are PHP magic methods (__construct, __destruct, __call, __get, __set, etc.) and provide use cases? What are PHP magic methods (__construct, __destruct, __call, __get, __set, etc.) and provide use cases? Apr 03, 2025 am 12:03 AM

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.

See all articles