我怎样才能像这样写 open_basedir -> open_basedir = 'var/home/*/'
如你所知。你必须写 open_basedir = '/var/home'
等
我想这样写: open_basedir = '/var/home/*/'
我想要的是 php对于每个不同的目录,应该限制主目录中的每个目录。
简短的问题:我怎样才能像这样编写open_basedir
:open_basedir = 'var/home/*/'
?
非常感谢。
As you know. You have to write open_basedir = '/var/home'
etc
I want to write like this: open_basedir = '/var/home/*/'
Which i want is php should restrict every directory which is in home directory, for every different directories.
Short question: How can i write open_basedir
like this: open_basedir = 'var/home/*/'
?
Thank you very much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果要将 PHP 限制在每个用户自己的主目录中,则需要一个 PHP 设置,其中:
典型情况是 CGI(或 FastCGI)设置,而不是像下面那样运行 PHP阿帕奇模块。然后您可以为每个用户提供一个自定义 php.ini 文件。
顺便说一句,我还没有测试过它,但也许
open_basedir = "~"
按预期工作...====== 编辑 ======
一些说明来自OP的评论:
在Unix shell中,“~”是“当前用户的主目录”的同义词,所以如果你是约翰,它是“/var/home/john”,它是“/var/home/michael” “如果你是迈克尔. “var/home/~/”没有特殊含义:它只是一个名为 ~ 的目录。
许多程序都使用这种 shell 约定。我不知道 PHP 是否这样做。
CGI 允许在服务器上执行任意程序,因此它的安全性不如静态 HTML,就像滑板不如航天飞机安全一样。但我们不是在谈论执行任意程序:我们正在谈论执行 PHP 解释器。它将与 PHP 和您的环境一样安全。
如果您对此主题感兴趣,请 Google 搜索 FastCGI(具有增强性能的 CGI 实现)。许多托管提供商都使用它。
If you want to restrict PHP to each user's own home directory you need a PHP setup in which:
A typical case is a CGI (or FastCGI) setup, rather than running PHP as Apache module. Then you can provide a custom php.ini file for each user.
BTW, I haven't tested it but perhaps
open_basedir = "~"
works as expected...====== EDIT ======
Some clarifications that arise from the OP's comment:
In Unix shells, "~" is a synonym for "current user's home directory" so it's "/var/home/john" if you are john and it's "/var/home/michael" if you are michael. "var/home/~/" has no special meaning: it's just a directory that's called ~.
Many programs use this shell convention. I don't know if PHP does so.
CGI allows to execute arbitrary programs on the server so it is less secure than static HTML the same way that a skateboard is less secure than a space shuttle. But we are not talking about executing arbitrary programs: we are talking about executing the PHP interpreter. It'll be as as secure as PHP and your environment are.
If you are interested in the subject, Google for FastCGI (a CGI implementation with enhanced performance). Many hosting providers use it.
你可以。您必须在指令中指定每个路径:
You can. You must specify each path in the directive :