如何防止以任何方式从其目录中访问 PHP?
How to prevent access PHP out of its directory in any way?
我试过设置 open_basedir
常量。
这种方式有个问题:调用exec
PHP命令可以绕过限制
我可以使用 PHP 调用终端命令。
我可以阻止使用 exec
但我不需要使用 PHP.
来阻止终端命令
我唯一想要实现的是阻止访问 PHP 我在 open_basedir
中以任何可能的方式设置的路径。
F.e
有一条路径/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
我试过设置 open_basedir
常量。
这种方式有个问题:调用exec
PHP命令可以绕过限制
我可以使用 PHP 调用终端命令。
我可以阻止使用 exec
但我不需要使用 PHP.
我唯一想要实现的是阻止访问 PHP 我在 open_basedir
中以任何可能的方式设置的路径。
F.e
有一条路径/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