我有一個CakePHP 2.5.1站點託管在已安裝CPanel(包括apache,exim,php等)的CentOS專用服務器上,並且在此站點上我有一個管理區域,但由於某種原因,該區域只能在本地主機上正常工作,如果我將該網站上傳到遠程服務器,它只會顯示一個空白頁面。CakePHP在遠程服務器上顯示空白頁面沒有錯誤
Obs:所有其他的網站正常工作,只有管理區域不起作用。
Obs²:有一天我將網站上傳到另一臺服務器,並且該區域正在工作,所以我認爲問題可能出在服務器上。
我向CPanel請求技術支持,但他們不能幫助我,只要他們不知道CakePHP如何工作,但他們試圖。
我知道,一個外部鏈接,不建議使用,順便說一句,我有肯定,我真的無法複製在另一個地方的問題,於是就有了鏈接到空白頁:http://www.acheiapartamento.com.br/biz/
這裏是routes.php文件定義(你可以看到 「/商業/」 鏈接指向的網頁控制器指數):
<?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)...
*/
/* BIZ */
Router::connect('/biz/', array('controller' => 'pages', 'action' => 'index', 'biz' => 'true'));
/* HOME */
Router::connect('/', array('controller' => 'home', 'action' => 'index'));
Router::connect('/home', array('controller' => 'home', 'action' => 'index'));
Router::connect('/classificados-home', array('controller' => 'home', 'action' => 'classificados'));
Router::connect('/destaques-home', array('controller' => 'home', 'action' => 'destaques'));
Router::connect('/lancamentos-home', array('controller' => 'home', 'action' => 'lancamentos'));
/* EMPRESA */
Router::connect('/sobre', array('controller' => 'institucionais', 'action' => 'index'));
Router::connect('/dicas', array('controller' => 'institucionais', 'action' => 'dicas'));
/* EMPREENDIMENTOS */
Router::connect('/destaques', array('controller' => 'empreendimentos', 'action' => 'index'));
Router::connect('/empreendimentos/enviar_contato', array('controller' => 'empreendimentos', 'action' => 'enviar_contato'));
Router::connect('/destaques/:slug', array('controller' => 'empreendimentos', 'action' => 'interna'));
Router::connect('/empreendimentos/:slug', array('controller' => 'empreendimentos', 'action' => 'interna'));
Router::connect('/buscador', array('controller' => 'empreendimentos', 'action' => 'busca'));
Router::connect('/resultado', array('controller' => 'empreendimentos', 'action' => 'resultado'));
Router::connect('/classificados', array('controller' => 'empreendimentos', 'action' => 'classificados'));
//Router::connect('/lancamentos', array('controller' => 'empreendimentos', 'action' => 'lancamentos'));
Router::connect('/lancamentos/enviar_contato', array('controller' => 'lancamentos', 'action' => 'enviar_contato'));
Router::connect('/lancamentos', array('controller' => 'lancamentos', 'action' => 'index'));
Router::connect('/lancamentos/:slug', array('controller' => 'lancamentos', 'action' => 'interna'));
/*EMPREENDIMENTOS BAIRROS*/
Router::connect('/bairros/busca', array('controller' => 'empreendimentos_bairros', 'action' => 'busca'));
/*CLIENTE */
Router::connect('/blog', array('controller' => 'noticias', 'action' => 'index'));
Router::connect('/blog/:slug', array('controller' => 'noticias', 'action' => 'interna'));
Router::connect('/ache-para-mim', array('controller' => 'interesse', 'action' => 'index'));
Router::connect('/ache-para-mim/comercial', array('controller' => 'interesse', 'action' => 'comercial'));
Router::connect('/atendimentos', array('controller' => 'atendimentos', 'action' => 'index'));
Router::connect('/clientes', array('controller' => 'clientes', 'action' => 'index'));
Router::connect('/meus-favoritos', array('controller' => 'clientes', 'action' => 'index'));
Router::connect('/meus-imoveis', array('controller' => 'clientes', 'action' => 'meus_imoveis'));
Router::connect('/cadastre-seu-imovel', array('controller' => 'empreendimentos', 'action' => 'cliente_imovel'));
Router::connect('/faq', array('controller' => 'faqs', 'action' => 'index'));
Router::connect('/pergunte-ao-corretor', array('controller' => 'perguntas', 'action' => 'index'));
/* CONTATO */
Router::connect('/contato', array('controller' => 'contatos', 'action' => 'index'));
Router::connect('/aplicativo', array('controller' => 'aplicativos', 'action' => 'index'));
Router::connect('/cortarimagem', array('controller' => 'empreendimentos', 'action' => 'cortarimagem'));
/** EXPORTAÇÃO **/
/* IMPORTACAO */
Router::connect('/importacao/', array('controller' => 'empreendimentos', 'action' => 'importacao'));
Router::connect('/importacao-imagem/', array('controller' => 'empreendimentos', 'action' => 'importacao2'));
/* BEMORAR */
//Router::connect('/exp-bemorar/:id', array('controller' => 'bemorar', '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';
這裏是代碼PagesController.php:
<?php
/**
* Static content controller.
*
* This file will render views from views/pages/
*
* 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.Controller
* @since CakePHP(tm) v 0.2.9
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
App::uses('AppController', 'Controller');
App::uses('UsersController', 'Controller');
App::uses('BannersController', 'Controller');
/**
* Static content controller
*
* Override this controller by placing a copy in controllers directory of an application
*
* @package app.Controller
* @link http://book.cakephp.org/2.0/en/controllers/pages-controller.html
*/
class PagesController extends AppController {
/**
* This controller does not use a model
*
* @var array
*/
public $uses = array();
/**
* Displays a view
*
* @param mixed What page to display
* @return void
* @throws NotFoundException When the view file could not be found
* or MissingViewException in debug mode.
*/
public function display() {
$path = func_get_args();
$count = count($path);
if (!$count) {
return $this->redirect('/');
}
$page = $subpage = $title_for_layout = null;
if (!empty($path[0])) {
$page = $path[0];
}
if (!empty($path[1])) {
$subpage = $path[1];
}
if (!empty($path[$count - 1])) {
$title_for_layout = Inflector::humanize($path[$count - 1]);
}
$this->set(compact('page', 'subpage', 'title_for_layout'));
try {
$this->render(implode('/', $path));
} catch (MissingViewException $e) {
if (Configure::read('debug')) {
throw $e;
}
throw new NotFoundException();
}
}
public function biz_index() {
echo "teste";
}
public function index() {
echo "teste";
$produto = new ProdutosController();
$this->set('produtos', $produto->Produto->find('all'));
}
}
相同的代碼在localhost工作,phpinfo()本地主機和我的遠程服務器幾乎相同,我已經檢查過它。
遠程phpinfo()函數(不工作): https://drive.google.com/a/unesc.net/file/d/0Byyr3Jl114rReUg2cnhTSTZ2b1E/view
本地主機的phpinfo()(作品):出現在日誌 https://drive.google.com/a/unesc.net/file/d/0Byyr3Jl114rRSTVobzRic2NlWFk/view?usp=sharing
沒有錯誤,頁面是空白的,所以我我真的不知道該怎麼做,我需要儘快解決這個問題。
啓用調試。在你的'app/Config/core.php'文件中設置'Configure :: write('debug',2)'; –
它已經設置爲2. –
從tmp \ cache> models,persistent和views文件夾清除緩存 – Salines