小樱 发表于 2018/2/17 00:32

kangle php禁用函数执行,起到防护效果disable_functions,设置禁用列表 启用php安全模式

我们来解决这个的防护方法就是
设置php-templete.ini文件,找到disable_functions,在=号后面加入一些函数禁用列表,即可解决此问题,并且他会忽略你目前是否使用了php安全模式强制开启禁用。
; This directive allows you to disable certain functions for security reasons.
; It receives a comma-delimited list of function names. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.disable-functions
disable_functions =
最下方的disable_functions改成这样然后保存ini文件并且重启web即可
disable_functions = chmod,closedir,copy,dir,escapeshellarg,escapeshellcmd,exec,fclose,fileperms,fopen,fread,fwrite,is_dir,link,mkdir,opendir,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,readdir,rename,rmdir,shell_exec,system,tempnam,touch,unlink

函数禁用列表参考官方进行写的:http://php.net/manual/zh/ref.exec.php


如果你想打开php安全模式可以这样打开,在php.ini中插入一行
safe_mode = on
或者程序中加入
ini_set("safe_mode",true);
安全模式官方介绍:http://php.net/manual/zh/features.safe-mode.functions.php

页: [1]
查看完整版本: kangle php禁用函数执行,起到防护效果disable_functions,设置禁用列表 启用php安全模式