禁用掉可能带来安全隐患的函数
防止外部注入调用这些函数,产生不必要的麻烦
在php. ini 中
disable_functions = passthru, exec , system ,chroot,chgrp, chown ,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthruOperation timed outer,fsocket,popen
open_basedir 授权目录设置
可将用户访问文件的活动范围限制在指定的区域
方法1,在 nginx 配置文件中加入 :
fastcgi_param PHP_VALUE "open_basedir=$document_root:/tmp/:/proc/";
方法2,在php.ini中加入:
open_basedir=/您允许的目录:/tmp/:/proc/
方法3)在网站根目录下创建.user.ini并写入:
open_basedir=/您的目录:/tmp/:/proc/
这种方式不需要重启nginx或php-fpm服务。安全起见应当取消掉.user. ini文件 的写权限。