在php.ini我已经设置
open_basedir = /home/user/web/
现在我想在子域上运行phppgadmin,它需要包含来自/usr/share / phppgadmin的文件.
所以我将以下行添加到此主机的nginx-config中:
fastcgi_param PHP_VALUE open_basedir="/home/user/web/:/usr/share/phppgadmin/";
并重新启动nginx.但是,由于以下错误,我无法访问该网站:
[error] 31440#0: *1 FastCGI sent in stderr: “PHP Warning: include_once(): open_basedir restriction in effect. File(/usr/share/phppgadmin/libraries/lib.inc.php) is not within the allowed path(s): (/home/user/web/) in /usr/share/phppgadmin/info.php on line 10
可能是第二条路径没有列在这里的原因是什么?我还需要将open_basedir添加到虚拟主机中吗?我只使用/ sites-available中的默认文件.
编辑总是想到重新启动fpm …
service php5-fpm restart
另外,open_basedir很容易被规避,除非你已经锁定了shell_exec,exec,系统和类似的PHP函数,所以不要认为使用它是安全的(我知道,它很糟糕).
如果你想知道如何轻松绕过它,你可以只使用system(‘php -n ascript.php’);. -n将导致不读取PHP.ini,因此不会应用open_basedir.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。