服务器返回“500内部服务器错误”

时间:2017-03-09 13:22:58

标签: php symfony

我是symfony2的初学者,我做了我的第一个项目,当我切换到生产环境进行测试时,我收到了以下错误信息:

  

糟糕!发生错误   服务器返回“500内部服务器错误”。   有些东西坏了。如果发生此错误,请告知我们您在做什么。我们会尽快修复它。很抱歉给您带来不便。

但是我在

之前执行了这个命令
php app/console cache:clear --env=prod

之后,在web app.php中我激活了

$ kernel = new AppKernel('prod',true); 我更新了我的页面

An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "_assetic_67a7edb_0" as such route does not exist.").

我总是执行这些命令

php php app/console assets:install --symlink
php app/console assetic:dump
php app/console assets:install --symlink --env prod
php app/console assetic:dump --env prod
php app/console cache:clear --env=prod

此命令composer.phar show symfony/assetic-bundle显示

name     : symfony/assetic-bundle
descrip. : Integrates Assetic into Symfony2
keywords : assets, compression, minification
versions : * v2.8.1
appKernel中的

public function registerBundles()
    {
        $bundles = array(
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            {...}
           new Symfony\Bundle\AsseticBundle\AsseticBundle(),
            {...}

        );

在config.yml

# AsseticBundle Configuration
assetic:
    debug:          '%kernel.debug%'
    use_controller: '%kernel.debug%'
    bundles:
        # Defaults (all currently registered bundles):
        - BOMyProjectBundle
        - FrameworkBundle
        - SecurityBundle
        - TwigBundle
        - MonologBundle
        - SwiftmailerBundle
        - DoctrineBundle
        - AsseticBundle
    filters:
        lessphp:
            file: "%kernel.root_dir%/../vendor/oyejorge/less.php/lessc.inc.php"
            apply_to: ".less$"
            formatter: "compressed"
            preserve_comments: false
        cssrewrite: ~
    assets:
        jquery_js:
            inputs:
                - "%kernel.root_dir%/../vendor/components/jquery/jquery.min.js"
            output: "js/jquery.min.js"
        jquery_ui_js:
            inputs:
                - "%kernel.root_dir%/../vendor/components/jqueryui/jquery-ui.min.js"
            output: "js/jquery-ui.min.js"
        bootstrap_css:
            inputs:
                - "%kernel.root_dir%/../vendor/twbs/bootstrap/less/bootstrap.less"
            filters:
                - lessphp
                - cssrewrite
            output: "css/bootstrap.css"
        bootstrap_js:
            inputs:
                - "%kernel.root_dir%/../vendor/twbs/bootstrap/js/affix.js"
                - "%kernel.root_dir%/../vendor/twbs/bootstrap/js/alert.js"
                - "%kernel.root_dir%/../vendor/twbs/bootstrap/js/button.js"
                - "%kernel.root_dir%/../vendor/twbs/bootstrap/js/carousel.js"
                - "%kernel.root_dir%/../vendor/twbs/bootstrap/js/collapse.js"
                - "%kernel.root_dir%/../vendor/twbs/bootstrap/js/dropdown.js"
                - "%kernel.root_dir%/../vendor/twbs/bootstrap/js/modal.js"
                - "%kernel.root_dir%/../vendor/twbs/bootstrap/js/tooltip.js"
                - "%kernel.root_dir%/../vendor/twbs/bootstrap/js/popover.js"
                - "%kernel.root_dir%/../vendor/twbs/bootstrap/js/scrollspy.js"
                - "%kernel.root_dir%/../vendor/twbs/bootstrap/js/tab.js"
                - "%kernel.root_dir%/../vendor/twbs/bootstrap/js/transition.js"
            output: js/bootstrap.js
        fonts_glyphicons_eot:
            inputs:
                - "%kernel.root_dir%/../vendor/twbs/bootstrap/fonts/glyphicons-halflings-regular.eot"
            output: "fonts/glyphicons-halflings-regular.eot"
        fonts_glyphicons_svg:
            inputs:
                - "%kernel.root_dir%/../vendor/twbs/bootstrap/fonts/glyphicons-halflings-regular.svg"
            output: "fonts/glyphicons-halflings-regular.svg"
        fonts_glyphicons_ttf:
            inputs:
                - "%kernel.root_dir%/../vendor/twbs/bootstrap/fonts/glyphicons-halflings-regular.ttf"
            output: "fonts/glyphicons-halflings-regular.ttf"
        fonts_glyphicons_woff:
            inputs:
                - "%kernel.root_dir%/../vendor/twbs/bootstrap/fonts/glyphicons-halflings-regular.woff"
            output: "fonts/glyphicons-halflings-regular.woff"
        fonts_glyphicons_woff2:
            inputs:
                - "%kernel.root_dir%/../vendor/twbs/bootstrap/fonts/glyphicons-halflings-regular.woff2"
            output: "fonts/glyphicons-halflings-regular.woff2"
        font_awesome_css:
            inputs:
                - "%kernel.root_dir%/../vendor/components/font-awesome/less/font-awesome.less"
            filters:
                - lessphp
                - cssrewrite
            output: "css/font-awesome.css"
        font_awesome_fonts_eot:
            inputs:
                - "%kernel.root_dir%/../vendor/components/font-awesome/fonts/fontawesome-webfont.eot"
            output: "fonts/fontawesome-webfont.eot"
        font_awesome_fonts_svg:
            inputs:
                - "%kernel.root_dir%/../vendor/components/font-awesome/fonts/fontawesome-webfont.svg"
            output: "fonts/fontawesome-webfont.svg"
        font_awesome_fonts_ttf:
            inputs:
                - "%kernel.root_dir%/../vendor/components/font-awesome/fonts/fontawesome-webfont.ttf"
            output: "fonts/fontawesome-webfont.ttf"
        font_awesome_fonts_woff:
            inputs:
                - "%kernel.root_dir%/../vendor/components/font-awesome/fonts/fontawesome-webfont.woff"
            output: "fonts/fontawesome-webfont.woff"
        font_awesome_fonts_woff2:
            inputs:
                - "%kernel.root_dir%/../vendor/components/font-awesome/fonts/fontawesome-webfont.woff2"
            output: "fonts/fontawesome-webfont.woff2"
layout.html.twig中的

{% block stylesheets %}
                        {% stylesheets filter="cssrewrite"
                        '@bootstrap_css'
                        '@fonts_glyphicons_eot'
                        '@fonts_glyphicons_svg'
                        '@fonts_glyphicons_ttf'
                        '@fonts_glyphicons_woff'
                        'css/font-awesome.css'
                        'bundles/bomyproject/css/style.css'
                        output='compiled/css/app.css'
                        %}
                        <link rel="stylesheet" href="{{ asset_url }}" />
                        {% endstylesheets %}
                {% endblock %}
<!-- {...} -->
{% block javascript %}
                        {% javascripts filter='?jsqueeze'
                            'bundles/bomyproject/js/*.js' %}
                            <script type="text/javascript" src="{{ asset_url }}"></script>
                        {% endjavascripts %}
                {% endblock %}

我手动删除了缓存,并更新了页面,但没有成功。

0 个答案:

没有答案