本篇文章给大家带来的内容是关于php禁用函数设置及查看方法的介绍(附示例),有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。
这篇文章主要介绍了php禁用函数设置及查看方法,结合实例形式分析了php禁用函数的方法及使用php探针查看禁用函数信息的相关实现技巧,需要的朋友可以参考下
本文实例讲述了php禁用函数设置及查看方法。分享给大家供大家参考,具体如下:
打开PHP.INI,找到这行:
disable_functions =
在后面那里加上要禁用的函数,如禁用多个函数,要用半角逗号 , 分开
给个例子:
disable_functions = passthru,exec,system,popen,chroot,scandir,chgrp,chown,escapesh ellcmd,escapeshellarg,shell_exec,proc_open,proc_get_status
建议在主机上禁用的函数:
disable_functions = system,exec,shell_exec,passthru,proc_open,proc_close, proc_get_status,checkdnsrr,getmxrr,getservbyname,getservbyport, syslog,popen,show_source,highlight_file,dl,socket_listen,socket_create,socket_bind,socket_accept, socket_connect, stream_socket_server, stream_socket_accept,stream_socket_client,ftp_connect, ftp_login,ftp_pasv,ftp_get,sys_getloadavg,disk_total_space, disk_free_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname
在主机上面如何查看禁用的函数列表,我从网上找了一个非常不错的探针
<?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下显示乱码的问题? <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">版权信息 <a href="hello.php?typ=baseinfo">[基本信息]</a> <a href="hello.php?typ=superinfo">[高级信息]</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 />此程序代码,可免费使用;但不得用于商业用途;完全转载或使用此代码,请保留版权信息;<br />欢迎指正错误提建议,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("服务器版本",$_SERVER['SERVER_SOFTWARE']); $arr[]=array("ip地址",$_SERVER['REMOTE_HOST']);//ip $arr[]=array("域名",$_SERVER['HTTP_HOST']); $arr[]=array("协议端口",$_SERVER['SERVER_PROTOCOL'].' '.$_SERVER['SERVER_PORT']); $arr[]=array("站点根目录",$_SERVER['PATH_TRANSLATED']); $arr[]=array("服务器时间",date('Y年m月d日,H:i:s,D')); $arr[]=array("当前用户",get_current_user()); $arr[]=array("操作系统",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("脚本超时时间",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>服务器性能测试</h2>'; echo'<table><tr><td>服务器</td><td>整数运算<br />50万次加法(1+1)</td><td>浮点运算<br />50万次平方根(3.14开方)</td></tr>'; echo'<tr><td>MKDuse的机子(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>当前服务器</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>带宽测试</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="向客户端发送10KB数据,耗时"+timea+"ms<br />您与此服务器的连接速度为"+netspeed+"kb/s"; </script> <?php echo'<h2>已加载的扩展库(enable)</h2><div>'; $arr =get_loaded_extensions(); foreach($arr as $value){ echo $value.'<br />';} echo'</div><h2>禁用的函数</h2><p>'; $disfun=ini_get('disable_functions'); if (empty($disfun)){ echo'没有禁用</p>';} else{ echo ini_get('disable_functions').'</p>';} }//关闭 function superinfo(){ echo'<h1>高级信息</h1><p>PHP_INI_USER 1 配置选项可用在用户的 PHP 脚本或Windows 注册表中<br> PHP_INI_PERDIR 2 配置选项可在 php.ini, .htaccess 或 httpd.conf 中设置 <br>PHP_INI_SYSTEM 4 配置选项可在 php.ini or httpd.conf 中设置 <br>PHP_INI_ALL 7 配置选项可在各处设置</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>
以上是php禁用函数设置及查看方法的介绍(附示例)的详细内容。更多信息请关注PHP中文网其他相关文章!

要保护应用免受与会话相关的XSS攻击,需采取以下措施:1.设置HttpOnly和Secure标志保护会话cookie。2.对所有用户输入进行输出编码。3.实施内容安全策略(CSP)限制脚本来源。通过这些策略,可以有效防护会话相关的XSS攻击,确保用户数据安全。

优化PHP会话性能的方法包括:1.延迟会话启动,2.使用数据库存储会话,3.压缩会话数据,4.管理会话生命周期,5.实现会话共享。这些策略能显着提升应用在高并发环境下的效率。

thesession.gc_maxlifetimesettinginphpdeterminesthelifespanofsessiondata,setInSeconds.1)它'sconfiguredinphp.iniorviaini_set().2)abalanceIsiseededeedeedeedeedeedeedto to to avoidperformance andununununununexpectedLogOgouts.3)

在PHP中,可以使用session_name()函数配置会话名称。具体步骤如下:1.使用session_name()函数设置会话名称,例如session_name("my_session")。2.在设置会话名称后,调用session_start()启动会话。配置会话名称可以避免多应用间的会话数据冲突,并增强安全性,但需注意会话名称的唯一性、安全性、长度和设置时机。

会话ID应在登录时、敏感操作前和每30分钟定期重新生成。1.登录时重新生成会话ID可防会话固定攻击。2.敏感操作前重新生成提高安全性。3.定期重新生成降低长期利用风险,但需权衡用户体验。

在PHP中设置会话cookie参数可以通过session_set_cookie_params()函数实现。1)使用该函数设置参数,如过期时间、路径、域名、安全标志等;2)调用session_start()使参数生效;3)根据需求动态调整参数,如用户登录状态;4)注意设置secure和httponly标志以提升安全性。

在PHP中使用会话的主要目的是维护用户在不同页面之间的状态。1)会话通过session_start()函数启动,创建唯一会话ID并存储在用户cookie中。2)会话数据保存在服务器上,允许在不同请求间传递数据,如登录状态和购物车内容。

如何在子域名间共享会话?通过设置通用域名的会话cookie实现。1.在服务器端设置会话cookie的域为.example.com。2.选择合适的会话存储方式,如内存、数据库或分布式缓存。3.通过cookie传递会话ID,服务器根据ID检索和更新会话数据。


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

SublimeText3 Linux新版
SublimeText3 Linux最新版

VSCode Windows 64位 下载
微软推出的免费、功能强大的一款IDE编辑器

MinGW - 适用于 Windows 的极简 GNU
这个项目正在迁移到osdn.net/projects/mingw的过程中,你可以继续在那里关注我们。MinGW:GNU编译器集合(GCC)的本地Windows移植版本,可自由分发的导入库和用于构建本地Windows应用程序的头文件;包括对MSVC运行时的扩展,以支持C99功能。MinGW的所有软件都可以在64位Windows平台上运行。

Dreamweaver Mac版
视觉化网页开发工具

DVWA
Damn Vulnerable Web App (DVWA) 是一个PHP/MySQL的Web应用程序,非常容易受到攻击。它的主要目标是成为安全专业人员在合法环境中测试自己的技能和工具的辅助工具,帮助Web开发人员更好地理解保护Web应用程序的过程,并帮助教师/学生在课堂环境中教授/学习Web应用程序安全。DVWA的目标是通过简单直接的界面练习一些最常见的Web漏洞,难度各不相同。请注意,该软件中