2014-10-19 97 views
0

在我的項目上使用dev mod後,我發現在OVH上產生了一些問題。 它顯示我一個空白頁!我試圖按照app.php上的問題,我發現問題仍然存在,執行$response = $kernel->handle($request);,它不記錄prod。Symfony2.3生產頁面空白500

因此,當我更改app.php上的行:$kernel = new AppKernel('prod', false);$kernel = new AppKernel('dev', false);它運作良好!

這裏是我的app.php

<?php 

/* 
* This file is part of the Sonata package. 
* 
* (c) Thomas Rabaix <[email protected]> 
* 
* For the full copyright and license information, please view the LICENSE 
* file that was distributed with this source code. 
*/ 
umask(0000); 
require_once __DIR__ . '/../app/bootstrap.php.cache'; 
require_once __DIR__ . '/../app/AppKernel.php'; 

//use Symfony\Component\HttpFoundation\Request; 

// if you want to use the SonataPageBundle with multisite 
// using different relative paths, you must change the request 
// object to use the SiteRequest 
use Sonata\PageBundle\Request\SiteRequest as Request; 

$request = Request::createFromGlobals(); 

$kernel = new AppKernel('prod', false); 

$response = $kernel->handle($request); 
$response->send(); 

$kernel->terminate($request, $response); 

編輯: 在開發和督促本地模式測試與

php app/console cache:clear --env=prod --no-debug 
php app/console assets:install web_directory 
php app/console assetic:dump web_directory 

我應該添加或在我的項目安裝PHP5效果很好?

編輯: 我的項目包含:奏鳴曲項目,fosUserBundle等..

編輯

問題是在config_prod.xml

doctrine: 
    orm: 
     entity_managers: 
      default: 
       metadata_cache_driver: apc 
       query_cache_driver: apc 
       result_cache_driver: apc 

intil現在之後它返回一個錯誤500!爲什麼?由於apc未啓用! 所以我的問題如何啓用apc OVH親!

+2

據我記得你必須'緩存:清除--env = prod' – 2014-10-19 03:52:29

+0

你應該進入你的php.ini並打開顯示器。它會告訴你到底什麼是錯的。 – 2014-10-19 06:00:50

+0

由於它是生產,你應該在php.ini中啓用php日誌,而不是顯示錯誤。 – SenseException 2014-10-19 10:01:32

回答

0

進入Web/config.php文件和評論加時賽以下行:

if (!in_array(@$_SERVER['REMOTE_ADDR'], array(
    '127.0.0.1', 
    '::1', 
))) { 
    header('HTTP/1.0 403 Forbidden'); 
    exit('This script is only accessible from localhost.'); 
} 

這將使config.php文件,從「外部」來調用。在檢查完所有內容後,請不要忘記刪除評論。

如果您在生產服務器上具有控制檯訪問權限,請輸入項目的根目錄並調用php app/check.php以在控制檯上運行檢查。

+0

config.php工作的很好,當我評論這些行時,我沒有控制檯access..but當我跟着app.php,當它到達行$ response = $ kernel-> handle($ request);它阻止並返回給我一個空白頁面! – Mirlo 2014-10-20 10:43:37