0

私のプロジェクトで dev mod を使用した後、OVH の prod に問題があることがわかりました。空白のページが表示されます。私はapp.phpの問題を追跡しようとしましたが、問題がの実行で持続し、$response = $kernel->handle($request);prodにログオンしていないことがわかりました。

したがって、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 <thomas.rabaix@sonata-project.org>
 *
 * 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を追加またはインストールする必要がありますか?

編集: 私のプロジェクトには次が含まれます:sonata-project、fosUserBundleなど...

編集

問題はconfig_prod.xmlにありました

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

エラー500を返した後、今まで!なぜ ?apcが有効になっていないためです!OVH pro で apc を有効にする方法について質問です。

4

1 に答える 1

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 を「extern」から呼び出すことができます。すべてを確認したら、コメントを削除することを忘れないでください。

実稼働サーバーでコンソール アクセス権を持っている場合は、プロジェクトのルート ディレクトリを入力し、呼び出しphp app/check.phpてコンソールでチェックを実行します。

于 2014-10-20T10:38:57.457 に答える