duandian2725 2018-11-01 09:34
浏览 103

Symfony 3.4应用程序中的bootstrap.php.cache

I am looking to confirm how my app*.php files should be configured with regards to the bootstrap.php.cache file.

I have read some conflicting advice on how to treat this file in Symfony 3.0 and above, namely https://symfonycasts.com/screencast/symfony3-upgrade/new-dir-structure#moving-bootstrap-php-cache and https://gist.github.com/mickaelandrieu/5d27a2ffafcbdd64912f549aaf2a6df9#files-to-move-update-

My understanding is that bootstrap.php.cache is required for a performance boost and is only required or recommended in the 'prod' environment. So this leaves me with the following setup:

app.php:

/** @var \Composer\Autoload\ClassLoader $loader */
$loader = require __DIR__.'/../vendor/autoload.php';
include_once __DIR__.'/../var/bootstrap.php.cache';
$kernel = new AppKernel('prod', false);

app_dev.php:

/** @var \Composer\Autoload\ClassLoader $loader */
$loader = require __DIR__.'/../vendor/autoload.php';
Debug::enable();
$kernel = new AppKernel('dev', true);

Previously $loader was /app/autoload.php, which has been moved to /vendor and /app/bootstrap.php.cache has been deleted and the DistrubutionBundle is now writing that file to /var.

Is this setup correct? (bin/console --env=dev/prod returns no errors)

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 对于相关问题的求解与代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料