这里记录一下php安全相关的配置信息。基本都是php.ini里的配置项目。
参考了文章: https://gitlib.com/page/php-safe-config.html
禁用用不到的模块
禁止返回php版本信息。
html_errors = On
隐藏服务器版本号(nginx)
编缉找到的配置文件(nginx.conf),找到http{}字段址其中加入:server_tokens off;
禁用远程执行代码
allow_url_fopen=Off
allow_url_include=Off
禁用PHP中的危险函数
disable_functions =exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source
资源控制
max_execution_time = 30
max_input_time = 30
memory_limit = 40M
限制PHP访问文件系统
open_basedir = "/www/pgres/"