Zend Studio 和 localhost - 禁止错误

发布于 2024-09-30 10:23:25 字数 666 浏览 0 评论 0原文

好吧,基本上,我将 Apache2 默认值中的 DocumentRoot 切换为如下所示:

DocumentRoot /home/scott/MySite/

可以。我在该根目录中有一个名为index.php 的文件。

我创建了一个 Zend Studio 项目,指向 /home/scott/MySite/,并且能够使用此行作为源创建我的项目,修改 .php 文件,并在浏览器中导航到 localhost 时查看更改。

现在,在 Zend 中,我创建了一个名为“Index”的文件夹,并将我的 index.php 文件放在其中,因为我想将项目中的文件分隔为 Database/、Index/、Login/ 等所有不同的文件夹。现在,当我导航到本地主机时,我得到:

您没有权限访问此服务器上的 / 。

当我将 index.php 文件放回主根时,它再次正常工作。

我尝试将 apache2 默认 DocumentRoot 更改为如下所示:

DocumentRoot /home/scott/MySite/Index/

但这也不起作用。有没有一种方法可以让这一切正常工作,并且像我的文件夹结构一样能够分离项目的所有逻辑,并且 apache2 仍然可以找到我的 index.php 并能够正确调用它调用的所有文件?

谢谢你们。

Okay so basically, I switched my DocumentRoot in Apache2 default to look like this:

DocumentRoot /home/scott/MySite/

That works. I have a file called index.php in that root.

I created a Zend Studio project, pointing to /home/scott/MySite/, and was able to create my project use this line as it's source, modify the .php file and see the change when I navigate to localhost in my browser.

Now, in Zend I created a folder called 'Index', and placed my index.php file in there, because I want to separate my files in the project to things like Database/, Index/, Login/, etc. all different folders. Now, when I navigate to localhost, I get:

You don't have permission to access / on this server.

When I place the index.php file back in the main root it works fine again.

I tried changing the apache2 default DocumentRoot to look like this:

DocumentRoot /home/scott/MySite/Index/

But that doesn't work either. Is there a way to get all this to work and have like my folder structure be able to separate all the logic for the project as well as apache2 still find my index.php and be able to call all the files it calls correctly?

Thanks guys.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

公布 2024-10-07 10:23:25

Apache 由 www-user 运行,该用户无权读取您的主文件夹。快速但肮脏的解决方案是将您的主文件夹的权限设置为 777

Apache is run by www-user which doesn't have the rights to read you home folder. The quick and dirty solution will be to set the persmission to 777 for you home folder

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文