获得“open_basedir 限制生效”尽管添加了正确的条目
我正在尝试使用 php 的 open_basedir 选项创建一个共享托管场景。我通过将以下内容添加到 apache2.conf 来做到这一点
<VirtualHost *:80>
ServerName lt1.example.net
DocumentRoot /home/akshat/example/tmpblogs/tb1/
php_admin_value open_basedir /home/akshat/example/tmpblogs/tb1/
</VirtualHost>
<VirtualHost *:80>
ServerName lt2.example.net
DocumentRoot /home/akshat/example/tmpblogs/tb2/
php_admin_flag open_basedir /home/akshat/example/tmpblogs/tb2/
</VirtualHost>
现在,当我访问 lt2.example.net 时,我收到错误:
警告:未知:open_basedir 限制生效。文件(/home/akshat/example/tmpblogs/tb2/index.php)不在允许的路径内:第 0 行未知中的(0)
警告:未知:无法打开流:操作不正确允许在第 0 行未知
致命错误:未知:无法打开所需的 '/home/akshat/example/tmpblogs/tb2/index.php' (include_path='.:/usr/share/php:/usr/share /pear') 位于第 0 行未知
我在访问“lt1.example.net”时也遇到了同样的错误,但后来突然就好了。
我在这里做错了什么?
I am trying to create a shared hosting scenario, using open_basedir option of php. I am doing this by adding the following to apache2.conf
<VirtualHost *:80>
ServerName lt1.example.net
DocumentRoot /home/akshat/example/tmpblogs/tb1/
php_admin_value open_basedir /home/akshat/example/tmpblogs/tb1/
</VirtualHost>
<VirtualHost *:80>
ServerName lt2.example.net
DocumentRoot /home/akshat/example/tmpblogs/tb2/
php_admin_flag open_basedir /home/akshat/example/tmpblogs/tb2/
</VirtualHost>
Now when I access lt2.example.net, I get the error:
Warning: Unknown: open_basedir restriction in effect. File(/home/akshat/example/tmpblogs/tb2/index.php) is not within the allowed path(s): (0) in Unknown on line 0
Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0
Fatal error: Unknown: Failed opening required '/home/akshat/example/tmpblogs/tb2/index.php' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0
I was getting the same error while accessing "lt1.example.net" too, but then it suddenly became alright.
What am I doing wrong here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
发现错误了。这是一个愚蠢的行为。
在站点 2 中,我使用“php_admin_flag”指令而不是“php_admin_value”。问题解决了
Found the mistake. It is a stupid one.
In site 2 I am using "php_admin_flag" directive instead of "php_admin_value". Problem solved