php - 如何防止以任何方式从其目录中访问 PHP?
问题描述
我试图设置open_basedir
常数。
这种方式有一个问题:我可以通过调用 PHP 命令绕过限制,exec
并且我可以使用 PHP 调用终端命令。我可以阻止使用exec
,但我不需要使用 PHP 阻止终端命令。
只有我想要实现的是阻止从我以open_basedir
任何可能的方式设置的路径访问 PHP。
Fe 有一条路/var/www/public_html/test
。和open_basedir="/var/www/public_html/test"
我想以任何可能的方式防止 PHP 访问路径之外。
解决方案
对不起,我不能发表评论,所以我会在这里写,如果你创建特定用户来运行 php
https://www.binarytides.com/php-fpm-separate-user-uid-linux/
然后设置他只能访问项目文件夹的权限
https://unix.stackexchange.com/questions/101576/give-user-read-write-access-to-only-one-directory
推荐阅读
- python - 最后一个块是什么意思?什么是unittest.main()?
- javascript - 获取应用程序错误代码 503 favicon angular
- python - 有没有什么办法可以得到这个网站上出现的(网络抓取)每日数字?需要刮一年
- python - OpenCV 关键点匹配器匹配 Python 中证书模板和图像的错误区域
- javascript - 如何在Javascript中的视频中显示下载按钮
- swift - 更新我的 pods 文件后构建运行问题
- python - 无法修复此错误:ValueError:数据基数不明确
- python - 如何更改标签的文本而不重叠?
- python - 如何从 '\xa0·\xa0' 和 '\xa0·\xa022h' 或类似形式的列表元素中删除?
- common-lisp - 在多值绑定中跳过值