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

标签 php cakephp centos cpanel

我在 CentOS 专用服务器上托管了一个 CakePHP 2.5.1 站点,该服务器安装了 CPanel(包括 apache、exim、php 等),在这个站点上我有一个管理区域,但由于某种原因,这个区域只能在本地主机,如果我将站点上传到远程服务器,它只会显示一个空白页面。

Obs:该站点的所有其余部分都可以正常工作,只有管理区域无法正常工作。

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

我向 CPanel 寻求技术支持,但只要他们不知道 CakePHP 的工作原理,他们就无法帮助我,但他们尝试了。

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

这里是 路线.php 已定义(如您所见,“/biz/” url 指向页面 Controller 索引):

<?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'));
    }

}

相同的代码在本地主机上工作, 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

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

最佳答案

我认为您面临的问题是由于权限。以下链接可能对您有所帮助:
http://book.cakephp.org/2.0/en/installation.html#permissions

关于php - CakePHP 在远程服务器上显示没有错误的空白页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34878425/

相关文章:

php - 如何在 PHP 中匹配具有公共(public)前缀的单词?

php - 让 CakePHP HtmlHelper 生成 "date"输入

php - mysql同时建表和插入

php - 多对多关系的 CakePHP deleteAll 不会删除连接记录

php - 如何为嵌套关系构建适当的 CakePHP 查询

linux - 使用 uuencode 发送附件时使用 sendmail 命令

php - 从网站杀死一个进程

centos - 如何在 julia 1.6.2 中安装 Sprite 包?

php - 新 MySQL 数据库条目的电子邮件通知

php - laravel 4 分页的多个 View