CakePHP在远程服务器上显示空白页面没有错误

时间:2016-01-19 13:44:38

标签: php cakephp centos cpanel

我有一个在安装了CPanel的CentOS专用服务器上托管的CakePHP 2.5.1网站(包括apache,exim,php等),在这个网站上我有一个管理区域,但由于某种原因,这个区域只有在localhost上正常工作,如果我将网站上传到远程服务器,它只会显示一个空白页面。

Obs:网站的其余部分都能正常运行,只有管理区域无效。

Obs²:有一天我将网站上传到另一台服务器并且该区域正在运行,所以我认为问题可能出在服务器上。

我向CPanel征求技术人员的支持,但他们无法帮助我,只要他们不知道CakePHP是如何工作的,但他们试图这样做。

我知道不建议使用外部链接,顺便说一下我确定我真的无法在其他地方重现问题,因此有空白页面的链接:http://www.acheiapartamento.com.br/biz/

这里定义了 routes.php (你可以看到“/ biz /”url指向页面控制器索引):

<?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处工作,localhost的 phpinfo()和我的远程服务器几乎相同,我已经检查过了。

远程phpinfo()(不起作用): https://drive.google.com/a/unesc.net/file/d/0Byyr3Jl114rReUg2cnhTSTZ2b1E/view

Localhost phpinfo()(正常): https://drive.google.com/a/unesc.net/file/d/0Byyr3Jl114rRSTVobzRic2NlWFk/view?usp=sharing

日志上没有错误,页面是空白的,所以我真的不知道该怎么做,我需要尽可能快地修复它。

1 个答案:

答案 0 :(得分:0)

我认为您面临的问题是因为权限。波纹管链接可以帮助您: http://book.cakephp.org/2.0/en/installation.html#permissions