cakePHP - 404-页面找不到错误,当部署在不同的机器上 [英] cakePHP - 404- page not found error, when deploying on a different machine

查看:565
本文介绍了cakePHP - 404-页面找不到错误,当部署在不同的机器上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图部署一个cakephp应用程序到我的同行系统,我得到404错误,所有请求。 这不是cakephp 404错误,但是一个正常的网络服务器404页面未找到错误。 :(我们都使用MAC OS 10.6。同样的代码在我的机器和生产系统上工作,我在使用cakephp高级安装,即webroot只包含index.php,css,js等APP文件夹和CAKE文件夹位于其他地方。

I'm trying to deploy a cakephp application into my peers system and i get 404 error, for all requests. This is not cakephp 404 error, but a normal webserver 404 page not found error. :( . We both use MAC OS 10.6. The same code works on my machine and on the production system. I have followed the steps to deploy on his machine. I'm using cakephp advanced installation, i.e, webroot contain only index.php, css, js,etc. The APP folder and CAKE folder is located elsewhere.


  1. 取消注释/etc/apache2/httpd.conf中的LoadModule php5_module ....行。

  2. 更改为AllowOverride All /etc/apache2/httpd.conf中的Library / WebServer / Documents

  3. 取消注释,并在/etc/php.ini中设置date.timezone

  4. 将webroot内容复制到Library / WebServer / Documents并修改index.php以适应其计算机(设置3个与CORE,APP和CAKE文件夹相关的路径)


  5. 为了调试目的,修改core.php并设置Configure :: write('debug',3);

  1. uncommented the line "LoadModule php5_module...." in /etc/apache2/httpd.conf
  2. Changed to AllowOverride All to the Directory - "Library/WebServer/Documents" in /etc/apache2/httpd.conf
  3. uncommented and set date.timezone in /etc/php.ini
  4. Copied the webroot contents to "Library/WebServer/Documents" and modified index.php to adapt to his machine (setup 3 relevant paths to the CORE, APP and CAKE folder)
  5. made sure the DB connection is good.
  6. For debugging purpose, Modified core.php and set Configure::write('debug',3);

主页从AJAX调用获取数据。当我goto http:// localhost ,来自layouts / default.ctp的页眉和页脚内容被呈现,但是ajax调用是例如 http:// localhost / posts / showmyposts 获取404(找不到)错误。如果我转到其他网址,如 http:// localhost / users / login ,我会得到正常的网络服务器404错误。

The homepage get data from an AJAX call. WHen i goto http://localhost, the header and footer contents from the layouts/default.ctp are rendered, but the ajax call which is for example http://localhost/posts/showmyposts gets a 404 (Not Found) error. If I goto to other URLs like http://localhost/users/login, I get the normal webserver 404 error.

找不到

找不到请求的网址/ users / login /在此服务器上。

The requested URL /users/login/ was not found on this server.

在我的apache错误日志中,我得到错误

In my apache error log, i get the error as

[Mon May 16 16 :19:48 2011] [error] [client :: 1]文件不存在:/ Library / WebServer / Documents / users,referer: http :// localhost /
我的cakephp安装是否正确?

[Mon May 16 16:19:48 2011] [error] [client ::1] File does not exist: /Library/WebServer/Documents/users, referer: http://localhost/ Is my cakephp installation correct ?

推荐答案

code> mod_rewrite 不在该机器上工作。当您尝试运行默认Cake安装时会发生什么?它是否加载CSS和所有?

Sounds like an issue with mod_rewrite not working on that machine. What happens when you try to run a default Cake install? Does it load the CSS and all?

在您的应用程序目录中有一个 .htaccess webroot目录)?

Is there a .htaccess file in your app directory (and in your webroot directory)?

您是否已在您的Apache配置文件中启用 FollowSymLinks

Do you have FollowSymLinks turned on in your Apache config files?

这篇关于cakePHP - 404-页面找不到错误,当部署在不同的机器上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆