简体   繁体   English

Symfony2.3生产页面空白500

[英]Symfony2.3 production page blank 500

after working with my project on dev mod, i found some problems with prod on OVH. 在开发mod上进行项目工作后,我发现OVH上的prod有一些问题。 it shows me a blank page ! 它显示了一个空白页! i try to follow the issue on app.php and i found that the problem persist with the execution of $response = $kernel->handle($request); 我尝试在app.php上关注该问题,发现执行$response = $kernel->handle($request);问题仍然存在$response = $kernel->handle($request); and it don't logging on prod. 并且它不登录生产。

so when i change the row on app.php : $kernel = new AppKernel('prod', false); 所以当我更改app.php上的行时: $kernel = new AppKernel('prod', false); with $kernel = new AppKernel('dev', false); 使用$kernel = new AppKernel('dev', false); it works well !!! 它运作良好!

here's my app.php 这是我的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);

EDIT : in dev and prod local mode test it works well with 编辑:在开发和生产本地模式下测试它与

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

should i add or install php5 on my project ? 我应该在项目中添加或安装php5吗?

EDIT : my project contains : sonata-project, fosUserBundle,etc... 编辑:我的项目包含:奏鸣曲项目,fosUserBundle等...

EDIT 编辑

the problem was on config_prod.xml 问题出在config_prod.xml上

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

intil now after it return an error 500 ! 现在提示后返回错误500! why ? 为什么呢? because of apc was not enabled ! 因为没有启用apc! so my question how to enable apc on OVH pro ! 所以我的问题是如何在OVH pro上启用apc!

Go to web/config.php and comment ot the following lines: 转到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.');
}

That will enable the config.php to be called from "extern". 这将使config.php可以从“ 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. 如果您在生产服务器上具有控制台访问权限,请输入项目的根目录,然后调用php app/check.php在控制台上运行检查。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM