【问题标题】:symfony 2 , 500 Internal Server Error, render js filesymfony 2,500 内部服务器错误,渲染 js 文件
【发布时间】:2014-03-05 18:07:43
【问题描述】:

对不起,我来自巴西。

当我尝试在“prod”环境中使用我的系统时遇到此错误。 在“开发”环境中,一切正常。 在“prod”环境中并不总是给出错误。错误随机出现。

GET http://192.168.1.54/erp-zyx/web/publico/js/jquery/datepicker_custom.js 500 (Internal Server Error) 192.168.1.54/:631

在我的 base.html.twig 中:

<script type="text/javascript" src="{{path("datepicker_custom")}}"></script>

在我的控制器中:

 /**
 * @Route("/js/jquery/datepicker_custom.js", name="datepicker_custom")
 */
public function datepickerCustomAction()
{
    $response = $this->render('ZuniAdminBundle:Plugin:datepicker_custom.js.twig', array());
    $response->headers->set('Content-Type', 'text/javascript; charset=UTF-8');
    return $response;
}

当我在 app.php $kernel = new AppKernel('prod', true); 中输入“true”时,“prod”环境一切正常。但我不能真正调试。

日志这样写:

[2014-03-05 10:20:32] request.INFO: Matched route "datepicker_custom" (parameters: "_controller": "Zuni\AdminBundle\Controller\PluginController::datepickerCustomAction", "_route": "datepicker_custom") [] [] [2014-03-05 10:20:33] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Could not write new cache file to C:/xampp/htdocs/erp-zyx/app/cache/prod/jms_diextra/metadata/.cache.php." at C:\xampp\htdocs\erp-zyx\vendor\jms\metadata\src\Metadata\Cache\FileCache.php line 48 {"exception":"[object] (RuntimeException: Could not write new cache file to C:/xampp/htdocs/erp-zyx/app/cache/prod/jms_diextra/metadata/.cache.php. at C:\\xampp\\htdocs\\erp-zyx\\vendor\\jms\\metadata\\src\\Metadata\\Cache\\FileCache.php:48)"} []

我已经尽力了。我在服务器上渲染的四个 js 文件会发生这种情况。 谢谢!

【问题讨论】:

  • 使用虚拟机而不是 windows 来测试网站。 WAMP(Windows Apache MySQL PHP)设置以怪异而臭名昭著,更不用说慢得要命了。
  • tinymce.min.js 也有同样的问题
  • @MarioJohnathan 你能解决吗?谢谢!
  • 是的!我的 tinymce.min.js 中有 <??>,但我的服务器不喜欢它。我将它们更改为<??>,一切正常
  • 初始代码为pi:function(e,t){t?r.push("<?",e," ",t,"?>"):r.push("<?",e,"?>")

标签: php symfony twig production-environment


【解决方案1】:

尝试清除缓存:

app/console cache:clear --env=dev --no-debug

【讨论】:

  • 不清除 dev 模式你必须清除 prod 模式
【解决方案2】:

通过阅读您的日志,我认为您应该将chmod 777 添加到您的“prod”文件夹和“cache”文件夹中

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-04-10
    • 1970-01-01
    • 1970-01-01
    • 2017-12-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多