【问题标题】:UPDATE CakePHP - The requested URL was not found on this server更新 CakePHP - 在此服务器上找不到请求的 URL
【发布时间】:2010-10-22 23:24:20
【问题描述】:

为傻瓜安装 CAKEPHP

如果您像我一样,您会对这些框架(如 Ruby on Rails 和 CakePHP)感到沮丧,尽管起步缓慢,但它们承诺快速开发 - 只需花费数小时进行安装。

要让 CakePHP 运行起来,扔掉教程,甚至不必费心购买书籍或阅读文档。他们都没有提到要做到这一点,但这是需要在 Mac 10.6.2 上完成的:

1) Install CakePHP to Sites and unzip it. Rename it to your application name.
2) Now your httpd.conf file can be located anywhere on your mac. Each tutorial assumes it's located at some place in the depths of virtual reality. But in reality all you need to do is use the handy unix command locate from the terminal: locate httpd.conf
4) Then whip out your editor: mate httpd.conf
5) make sure your DocumentRoot says this: DocumentRoot "/Library/WebServer/Documents"
6) make sure under Directory it says AllowOveride All and Allow from all. It should have this by default but you never know when your sister randomly screws with your computer. Just be glad you have a mac and don't have to deal with her infesting your computer with viruses. 
7) Obviously you want the php module uncommented: LoadModule php5_module        libexec/apache2/libphp5.so
8) Now if you're like me, you dont want to type http://localhost/~jmerlino/mysite. You want to type http://localhost/mysite. So launch the hosts file. Again all you have to do is locate /etc/hosts and then mate /etc/hosts, assuming you're using TextMate. If you're using BBEdit, then obviously you won't be using the mate command.
9) Add this line: 127.0.0.1 localhost/mysite. This allows you to now use http://localhost/mysite.
10) Now the crazy part. find yur username.conf. For me, it's /etc/apache2/users/username.conf. For you, you do locate and make sure it's same spot. 
11) Add the following:
<VirtualHost *:80>
ServerName localhost/sitename
DocumentRoot "/Users/username/Sites/"
</VirtualHost>
12) Don't put username. Put whatever your user name is. 
13) Then run your app off http://localhost/mysite.
14) Don't forget to sudo apachectl restart when you're finished. 

如果你还有问题,这并不意味着你应该放弃编程并成为一名管道清洁工。只要继续努力。请记住,您不会在一个在线教程中找到解决方案。

【问题讨论】:

  • 尝试从您的DocumentRoot 设置中删除app/webroot?还是这些文件夹真的存在?
  • 我确实尝试将其从 DocumentRoot 设置中删除。奇怪的是,错误仍然存​​在。是的,这些文件确实存在。我在另一个浏览器上尝试过,因为我认为可能是 cookie 有问题。我也重新启动了apache。但尽管从 documentroot 中删除了 app/webroot,但仍然存在同样的错误。

标签: php apache cakephp http-status-code-404


【解决方案1】:

我建议您遵循bakery 的安装说明和this 博客的设置。也看看这个ticket

【讨论】:

  • 你的指令说在 /Library/WebServer/Documents 中压低所以我这样做 它说在 /Library/WebServer/Documents 类型:ln -s /Users/username/Sites/cake cake 所以我这样做 然后编辑你的 httpd.conf 文件。它位于这里。 /etc/httpd/httpd.conf 不幸的是,那里没有这样的文件。该文件位于 /private/etc/apache2/httpd.conf 所以我去那里进行以下更改: DocumentRoot "/Library/WebServer/Documents/cake/app/webroot" AllowOverride All 已经设置为 All sudo apachectl restart Now我得到无法连接页面
  • 我将 DocumentRoot 改回 /Users/jmerlino/Sites,现在它似乎可以正常工作了。我读过的教程和你上面提供的教程都没有提到这样做。但是,正是您发送的第三个问题的 stackoverflow 链接最终提醒我检查以查看 /Users/jmerlino/Sites。
  • 我给你接受的答案。但是你发布的面包店链接和博客已经过时了。您提供的 stackoverflow 链接提供了解决方案。真正有解决方案的是最底层的评论,甚至不是给出解决方案的人。
【解决方案2】:

更改 web 服务器配置中的 document_root。例如:document_root /var/www

将此更改为document_root /var/www/cakedocument_root 应该指向您的项目。

【讨论】:

    【解决方案3】:

    编辑 app/config/core.php 中的 core.php 文件

    在代码中找到这一行 定义('ABSOLUTE_URL',FULL_BASE_URL.""); 并将其更改为define('ABSOLUTE_URL',FULL_BASE_URL."subdirectory_name"); 例如:define('ABSOLUTE_URL',FULL_BASE_URL."/cake");

    【讨论】:

      猜你喜欢
      • 2017-03-21
      • 2010-10-16
      • 1970-01-01
      • 2017-12-26
      • 2015-03-30
      • 2014-12-13
      • 2016-10-31
      • 2017-04-19
      • 2016-11-23
      相关资源
      最近更新 更多