2014-03-28 43 views
0

我有一個工作cakephp網站在服務器上。我已經下載到我的本地主機目錄。似乎路線設置不正確,但我不知道我應該改變什麼。在我的routes.php文件的文件我有:如何配置cakephp在本地主機運行

<?php 
/** 
* Routes configuration 
* 
* In this file, you set up routes to your controllers and their actions. 
* Routes are very important mechanism that allows you to freely connect 
* different URLs to chosen controllers and their actions (functions). 
* 
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) 
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) 
* 
* Licensed under The MIT License 
* For full copyright and license information, please see the LICENSE.txt 
* Redistributions of files must retain the above copyright notice. 
* 
* @copyright  Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) 
* @link   http://cakephp.org CakePHP(tm) Project 
* @package  app.Config 
* @since   CakePHP(tm) v 0.2.9 
* @license  http://www.opensource.org/licenses/mit-license.php MIT License 
*/ 
/** 
* Here, we are connecting '/' (base path) to controller called 'Pages', 
* its action called 'display', and we pass a param to select the view file 
* to use (in this case, /app/View/Pages/home.ctp)... 
*/ 
    Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home')); 
/** 
* ...and connect the rest of 'Pages' controller's URLs. 
*/ 
    Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display')); 

/** 
* search controller 
*/ 
    Router::connect('/search', array('controller' => 'search', 'action' => 'index')); 

/** 
* offer controller 
*/ 
    Router::connect('/offers', array('controller' => 'offers', 'action' => 'index')); 

/** 
* Load all plugin routes. See the CakePlugin documentation on 
* how to customize the loading of plugin routes. 
*/ 
    CakePlugin::routes(); 

/** 
* Load the CakePHP default routes. Only remove this if you do not want to use 
* the built-in default routes. 
*/ 
    require CAKE . 'Config' . DS . 'routes.php'; 

請告訴我,如果我需要發佈更多的信息。我的本地主機設置是非常標準的,我有每個項目在一個單獨的文件夾(例如本地主機/ myproject/..在遠程服務器上它就像www.mydomain.com/projects/myproject/)我用Softaculous App Installer來設置遠程項目目錄,然後使用聯機IDE對其進行編輯,以便文件從未在我的本地主機服務器上。現在就把他們拉下來。 Woudl感謝任何人可以提供的幫助。

感謝

UPDATE:

$ _ SERVER [ 'SERVER_NAME']正在這裏設置的lib /蛋糕/的TestSuite/CakeTestSuiteDispatcher.php是否有幫助?

/** 
* Parse URL params into a 'request' 
* 
* @return void 
*/ 
    protected function _parseParams() { 
     if (!$this->_paramsParsed) { 
      if (!isset($_SERVER['SERVER_NAME'])) { 
       $_SERVER['SERVER_NAME'] = ''; 
      } 
      foreach ($this->params as $key => $value) { 
       if (isset($_GET[$key])) { 
        $this->params[$key] = $_GET[$key]; 
       } 
      } 
      if (isset($_GET['code_coverage'])) { 
       $this->params['codeCoverage'] = true; 
       $this->_checkXdebug(); 
      } 
     } 
     if (empty($this->params['plugin']) && empty($this->params['core'])) { 
      $this->params['app'] = true; 
     } 
     $this->params['baseUrl'] = $this->_baseUrl; 
     $this->params['baseDir'] = $this->_baseDir; 
    } 
+0

您在本地使用什麼服務器?你應該爲蛋糕創建虛擬主機,究竟是什麼問題? – skywalker

+0

當您嘗試導航到本地主機上的網站時會發生什麼?你是否收到錯誤信息,如果有,它是什麼? – jackel414

+0

請提供操作系統信息和CakePHP版本?如果你嘗試了某些東西,也會分享錯誤或警告。 – Anubhav

回答

0

的路線不會造成任何問題。您將需要檢查在正在設置服務器名或基本URL(它可能已被老開發者設置):在AppController

  1. 檢查$_SERVER['SERVER_NAME']某處,或
  2. 檢查的前開發人員將存儲在數據庫中
+0

我在lib/Cake/TestSuite/CakeTestSuiteDispatcher.php中找到了'$ _SERVER ['SERVER_NAME'] ='的單個實例..我更新了我的帖子。我不知道是否應該改變它,或者該改變什麼。 – Martyn

+0

不,它不是從你的問題中刪除它。 – Fury