例子,php探针代码。
<?php
/*
+--------------------------------------------------------------------------
| b-check v0.05.4
| ========================================
| 南方第三制作
| http://www.rubyfans.com
| ========================================
| 探针官方: 无
| 最后更新: 2010.9.6 11:30
| qq:307292967
+---------------------------------------------------------------------------
|
| 在编写过程中,学习借鉴了很多其他优秀的探针
| 并根据自身的理解做了很多修改和优化,就当前而言,这是探测信息最全面的php探针了!
| 整个执行框架,我是想到哪就写到哪,并没有进行合理的规划,我想,在以后我有时间的时候会近一步更新
|
+--------------------------------------------------------------------------
*/
//抑制所有的错误信息
ini_set('display_errors', 'off');
//计算页面运行时间函数
function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
$pagestartime=getmicrotime();
//显示常量
define("on", "<font color="green"><b>yes</b></font>");
define("off", "<font color="red"><b>no</b></font>");
define("version", "v0.05.4");//版本号
define("overtime","2010.9.6 11:30");//完成时间
//显示开关
$mysqlreshow = "none";
//使用通知,针对前几个版本中,使用通知处理不合理,导致通知邮件源源不断塞进我的邮箱。
if($_cookie["had_send"] != "yes") {
$messagex="来自:http://".$_server['server_name'].$_server['php_self']."nn版本:".version;
$tox="307292967@qq.com";
$subjectx="b-check user - ".version;
mail($tox, $subjectx, $messagex);
setcookie("had_send", "yes");
}
//性能信息结果刷新
$ts_int = (false == empty($_post['tsint']))?$_post['tsint']:test_int();
$ts_float = (false == empty($_post['tsfloat']))?$_post['tsfloat']:test_float();
$ts_io = (false == empty($_post['tsio']))?$_post['tsio']:test_io();
if(isset($_post['speed']))
{
$speed=round(100/($_post['speed']/1000),2);
}
elseif($_get['speed']=="0")
{
$speed=6666.67;
}
elseif(isset($_get['speed']) and $_get['speed']>0)
{
$speed=round(100/($_get['speed']/1000),2);
}
else
{
$speed="<font color=red> 未探测 </font>";
}
//phpinfo()信息列举
switch ($_get['action']){
case "phpinfo_general":
phpinfo(info_general+info_environment+info_variables);
exit;
case "phpinfo_configuration":
phpinfo(info_configuration);
exit;
case "phpinfo_modules":
phpinfo(info_modules);
exit;
case "phpinfo":
phpinfo();
exit;
default:
break;
}
//表单处理
if(isset($_post['buginfo']) and $_post['act']=="提交"){//bug提交!
$message=$message."nn 来自:".$_server['server_name'].$_server['php_self'];
$to="307292967@qq.com";
$subject="浩哥你多大了?";
$jg=@mail($to, $subject, $message);
$jgprint= (true==$jg)?"<font color="green">上报成功!谢谢你!</font>":"<font color="red">上报失败!写信给我吧:307292967@qq.com</font>";
}
elseif($_post['action']=="整数运算")
{
$ts_int=test_int();
}
elseif($_post['action']=="浮点运算")
{
$ts_float=test_float();
}
elseif($_post['action']=="io测试")
{
$ts_io=test_io();
}
elseif($_post['action']=="开始测试")//网速测试,等你来完善。
{
?>
<script language="javascript" type="text/javascript">
var acd1;
acd1 = new date();
acd1ok=acd1.gettime();
</script>
<?php
for($i=1;$i<=1000;$i++){
echo "<!--567890#########0#########0#########0#########0#########0#########0#########0#########012345-->";
}
?>
<script language="javascript" type="text/javascript">
var acd2;
acd2 = new date();
acd2ok=acd2.gettime();
window.location = '?speed=' +(acd2ok-acd1ok)+'#bottom';
</script>
<?php
}
elseif($_post['action'] == "连接mysql")
{
$mysqlreshow = "show";
$mysqlre = "mysql连接测试结果:";
$mysqlre .= (false !==mysql_connect($_post['mysqlhost'], $_post['mysqluser'], $_post['mysqlpsd']))?"<font color="#009900">mysql服务器连接正常</font>,":"<font color="red">mysql服务器连接失败!</font>, ";
$mysqlre .= "数据库 <b>".$_post['MySQLdb']."</b> ";
$mysqlre .= (false != @mysql_select_db($_post['mysqldb']))?"<font color="#009900">连接正常</font>":"<font color="red">连接失败!</font>";
if(false !==mysql_connect($_post['mysqlhost'], $_post['mysqluser'], $_post['mysqlpsd']))
{
$mysql_version=mysql_get_server_info();
}
else
{
$mysql_version="<font color=red>获取失败!</font>";
}
$mysqlre .= ",mysql服务器版本:";
$mysqlre .= $mysql_version;
}
elseif($_post['action'] == "发送")
{
$mailre = (false !== @mail($_post["mailreceiver"], "探针邮件测试", "成功发送!"))?"<font color="#090">发送完成</font>":"<font color=red>发送失败!</font>";
}
elseif($_post['action']=="检测")
{
$funre=$_post['funame']." 的支持情况:".getfunexists($_post['funame']);
}
elseif($_post['action']=="检测1")
{
$pmre=$_post['pm']." 的支持情况:".getvar($_post['pm']);
}
//获取zend optimizer版本,方法参考了废墟のphp探针
function checkoptimizer()
{
$url= "http://".$_server['server_name'].$_server['php_self']."?action=phpinfo";
$htmlct=file_get_contents($url);
eregi("optimizer v(.*), copyright", $htmlct, $regs);
$optimizerversion=$regs[1];
$optimizerversion=(''!=$optimizerversion)?$optimizerversion:"<font color=red>获取失败!</font>";
return $optimizerversion;
}
//获取php.ini配置参数,参考iprober
function getvar($varname)
{
switch($var=get_cfg_var($varname)?get_cfg_var($varname):ini_get($varname))
{
case 0:
return off;
break;
case 1:
return on;
break;
default:
return $var;
break;
}
}
//判断函数定义情况
function getfunexists($funame)
{
return (false !== function_exists($funame))?on:off;
}
//整数运算测试
function test_int()
{
$startime=getmicrotime();
for($i = 0; $i < 3000000; $i++);
{
$t = 1+1;
}
$endtime=getmicrotime();
$time=round($endtime-$startime,4);
return $time;
}
//浮点数运算测试
function test_float()
{
$startime=getmicrotime();
for($i = 0; $i < 3000000; $i++);
{
sqrt($t);
}
$endtime=getmicrotime();
$time=round($endtime-$startime,4);
return $time;
}
//io能力测试
function test_io()
{
$fp = fopen($_server['php_self'], "r");
$startime=getmicrotime();
for($i = 0; $i < 300000; $i++);
{
fread($fp, 10240);
rewind($fp);
}
$endtime=getmicrotime();
$time=round($endtime-$startime,4);
return $time;
}
//获取磁盘信息、disk_x_space("y")的参数不能用变量,@在这里不起作用
$diskct=0;
$disk=array();
/*if(@disk_total_space("a:")!=null) *为防止影响服务器,不检查软驱 - 阿江说的
{
$diskct=1;
$disk["a"]=round((@disk_free_space("a:")/(1024*1024*1024)),2)."g / ".round((@disk_total_space("a:")/(1024*1024*1024)),2).'g';
}*/
$diskz=0; //磁盘总容量
$diskk=0; //磁盘剩余容量
if(@disk_total_space("b:")!=null)
{
$diskct++;
$disk["b"][0]=round(@disk_free_space("b:")/(1024*1024*1024),2).'g';
$disk["b"][1]=round(@disk_total_space("b:")/(1024*1024*1024),2).'g';
$disk["b"][2]=round(((@disk_free_space("b:")/(1024*1024*1024))/(@disk_total_space("b:")/(1024*1024*1024)))*100,2).'%';
$diskk+=round((@disk_free_space("b:")/(1024*1024*1024)),2);
$diskz+=round((@disk_total_space("b:")/(1024*1024*1024)),2);
}
if(@disk_total_space("c:")!=null)
{
$diskct++;
$disk["c"][0]=round((@disk_free_space("c:")/(1024*1024*1024)),2).'g';
$disk["c"][1]=round((@disk_total_space("c:")/(1024*1024*1024)),2).'g';
$disk["c"][2]=round(((@disk_free_space("c:")/(1024*1024*1024))/(@disk_total_space("c:")/(1024*1024*1024)))*100,2).'%';
$diskk+=round((@disk_free_space("c:")/(1024*1024*1024)),2);
$diskz+=round((@disk_total_space("c:")/(1024*1024*1024)),2);
}
if(@disk_total_space("d:")!=null)
{
$diskct++;
$disk["d"][0]=round((@disk_free_space("d:")/(1024*1024*1024)),2).'g';
$disk["d"][1]=round((@disk_total_space("d:")/(1024*1024*1024)),2).'g';
$disk["d"][2]=round(((@disk_free_space("d:")/(1024*1024*1024))/(@disk_total_space("d:")/(1024*1024*1024)))*100,2).'%';
$diskk+=round((@disk_free_space("d:")/(1024*1024*1024)),2);
$diskz+=round((@disk_total_space("d:")/(1024*1024*1024)),2);
}
if(@disk_total_space("e:")!=null)
{
$diskct++;
$disk["e"][0]=round((@disk_free_space("e:")/(1024*1024*1024)),2).'g';
$disk["e"][1]=round((@disk_total_space("e:")/(1024*1024*1024)),2).'g';
$disk["e"][2]=round(((@disk_free_space("e:")/(1024*1024*1024))/(@disk_total_space("e:")/(1024*1024*1024)))*100,2).'%';
$diskk+=round((@disk_free_space("e:")/(1024*1024*1024)),2);
$diskz+=round((@disk_total_space("e:")/(1024*1024*1024)),2);
}
if(@disk_total_space("f:")!=null)
{
$diskct++;
$disk["f"][0]=round((@disk_free_space("f:")/(1024*1024*1024)),2).'g';
$disk["f"][1]=round((@disk_total_space("f:")/(1024*1024*1024)),2).'g';
$disk["f"][2]=round(((@disk_free_space("f:")/(1024*1024*1024))/(@disk_total_space("f:")/(1024*1024*1024)))*100,2).'%';
$diskk+=round((@disk_free_space("f:")/(1024*1024*1024)),2);
$diskz+=round((@disk_total_space("f:")/(1024*1024*1024)),2);
}
if(@disk_total_space("g:")!=null)
{
$diskct++;
$disk["g"][0]=round((@disk_free_space("g:")/(1024*1024*1024)),2).'g';
$disk["g"][1]=round((@disk_total_space("g:")/(1024*1024*1024)),2).'g';
$diskk+=round((@disk_free_space("g:")/(1024*1024*1024)),2);
$diskz+=round((@disk_total_space("g:")/(1024*1024*1024)),2);
}
if(@disk_total_space("h:")!=null)
{
$diskct++;
$disk["h"][0]=round((@disk_free_space("h:")/(1024*1024*1024)),2).'g';
$disk["h"][1]=round((@disk_total_space("h:")/(1024*1024*1024)),2).'g';
$diskk+=round((@disk_free_space("h:")/(1024*1024*1024)),2);
$diskz+=round((@disk_total_space("h:")/(1024*1024*1024)),2);
}
if(@disk_total_space("i:")!=null)
{
$diskct++;
$disk["i"][0]=round((@disk_free_space("i:")/(1024*1024*1024)),2).'g';
$disk["i"][1]=round((@disk_total_space("i:")/(1024*1024*1024)),2).'g';
$diskk+=round((@disk_free_space("i:")/(1024*1024*1024)),2);
$diskz+=round((@disk_total_space("i:")/(1024*1024*1024)),2);
}
if(@disk_total_space("j:")!=null)
{
$diskct++;
$disk["j"][0]=round((@disk_free_space("j:")/(1024*1024*1024)),2).'g';
$disk["j"][1]=round((@disk_total_space("j:")/(1024*1024*1024)),2).'g';
$diskk+=round((@disk_free_space("j:")/(1024*1024*1024)),2);
$diskz+=round((@disk_total_space("j:")/(1024*1024*1024)),2);
}
if(@disk_total_space("k:")!=null)
{
$diskct++;
$disk["k"][0]=round((@disk_free_space("k:")/(1024*1024*1024)),2).'g';
$disk["k"][1]=round((@disk_total_space("k:")/(1024*1024*1024)),2).'g';
$diskk+=round((@disk_free_space("k:")/(1024*1024*1024)),2);
$diskz+=round((@disk_total_space("k:")/(1024*1024*1024)),2);
}
if(@disk_total_space("l:")!=null)
{
$diskct++;
$disk["l"][0]=round((@disk_free_space("l:")/(1024*1024*1024)),2).'g';
$disk["l"][1]=round((@disk_total_space("l:")/(1024*1024*1024)),2).'g';
$diskk+=round((@disk_free_space("l:")/(1024*1024*1024)),2);
$diskz+=round((@disk_total_space("l:")/(1024*1024*1024)),2);
}
?>
<!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" />
<title>php探针_b-check</title>
<style type="text/css">
body {background-color: #ffffff; color: #000000; font-size:12px; font-family:arial, helvetica, sans-serif;}
pre {margin: 0px;}
a {text-decoration: none; color: #000000;}
a:hover {text-decoration: none; background-color:#888888; color:#99ff00;}
table {border-collapse: collapse;margin: auto;}
td,th { border: 1px solid #000000; padding-left:4px; padding-right:4px; padding-top:3px; padding-bottom:1px; height: 22px; vertical-align:middle; text-align:left;}
span { font-weight:normal; padding-right:4px; }
.e {background-color: #ccccff; color: #000000;}
.h {background-color: #9999cc; font-weight: bold; color: #000000; font-size:14px; text-align:left;}
.vr {background-color: #cccccc; text-align: center; color: #000000;}
.vr2 {background-color: #cccccc; color: #000000;}
img {border: 0px;}
hr {width: 600px; background-color: #cccccc; border: 0px; height: 1px; color: #000000;}
.notice {color: #cc3300;}
.center {text-align:center;}
.gbutton {background-color: #ccccff;border-color:#003333;border-width:1px;}
.textborder {border-top-width: 1px;border-right-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-top-color: #9999cc;border-right-color: #9999cc;border-bottom-color: #9999cc;
border-left-color: #9999cc;}
.td1 {border-top: rgb(0,0,0) 1px groove; border-bottom: rgb(0,0,0) 1px groove; border-left: rgb(0,0,0) 1px groove; border-right: rgb(0,0,0) 1px groove}
.td2 {border-top: rgb(0,0,0) 1px groove; border-bottom: rgb(0,0,0) 1px groove; border-right: rgb(0,0,0) 1px groove}
</style>
<script type="text/javascript">
function showhide(item1){
var itemtable=document.getelementbyid(item1);
if(itemtable.style.display=='')
itemtable.style.display='none';
else
itemtable.style.display='';
}
</script>
</head>
<body>
<div style="margin:auto; width:700px;">
<div style="float:left; width:348px"><span style="font-size:55px; color:#3366ff; font-weight:bold; font-style:italic;">b-check</span> <?php echo version; ?></div>
<div style="float:right;width:348px; text-align:right;">
<script src="js/language.js" type="text/javascript"></script> | <a href="http://www.rubyfans.com/b-check/b-check.rar">下载最新版</a> | <a href="http://www.rubyfans.com">官方</a> | <a href="http://www.rubyfans.com">ror开发</a></div>
</div>
<table width="700" border="0" cellpadding="0" cellspacing="1">
<tr>
<td align="center" bgcolor="#9999cc"><a href="#tx">服务器特征</a></td>
<td align="center" bgcolor="#9999cc"><a href="#pz">php环境配置</a></td>
<td align="center" bgcolor="#9999cc"><a href="#zj">php组件支持</a></td>
<td align="center" bgcolor="#9999cc"><a href="#bottom">性能测试</a></td>
<td align="center" bgcolor="#9999cc"><a href="#bottom">bug上报</a></td>
<td align="center" bgcolor="#9999cc"><a href="<?php echo $_server['php_self'] ?>">刷新</a>
</td>
</tr>
</table>
<div style="margin:auto;">
<img src="" alt="" name="xuhao" width="1" height="5" id="xuhao" />
</div>
<table width="700" border="0" cellspacing="1" cellpadding="0">
<tr>
<td colspan="2" class="h">
<a name="tx" id="tx"></a>
<div style="float:left;width:49%">
<font face="webdings, sans-serif">8</font>服务器参数 </div>
<div style="float:right;width:50%;text-align:right;"><a href="<?php $_server['php_self']?>?action=phpinfo_general" target="_blank">phpinfo()中的服务器信息</a></div> </td>
</tr>
<tr>
<td width="126" class="e">服务器域名/ip:</td>
<td width="571"><?php echo $_server['server_name']." (".$_server['remote_addr'].")"; ?></td>
</tr>
<tr>
<td class="e">web服务端口:</td>
<td><?php echo $_server['server_port']; ?></td>
</tr>
<tr>
<td class="e">服务器类型/版本:</td>
<td><?php echo $_server['server_software']; ?></td>
</tr>
<tr>
<td class="e">服务器操作系统:</td>
<td><?php echo php_os." (".php_uname().")"; ?></td>
</tr>
<tr>
<td class="e">网站跟目录:</td>
<td><?php echo $_server['document_root']; ?></td>
</tr>
<tr>
<td class="e">当前文件位置:</td>
<td><?php echo $_server['script_filename']; ?></td>
</tr>
<!-- 如果系统不是winnt的,不显示以下信息 -->
<?php if (php_os=="winnt"){?>
<tr>
<td class="e">系统目录:</td>
<td><?php echo getenv('systemroot')?getenv('systemroot'):"<font color=red>获取失败!</font>"; ?> <a href="javascript:showhide('sysroot');" title="点击此处查看提示信息"><img src="http://www.jbxue.net/admin/images/notice.gif" width="16" height="16" alt="点击此处查看提示信息" border="0"/></a>
<div id="sysroot" class="notice" style="display:none;">
<div style="border-bottom:1px dashed #ccc"></div>
<strong>path:</strong><?php echo getenv('path')?getenv('path'):"<font color=red>获取失败!</font>"; ?><br />
<strong>temp:</strong><?php echo getenv('temp')?getenv('temp'):"<font color=red>获取失败!</font>"; ?><br>
<strong>pathext:</strong><?php echo getenv('pathext')?getenv('pathext'):"<font color=red>获取失败!</font>"; ?></div></td>
</tr>
<tr>
<td class="e">处理器(cpu)信息:</td>
<td><?php echo getenv('processor_identifier')?getenv('processor_identifier'):"<font color=red>获取失败!</font>"; ?> <a href="javascript:showhide('cpu');" title="点击此处查看提示信息"><img src="http://www.jbxue.net/admin/images/notice.gif" width="16" height="16" alt="点击此处查看提示信息" border="0"/></a>
<div id="cpu" class="notice" style="display:none;">
<div style="border-bottom:1px dashed #ccc;"></div>
从左至右分别表示type(类型)、family(系列)、mode(型号)、stepping(步进编号)和brand id(品种标识),一般cpu都有brand id,如果cpu不是非常老的话。你可以通过brand id(品种标识)来判断服务器cpu是什么型号档次的,具体怎么判断你可以去百度或百度知道搜索!在此不细说明!</div></td>
</tr>
<tr>
<td class="e">处理器(cpu)个数:</td>
<td><?php echo getenv('number_of_processors')?getenv('number_of_processors'):"获取失败!"; ?> <a href="javascript:showhide('cpunm');" title="点击此处查看提示信息"><img src="http://www.jbxue.net/admin/images/notice.gif" width="16" height="16" alt="点击此处查看提示信息" border="0"/></a>
<div id="cpunm" class="notice" style="display:none;">
<div style="border-bottom:1px dashed #ccc;"></div>
逻辑处理器个数,idc客服的话的可信度没有上面这个数字的可信度高。但如果上面的数是16,在以后的几年里你最好别相信那是真的。如果是... 32...(开个玩笑)</div></td>
</tr>
<?php }?>
<tr>
<td class="e">服务器时间:</td>
<td><?php echo date("y年n月j日 g:i:s a");?></td>
</tr>
<!-- 如果系统不是winnt的,不显示以下信息 -->
<?php if (php_os=="winnt"){?>
<tr>
<td class="e">磁盘空间信息:</td>
<td>
<?php if($diskct>0) {?>
<table width="100%">
<tr><th width="50">盘符</th><th width="80">总空间</th><th width="80">剩余空间</th><th>剩余百分比</th></tr>
<?php foreach($disk as $key=>$value){ ?>
<tr>
<td><?php echo $key.'盘'; ?></td>
<td><?php echo $value[1]; ?></td>
<td><?php echo $value[0]; ?></td>
<td>
<div style="border:1px solid #999">
<div style="width:<?php echo $value[2]; ?>;background-color:green; color:#fff;"> <?php echo $value[2]; ?></div>
</div>
</td>
</tr>
<?php } ?>
<tr style="background-color: #e5e5e5">
<th>总计</th>
<td><?php
// if(abs($diskz-80)<50)
// {
// echo '80g';
// }
// elseif(abs($diskz-160)<30)
// {
// echo '160g';
// }
// elseif(abs($diskz-250)<30)
// {
// echo '250g';
// }
// elseif(abs($diskz-320)<30)
// {
// echo '320g';
// }
// elseif(abs($diskz-500)<30)
// {
// echo '500g';
// }
// elseif(abs($diskz-640)<30)
// {
// echo '640g';
// }
// elseif(abs($diskz-750)<30)
// {
// echo '750g';
// }
// elseif(abs($diskz-1024)<30)
// {
// echo '1tb';
// }
// elseif(abs($diskz-1024)<30)
// {
// echo '1tb';
// }
// elseif(abs($diskz-1536)<30)
// {
// echo '1.5tb';
// }
// elseif(abs($diskz-2048)<30)
// {
// echo '2tb';
// }
echo $diskz; ?>g</td>
<td><? echo $diskk.'g'; ?></td>
<td>
<div style="border:1px solid #999">
<div style="width:<?php echo round(($diskk/$diskz)*100,2) ?>%;background-color:green; color:#fff;"> <?php echo round(($diskk/$diskz)*100,2) ?>%</div>
</div>
</td>
</tr>
</table>
<?php }else{echo '探测失败!';} ?>
<br />
声明:只能探测盘符为大写字母a-l的磁盘,且有权限获取!
</td>
</tr>
<?php }?>
</table>
<div style="margin:auto;">
<img src="" alt="" name="xuhao" width="1" height="5" id="xuhao" />
</div>
<table width="700" border="0" cellspacing="1" cellpadding="0">
<tr>
<td colspan="2" class="h">
<a name="pz" id="pz"></a>
<div style="float:left;width:49%">
<font face="webdings, sans-serif">8</font>php环境基本配置(php.ini)</div>
<div style="float:right;width:50%;text-align:right;"><a href="<?php $_server['php_self']?>?action=phpinfo_configuration" target="_blank">phpinfo()中的基本配置信息</a></div> </td>
</tr>
<tr>
<td width="256" class="e">运行方式:</td>
<td width="441"><?php echo strtoupper(php_sapi_name()); ?></td>
</tr>
<tr>
<td class="e">php版本:</td>
<td><?php echo phpversion(); ?></td>
</tr>
<tr>
<td class="e">zend版本:</td>
<td><?php echo zend_version(); ?></td>
</tr>
<!-- 如果系统不是winnt的,不显示以下信息 -->
<?php if (php_os=="winnt"){?>
<tr>
<td class="e">zend optimizer版本:</td>
<td><?php echo checkoptimizer(); ?> <a href="javascript:showhide('optimizer');" title="点击此处查看提示信息"><img src="http://www.jbxue.net/admin/images/notice.gif" width="16" height="16" alt="点击此处查看提示信息" border="0"/></a>
<div id="optimizer" class="notice" style="display:none;">
<div style="border-bottom:1px dashed #ccc;"></div>
zend optimizer仔细检查所有运行 zend 编译器产生的代码,分析并做优化,让它运行得更快。经过测试确实可以提高程序运行速度超过60%,并且降低了程序对系统资源的耗用。 </div></td>
</tr>
<?php }?>
<tr>
<td class="e">mysql客户端库版本:</td>
<td><?php echo (false!=mysql_get_client_info())?mysql_get_client_info():"获取失败!";?> <a href="javascript:showhide('sqlcl');" title="点击此处查看提示信息"><img src="http://www.jbxue.net/admin/images/notice.gif" width="16" height="16" alt="点击此处查看提示信息" border="0"/></a>
<div id="sqlcl" class="notice" style="display:none;">
<div style="border-bottom:1px dashed #ccc;"></div>
若成功获取,不要误会是服务器端的mysql版本了,下面在做mysql连接测试时会探测服务器的mysql版本的。 </div></td>
</tr>
<tr>
<td class="e">zend编译运行:</td>
<td><?php echo (get_cfg_var("zend_optimizer.optimization_level")||get_cfg_var("zend_extension_manager.optimizer_ts")||get_cfg_var("zend_extension_ts")) ?on:off; //参考iprober?></td>
</tr>
<tr>
<td class="e">运行于安全模式:(safe_mode)</td>
<td><?php echo getvar("safe_mode"); ?></td>
</tr>
<tr>
<td class="e">访问 url 对象:(allow_url_fopen)</td>
<td><?php echo getvar("allow_url_fopen"); ?></td>
</tr>
<tr>
<td class="e">注册全局变量:(register_globals)</td>
<td><?php echo getvar("register_globals"); ?></td>
</tr>
<tr>
<td class="e">魔术引号开启:(magic_quotes_gpc)</td>
<td><?php echo getvar("magic_quotes_gpc"); ?></td>
</tr>
<tr>
<td class="e">短标记支持:(short_open_tag)</td>
<td><?php echo getvar("short_open_tag"); ?> <a href="javascript:showhide('shortag');" title="点击此处查看提示信息"><img src="http://www.jbxue.net/admin/images/notice.gif" width="16" height="16" alt="点击此处查看提示信息" border="0"/></a>
<div id="shortag" class="notice" style="display:none;">
<div style="border-bottom:1px dashed #ccc;"></div>
允许使用 php 代码开始标志的缩写形式(<? ?>)。很多php程序都使用短标记,如著名的discuz!。如果你的空间不支持这个的话,要当心放dz论坛哦。</div></td>
</tr>
<tr>
<td class="e">自动转义溢出字符:(magic_quotes_runtime)</td>
<td><?php echo getvar("magic_quotes_runtime"); ?></td>
</tr>
<tr>
<td class="e">允许动态加载链接库:(enable_dl)</td>
<td><?php echo getvar("enable_dl"); ?></td>
</tr>
<tr>
<td class="e">显示错误信息:(display_errors)</td>
<td><?php echo getvar("display_errors"); ?></td>
</tr>
<tr>
<td class="e">post最大数据量:(post_max_size)</td>
<td><?php echo getvar("post_max_size"); ?></td>
</tr>
<tr>
<td class="e">上传文件的最大大小:(upload_max_filesize)</td>
<td><?php echo getvar("upload_max_filesize"); ?></td>
</tr><strong></strong>
<tr>
<td class="e">脚本最大内存使用量:(memory_limit)</td>
<td><?php echo getvar("memory_limit"); ?></td>
</tr>
<tr>
<td class="e">查看phpinfo():</td>
<td><a href="<?php $_server['php_self']?>?action=phpinfo" target="_blank">phpinfo</a></td>
</tr>
</table>
<div style="margin:auto;">
<img src="" alt="" name="xuhao" width="1" height="5" id="xuhao" />
</div>
<table width="700" border="0" cellspacing="1" cellpadding="0">
<tr>
<td colspan="4" class="h"><a name="zj" id="zj"></a>
<div style="float:left;width:49%"> <font face="webdings, sans-serif">8</font>php组件支持情况 </div>
<div style="float:right;width:50%;text-align:right;"><a href="<?php $_server['php_self']?>?action=phpinfo_modules" target="_blank">phpinfo()的组件支持信息</a></div></td>
</tr>
<tr>
<td width="259" class="e">mysql数据库:</td>
<td width="87"><?php echo getfunexists("mysql_close"); ?></td>
<td width="270" class="e">图形处理 gd 库:</td>
<td width="79"><?php echo getfunexists("gd_info"); ?></td>
</tr>
<tr>
<td class="e">sql server数据库:</td>
<td><?php echo getfunexists("mssql_close"); ?></td>
<td class="e">pdf文档支持:</td>
<td><?php echo getfunexists("pdf_close"); ?></td>
</tr>
<tr>
<td class="e">oracle数据库:</td>
<td><?php echo getfunexists("ora_close"); ?></td>
<td class="e">fdf文档支持:</td>
<td><?php echo getfunexists("fdf_get_ap"); ?></td>
</tr>
<tr>
<td class="e">oracle 8 数据库:</td>
<td><?php echo getfunexists("ocilogoff"); ?></td>
<td class="e">session支持:</td>
<td><?php echo getfunexists("session_start"); ?></td>
</tr>
<tr>
<td class="e">msql数据库:</td>
<td><?php echo getfunexists("msql_close"); ?></td>
<td class="e">socket支持:</td>
<td><?php echo getfunexists("socket_accept"); ?></td>
</tr>
<tr>
<td class="e">sybase数据库:</td>
<td><?php echo getfunexists("sybase_close"); ?></td>
<td class="e">xml解析支持:</td>
<td><?php echo getfunexists("xml_set_object"); ?></td>
</tr>
<tr>
<td class="e">postgre sql数据库:</td>
<td><?php echo getfunexists("pg_close"); ?></td>
<td class="e">ftp支持:</td>
<td><?php echo getfunexists("ftp_login"); ?></td>
</tr>
<tr>
<td class="e">informix数据库:</td>
<td><?php echo getfunexists("ifx_close"); ?></td>
<td class="e">odbc数据库连接:</td>
<td><?php echo getfunexists("odbc_close"); ?></td>
</tr>
<tr>
<td class="e">hyperwave数据库:</td>
<td><?php echo getfunexists("hw_close"); ?></td>
<td class="e">压缩文件支持(zlib):</td>
<td><?php echo getfunexists("gzclose"); ?></td>
</tr>
<tr>
<td class="e">filepro数据库:</td>
<td><?php echo getfunexists("filepro_fieldcount"); ?></td>
<td class="e">yellow page系统:</td>
<td><?php echo getfunexists("yp_match"); ?></td>
</tr>
<tr>
<td class="e">dbm数据库:</td>
<td><?php echo getfunexists("dbmclose"); ?></td>
<td class="e">snmp网络管理协议:</td>
<td><?php echo getfunexists("snmpget"); ?></td>
</tr>
<tr>
<td class="e">dba数据库:</td>
<td><?php echo getfunexists("dba_close"); ?></td>
<td class="e">wddx支持:</td>
<td><?php echo getfunexists("wddx_add_vars"); ?></td>
</tr>
<tr>
<td class="e">dbase数据库:</td>
<td><?php echo getfunexists("dbase_close"); ?></td>
<td class="e">拼写检查 aspell library:</td>
<td><?php echo getfunexists("aspell_check_raw"); ?></td>
</tr>
<tr>
<td class="e">imap电子邮件系统:</td>
<td><?php echo getfunexists("imap_close"); ?></td>
<td class="e">历法运算 calendar:</td>
<td><?php echo getfunexists("cal_days_in_month"); ?></td>
</tr>
<tr>
<td class="e">vmailmgr邮件处理:</td>
<td><?php echo getfunexists("vm_adduser"); ?></td>
<td class="e">ldap目录协议:</td>
<td><?php echo getfunexists("ldap_close"); ?></td>
</tr>
<tr>
<td class="e">mcrypt加密处理:</td>
<td><?php echo getfunexists("mcrypt_cbc"); ?></td>
<td class="e">prel相容语法 pcre:</td>
<td><?php echo getfunexists("preg_match"); ?></td>
</tr>
<tr>
<td class="e">高精度数学运算 bcmath:</td>
<td><?php echo getfunexists("bcadd"); ?></td>
<td class="e">哈稀计算 mhash:</td>
<td><?php echo getfunexists("mhash_count"); ?></td>
</tr>
<tr>
<td colspan="4" class="e">所有已编译模块: <br />
<?php
$able=get_loaded_extensions();
foreach ($able as $key=>$value) {
if ($key!=0 && $key%13==0) {
echo '<br />';
}
echo "$value ";
}
?></td>
</tr>
</table>
<div style="margin:auto;">
<img src="" alt="" name="xuhao" width="1" height="5" id="xuhao" />
</div>
<form method="post" action="<?php echo $_server['php_self']; ?>#bottom" style="margin:0;">
<input name="tsint" type="hidden" value="<?php echo $ts_int;?> " />
<input name="tsfloat" type="hidden" value="<?php echo $ts_float;?> " />
<input name="tsio" type="hidden" value="<?php echo $ts_io;?> " />
<input name="speed" type="hidden" value="<?php echo $speed;?> " />
<table width="700" border="0" cellspacing="1" cellpadding="0">
<tr>
<td colspan="4" class="h"><a name="xn" id="xn"></a><font face="webdings, sans-serif">8</font>服务器性能测试</td>
</tr>
<tr>
<td width="250" class="vr">检测对象</td>
<td width="148" class="vr">整数运算能力测试<br />
(1+1运算300万次)</td>
<td width="148" class="vr">浮点运算能力测试<br />
(开平方300万次)</td>
<td width="148" class="vr">数据i/o能力测试<br />
(读取<font color="red"><?php echo (round(filesize("xuhao.php")/1024)!=0)?round(filesize("xuhao.php")/1024):"44";?>k</font>文件30万次)</td>
</tr>
<tr>
<td class="center">南方第三的电脑(amd4000+ 1g)</td>
<td class="center">0.3502 秒</td>
<td class="center">0.3591 秒</td>
<td class="center">0.0394 秒</td>
</tr>
<tr>
<td class="center">92合租浙江贵宾10人合租空间</td>
<td class="center">0.2112 秒</td>
<td class="center">0.2240 秒</td>
<td class="center">0.0225 秒</td>
</tr>
<tr>
<td class="center">正在使用的这台服务器</td>
<td class="center"><?php echo "<font color="#006600"><b>".$ts_int."</b></font>"; ?> 秒<br /><input name="action" type="submit" class="gbutton" value="整数运算" /></td>
<td class="center"><?php echo "<font color="#006600"><b>".$ts_float."</b></font>"; ?> 秒<br /><input name="action" type="submit" class="gbutton" value="浮点运算" /></td>
<td class="center"><?php echo "<font color="#006600"><b>".$ts_io."</b></font>"; ?> 秒<br /><input name="action" type="submit" class="gbutton" value="io测试" /></td>
</tr>
<tr>
<td class="center">网络速度测试:
<input name="action" type="submit" class="gbutton" value="开始测试" />
<br />
(向客户端传送 100k 字节数据)
</td>
<td colspan="3">
<table style="margin:0px;border:none;" align="center" width="500" border="0" cellspacing="0" cellpadding="0">
<tr style="border-bottom:none;"><td height="15" width="32" style="border-bottom:none;">1m</td>
<td height="15" width="231" style="border-bottom:none;"> 2m adsl</td>
<td height="15" width="237" style="border-bottom:none;"> 10m lan</td>
</tr>
</table>
<table style="margin:0px" align="center" width="500" border="0" cellspacing=0 cellpadding=0>
<tr>
<td bgcolor="#009900" style="padding:0;margin:0;height:10px;" width="<?php
if(preg_match("/[^d-., ]/",$speed))
{
echo "0";
}
else{
echo 500*$speed/(1024*4);
}
?>"></td>
<td height="10" width="<?php
if(preg_match("/[^d-., ]/",$speed))
{
echo "500";
}
else{
echo 500-500*$speed/(1024*4);
}
?>"><?php echo $speed; ?> kb/s</td>
</tr>
</table>
<?php echo (isset($_get['speed']))?"向客户端传送100k字节数据使了<font color="red">".$_get['speed']."</font>毫秒":"<font color=red> 未探测 </font>" ?></td>
</tr>
</table>
<div style="margin:auto;"> <img src="" alt="" name="xuhao" width="5" height="5" id="xuhao2" /> </div>
<table width="700" border="0" cellspacing="1" cellpadding="0">
<tr>
<td colspan="4" class="h"><font face="webdings, sans-serif">8</font>自定义测试项目</td>
</tr>
<?php if(getfunexists("mysql_close")==on){?>
<tr>
<td colspan="4" class="e">myslq数据库连接测试</td>
</tr>
<tr>
<td width="111">mysql服务器:</td>
<td width="152"><label>
<input name="mysqlhost" type="text" class="textborder" id="mysqlhost" size="15" />
</label></td>
<td width="116">mysql用户名:</td>
<td width="316"><label>
<input name="mysqluser" type="text" class="textborder" id="mysqluser" size="15" />
</label></td>
</tr>
<tr>
<td>mysql密码:</td>
<td><label>
<input name="mysqlpsd" type="text" class="textborder" id="mysqlpsd" size="15" />
</label></td>
<td>mysql数据库名称:</td>
<td><label>
<input name="mysqldb" type="text" class="textborder" id="mysqldb" size="15" />
</label>
<label>
<input name="action" type="submit" class="gbutton" id="button2" value="连接mysql" />
</label></td>
</tr>
<?php
}
if("show"==$mysqlreshow){
?>
<tr>
<td colspan="4" class="vr2"><?php echo $mysqlre; ?> <a href="javascript:showhide('mysql');" title="点击此处查看提示信息"><img src="http://www.jbxue.net/admin/images/notice.gif" width="16" height="16" alt="点击此处查看提示信息" border="0"/></a>
<div id="mysql" class="notice" style="display:none;">
<div style="border-bottom:1px dashed #ccc;"></div>
服务器mysql版本:<?php echo $mysql_version; ?> 如果数据库连接失败,将无法探测该项!</div></td>
</tr>
<?php } ?>
<tr>
<td colspan="4" class="e">mail邮件发送测试</td>
</tr>
<tr>
<td>测试邮件发送到:</td>
<td colspan="3"><label>
<input name="to" type="text" class="textborder" id="textfield" />
<input name="action" type="submit" class="gbutton" id="button3" value="发送" />
</label> <?php echo $mailre; ?></td>
</tr>
<tr>
<td colspan="4" class="e">函数支持检测</td>
</tr>
<tr>
<td>探测的函数名:</td>
<td colspan="3"><label>
<input name="funame" type="text" class="textborder" id="textfield2" />
<input name="action" type="submit" class="gbutton" id="button4" value="检测" />
</label><?php echo $funre; ?></td>
</tr>
<tr>
<td colspan="4" class="e">php配置(php.ini)检测</td>
</tr>
<tr>
<td>探测的参数名:</td>
<td colspan="3"><label>
<input name="pm" type="text" class="textborder" id="textfield2" />
<input name="action" type="submit" class="gbutton" id="button4" value="检测1" />
</label><?php echo $pmre; ?></td>
</tr>
</table>
<div style="margin:auto;"> <img src="" alt="" name="xuhao" width="5" height="5" id="xuhao2" /> </div>
<table width="700" border="0" cellspacing="1" cellpadding="0">
<tr>
<td valign="middle" class="vr2">bug上报:
<input name="buginfo" type="text" class="textborder" id="textarea" value="" size="80" />
<input name="act" type="submit" class="gbutton" id="button" value="提交" />
<?php echo $jgprint; ?>
</td>
</tr>
</table>
</form>
<div style="margin:auto;">
<img src="" alt="" name="xuhao" width="1" height="5" id="xuhao" />
</div>
<table width="700" border="0" cellspacing="1" cellpadding="0">
<tr>
<?php
$pagendtime=getmicrotime();
$pagetime=round($pagendtime-$pagestartime,5);
?>
<td align="center" class="e">
<div style="float:left;width:40%; text-align:right;">
<img src="<?php echo $_server['php_self']."?=" . php_logo_guid(); ?>" alt="php logo !" />
<img src="<?php echo $_server['php_self']."?=" . zend_logo_guid(); ?>" alt="zend logo !" />
</div>
<div style="float:right;width:59%; text-align:left; line-height:18px;">
<a href="http://www.jb200.com">南方第三</a>制作 欢迎访问ruby爱好:<a href="http://www.jb200.com/" target="_blank">www.rubyfans.com</a> <a href="http://www.jb200.com/" target="_blank">ruby on rails开发</a><br />
制作平台:winxp apache v2.0.63 php v5.2.6 mysql v5.0.51b 现学现卖<br />
版本:<?php echo version; ?> 完成时间:<?php echo overtime; ?> <br />
页面执行时间<?php echo $pagetime; ?>秒
<a name="bottom" id="bottom"></a></div>
</td>
</tr>
</table>
<div style="margin:auto;">
<img src="" alt="" name="xuhao" width="1" height="5" id="xuhao" />
</div>
<table width="700" cellspacing="0" cellpadding="0">
<tr align="center">
<td class="td1" width="173"><a href="http://www.php.net/downloads.php" target="_blank">下载php</a></td>
<td class="td2" width="173"><a href="http://dev.mysql.com/downloads/mysql/5.1.html" target="_blank">下载mysql</a></td>
<td class="td2" width="173"><a href="http://www.zend.com/en/products/guard/downloads" target="_blank">下载zend optimizer</a></td>
<td class="td1" width="173"><a href="http://httpd.apache.org/download.cgi" target="_blank">下载apache</a></td>
</tr>
</table>
</body>
</html>
演示截图:
php服务器探针显示php服务器信息
PHP探针获取客户端信息
带查看密码的php探针代码
php探针不显示cpu、内存、硬盘信息原因分析