Symfony2.3生产页面空白500

问题描述 投票:0回答:1

在开发mod上进行项目工作后,我发现OVH上的prod有一些问题。 它显示了一个空白页! 我尝试在app.php上关注该问题,发现执行$response = $kernel->handle($request);问题仍然存在$response = $kernel->handle($request); 并且它不登录生产。

所以当我更改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

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

php symfony apc dev-to-production
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在控制台上运行检查。

© www.soinside.com 2019 - 2024. All rights reserved.