Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/268.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在php中限制对目录的访问_Php_Security_Server - Fatal编程技术网

在php中限制对目录的访问

在php中限制对目录的访问,php,security,server,Php,Security,Server,是否可以在运行第一个脚本(index.PHP in public\u html)时将用户控件从PHP(include、require、file\u get\u contents等)访问服务器中的文件限制在特定文件夹中,但我们允许的文件除外 例如: 可以访问:/var/www/application/models/文件夹中的file1.php,因为我们允许无法访问该文件和其他文件 默认情况下,只能访问/var/www/application/user/的文件 您是否考虑过使用服务器用户权限而不是P

是否可以在运行第一个脚本(index.PHP in public\u html)时将用户控件从PHP(include、require、file\u get\u contents等)访问服务器中的文件限制在特定文件夹中,但我们允许的文件除外

例如: 可以访问:/var/www/application/models/文件夹中的file1.php,因为我们允许无法访问该文件和其他文件


默认情况下,只能访问/var/www/application/user/的文件

您是否考虑过使用服务器用户权限而不是PHP来执行此操作?如果你想使用PHP,你必须根据你的认证系统手动管理这些安全设置,因为PHP将由同一个服务器用户运行!我们可以让服务器用户在访问文件时是动态的吗。。。就像一个权限用于user1,另一个权限用于user2?@deceze即使它不在公共webroot中,也可以像这样访问它,包括“../../”。我也不希望以这种方式访问您的
apache
用户无法访问webroot之外的文件。。。正确的?