dshw124502 2018-07-05 15:54
浏览 47
已采纳

让一个本地的Symfony 2.8应用程序在prod环境中表现得像它一样

I have an application based on Symfony 2.8. A feature is working well in my local dev environment but failing in production. I want to make my local environment use prod mode in order to hopefully replicate the problem. What I have tried:

export SYMFONY_ENV=prod
app/console cache:clear --no-warmup

This appeared at first to be working, as I got a message about the cache being cleared in the prod environment, but when I loaded the app, the debug toolbar was visible and said I was in dev mode.

I have also tried looking in both parameters.yml and config.yml for any denotation of the environment. I didn't find anything.

What should I try next?

  • 写回答

2条回答 默认 最新

  • doupaxia2478 2018-07-05 17:01
    关注

    The answer can depend on a lot of factors: what web-server is used, what web-server config is used, do you use php-fpm or else, etc.

    Console commands like "export SYMFONY_ENV=prod" set environment only for console commands in the same session. But they can't affect your web server behavior.

    When you open a page of your project in a browser, the application doesn't know anything about commands what you have typed in a terminal. If you see a debug console probably the app entry point is "web/app_dev.php", and the environment is defined here like:

    // web/app_dev.php

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

    Try to change 'dev' by 'prod'

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?