简体   繁体   English

Symfony-如何设置从开发到生产?

[英]Symfony - How to set from dev to prod?

I know that this is not the first post about this question, but I do it because others answers didn't solve my problem. 我知道这不是有关此问题的第一篇文章,但我这样做是因为其他人的回答并不能解决我的问题。

I tried the basic : 我尝试了基本的:

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

But this is not the good way to do it because I still have Symfony errors... I don't know how to rewrite errors pages : 但这不是这样做的好方法,因为我仍然存在Symfony错误...我不知道如何重写错误页面:

http://le-blog-etudiant.fr/blablabla http://le-blog-etudiant.fr/blablabla

Do you know if this Symfony error is caused by the fact that my website is still in dev mode or because my error.html.twig page doesn't work ? 您是否知道这个Symfony错误是由于我的网站仍处于开发模式下还是因为我的error.html.twig页面不起作用导致的?

EDIT 1 : 编辑1:

I'm using app.php on my site, I set $kernel = new AppKernel('prod', false); 我在我的网站上使用app.php ,设置了$kernel = new AppKernel('prod', false); and I did the command : php bin/console cache:clear --env=prod but it still display Symfony's errors 我执行了以下命令: php bin/console cache:clear --env=prod但是它仍然显示Symfony的错误

Because you need to do this : 因为您需要这样做:

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

Here is the constructor of AppKernel : 这是AppKernel的构造函数:

/**
 * Constructor.
 *
 * @param string $environment The environment
 * @param bool   $debug       Whether to enable debugging or not
 */
public function __construct($environment, $debug)

Permission denied here showing your problem http://le-blog-etudiant.fr 此处显示您的问题的权限被拒绝 http://le-blog-etudiant.fr

在此处输入图片说明

You have to give permission 你必须同意

chmod 777 -R var/cache

chmod 777 -R var/cache/*

Other problems then we will check... 其他问题,我们将检查...

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

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