0

在开发 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);

编辑:在 dev 和 prod 本地模式测试中,它适用于

 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

直到现在它返回错误 500 !为什么 ?因为没有启用apc!所以我的问题是如何在OVH pro上启用apc!

4

1 回答 1

0

Go to web/config.php and comment ot the following lines:

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

That will enable the config.php to be called from "extern". Don't forget to remove the comments after you've checked everything.

If you have console access on the production server, enter the root directory of your project and call php app/check.php to run the checks on the console.

于 2014-10-20T10:38:57.457 回答