php禁用函數(shù)設(shè)置及查看方法詳解
本文實(shí)例講述了php禁用函數(shù)設(shè)置及查看方法。分享給大家供大家參考,具體如下:
打開PHP.INI,找到這行:
disable_functions =
在后面那里加上要禁用的函數(shù),如禁用多個(gè)函數(shù),要用半角逗號(hào) , 分開
給個(gè)例子:
ellcmd,escapeshellarg,shell_exec,proc_open,proc_get_status
建議在主機(jī)上禁用的函數(shù):
在主機(jī)上面如何查看禁用的函數(shù)列表,我從網(wǎng)上找了一個(gè)非常不錯(cuò)的探針
<?php
header("content-Type: text/html; charset=utf-8");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
error_reporting(0);
ob_end_flush();
?>
<!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="Pragma" content="No-cache" />
<meta http-equiv="Expires" content="0" />
<meta http-equiv="cache-control" content="private" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />//加了這句,看看能不能解決linux下顯示亂碼的問(wèn)題?
<title>PHP 探針 v1.0</title>
<style type="text/css">
<!--
body{text-align:center;margin-top:20px;background-color:#a9b674;}
#overview{width:700px;margin:0 auto;text-align:left;}
a{text-decoration:underline;color:#992700;}
.strong{color:#992700;}
.basew{width:300px;}
-->
</style>
</head>
<body>
<div id="overview">
<div id="copyright">版權(quán)信息
<a href="hello.php?typ=baseinfo">[基本信息]</a> <a href="hello.php?typ=superinfo">[高級(jí)信息]</a>
<?php
if (function_exists("phpinfo")){
echo'<a href="hello.php?typ=phpinfo">[phpinfo]</a>';}
echo'<br />php探針v1.0 by MKDuse(blueidea-id)<br /><br />此程序代碼,可免費(fèi)使用;但不得用于商業(yè)用途;完全轉(zhuǎn)載或使用此代碼,請(qǐng)保留版權(quán)信息;<br />歡迎指正錯(cuò)誤提建議,QQ:122712355</div>';
if (empty($_GET['typ'])){
baseinfo();}
else{
switch ($_GET['typ']){
case 'phpinfo':
phpinfoview();
break;
case 'superinfo':
superinfo();
break;
case 'baseinfo':
baseinfo();
break;
default:
baseinfo();}
}
function getime()
{
$t = gettimeofday();
return (float)($t['sec'] + $t['usec']/1000000);
}
function baseinfo(){
echo '<h1>基本信息</h1>';
$arr[]=array("Current PHP version:",phpversion());
$arr[]=array("Zend engine version:",zend_version());
$arr[]=array("服務(wù)器版本",$_SERVER['SERVER_SOFTWARE']);
$arr[]=array("ip地址",$_SERVER['REMOTE_HOST']);//ip
$arr[]=array("域名",$_SERVER['HTTP_HOST']);
$arr[]=array("協(xié)議端口",$_SERVER['SERVER_PROTOCOL'].' '.$_SERVER['SERVER_PORT']);
$arr[]=array("站點(diǎn)根目錄",$_SERVER['PATH_TRANSLATED']);
$arr[]=array("服務(wù)器時(shí)間",date('Y年m月d日,H:i:s,D'));
$arr[]=array("當(dāng)前用戶",get_current_user());
$arr[]=array("操作系統(tǒng)",php_uname('s').php_uname('r').php_uname('v'));
$arr[]=array("include_path",ini_get('include_path'));
$arr[]=array("Server API",php_sapi_name());
$arr[]=array("error_reporting level",ini_get("display_errors"));
$arr[]=array("POST提交限制",ini_get('post_max_size'));
$arr[]=array("upload_max_filesize",ini_get('upload_max_filesize'));
$arr[]=array("腳本超時(shí)時(shí)間",ini_get('max_execution_time').'秒');
if (ini_get("safe_mode")==0){
$arr[]=array("PHP安全模式(Safe_mode)",'off');}
else{
$arr[]=array("PHP安全模式(Safe_mode)",'on');}
if (function_exists('memory_get_usage')){
$arr[]=array("memory_get_usage",ini_get('memory_get_usage'));}
//$arr[]=array("可用空間",intval(diskfreespace('/')/(1024 * 1024))."M");
echo'<table>';
for($i=0;$i<count($arr);$i++)
{
$overview='<tr><td class="basew">'.$arr[$i][0].'</td><td>'.$arr[$i][1].'</td></tr>';
echo $overview;
}
echo'</table>';
echo '<h2>服務(wù)器性能測(cè)試</h2>';
echo'<table><tr><td>服務(wù)器</td><td>整數(shù)運(yùn)算<br />50萬(wàn)次加法(1+1)</td><td>浮點(diǎn)運(yùn)算<br />50萬(wàn)次平方根(3.14開方)</td></tr>';
echo'<tr><td>MKDuse的機(jī)子(P4 1.5G 256DDR winxp sp2)</td><td>465.08ms</td><td>466.66ms</td></tr>';
$time_start=getime();
for($i=0;$i<=500000;$i++);
{$count=1+1;}
$timea=round((getime()-$time_start)*1000,2);
echo '<tr class="strong"><td>當(dāng)前服務(wù)器</td><td>'.$timea.'ms</td>';
$time_start=getime();
for($i=0;$i<=500000;$i++);
{sqrt(3.14);}
$timea=round((getime()-$time_start)*1000,2);
echo '<td>'.$timea.'ms</td></tr></table>';
?>
<script language="javascript" type="text/javascript">
function gettime()
{
var time;
time=new Date();
return time.getTime();
}
start_time=gettime();
</script>
<?php
echo '<h2>帶寬測(cè)試</h2>';
for ($i=0;$i<100;$i++){
print "<!--1234567890#########0#########0#########0#########0#########0#########0#########0#########012345-->";}
?>
<p id="dk"></p>
<script language="javascript" type='text/javascript'>
var timea;
var netspeed;
timea=gettime()-start_time;
netspeed=Math.round(10/timea*1000);
document.getElementByIdx("dk").innerHTML="向客戶端發(fā)送10KB數(shù)據(jù),耗時(shí)"+timea+"ms<br />您與此服務(wù)器的連接速度為"+netspeed+"kb/s";
</script>
<?php
echo'<h2>已加載的擴(kuò)展庫(kù)(enable)</h2><div>';
$arr =get_loaded_extensions();
foreach($arr as $value){
echo $value.'<br />';}
echo'</div><h2>禁用的函數(shù)</h2><p>';
$disfun=ini_get('disable_functions');
if (empty($disfun)){
echo'沒(méi)有禁用</p>';}
else{
echo ini_get('disable_functions').'</p>';}
}//關(guān)閉
function superinfo(){
echo'<h1>高級(jí)信息</h1><p>PHP_INI_USER 1 配置選項(xiàng)可用在用戶的 PHP 腳本或Windows 注冊(cè)表中<br> PHP_INI_PERDIR 2 配置選項(xiàng)可在 php.ini, .htaccess 或 httpd.conf 中設(shè)置 <br>PHP_INI_SYSTEM 4 配置選項(xiàng)可在 php.ini or httpd.conf 中設(shè)置 <br>PHP_INI_ALL 7 配置選項(xiàng)可在各處設(shè)置</p>';
$arr1=ini_get_all();
for ($i=0;$i<count($arr1);$i++)
{
$arr2=array_slice($arr1,$i,1);
print_r($arr2);
echo '<br />';
}
}
function phpinfoview(){
phpinfo();
}
?>
</div>
</body>
</html>
更多關(guān)于PHP相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《php程序設(shè)計(jì)安全教程》、《php面向?qū)ο蟪绦蛟O(shè)計(jì)入門教程》、《PHP數(shù)學(xué)運(yùn)算技巧總結(jié)》、《PHP數(shù)組(Array)操作技巧大全》、《php字符串(string)用法總結(jié)》、《PHP數(shù)據(jù)結(jié)構(gòu)與算法教程》、《php程序設(shè)計(jì)算法總結(jié)》及《php常見(jiàn)數(shù)據(jù)庫(kù)操作技巧匯總》
希望本文所述對(duì)大家PHP程序設(shè)計(jì)有所幫助。
相關(guān)文章
字符串長(zhǎng)度函數(shù)strlen和mb_strlen的區(qū)別示例介紹
strlen和mb_strlen的區(qū)別,但是對(duì)于一些初學(xué)者來(lái)說(shuō),如果不看手冊(cè),也許不太清楚其中的區(qū)別,下面與大家分享下兩者之間的區(qū)別2014-09-09
通過(guò)緩存數(shù)據(jù)庫(kù)結(jié)果提高PHP性能的原理介紹
眾所周知,緩存數(shù)據(jù)庫(kù)查詢的結(jié)果可以顯著縮短腳本執(zhí)行時(shí)間,并最大限度地減少數(shù)據(jù)庫(kù)服務(wù)器上的負(fù)載。如果要處理的數(shù)據(jù)基本上是靜態(tài)的,則該技術(shù)將非常有效。這是因?yàn)閷?duì)遠(yuǎn)程數(shù)據(jù)庫(kù)的許多數(shù)據(jù)請(qǐng)求最終可以從本地緩存得到滿足,從而不必連接到數(shù)據(jù)庫(kù)、執(zhí)行查詢以及獲取結(jié)果2012-09-09
非常好用的兩個(gè)PHP函數(shù) serialize()和unserialize()
php引用和拷貝的區(qū)別知識(shí)點(diǎn)總結(jié)
linux平臺(tái)編譯安裝PHP7并安裝Redis擴(kuò)展與Swoole擴(kuò)展實(shí)例教程

