PHP security configuration on the production environment

;关闭错误显示
display_errors = Off

;配置错误日志
error_log = /var/log/php/error.log

;隐藏PHP版本号
expose_php = Off

;关闭自动注册全局变量(5.6以后已移除)
register_globals = Off 

;限定PHP访问路径
open_basedir = /home/web/php/

;禁用远程URL访问
allow_url_fopen = Off

禁用远程include文件包含
allow_url_include = Off

;开启安全模式
safe_mode = On

限定命令路径
safe_mode_exec_dir = /usr/local/php/exec/

;禁用危险函数
disable_function = phpinfo,eval,passthru,exec,system,chroot,scandir,chgrp,chown.shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlikn,popepassthru,stream_socket_server,fsocket,fsockopen

;设置cookie浏览器中不可见
session.cookie_httponly = 1

;如果是https,开启限定cookie只允许在https下上传
session.cookie_secure = 1

 

Published 239 original articles · won praise 32 · views 160 000 +

Guess you like

Origin blog.csdn.net/why444216978/article/details/104735864