symfony assetic gives 500 error when requesting files
Asked Answered
C

1

5

EDITED: I am using assetic with symfony2. Each time I try to load a page, on requesting for the JS and CSS files, my browser gets a 500 error. If I type the address of that resource in address bar, I can load its file successfully! Even weirder, the CPU load increases like 30% whenever Symfony boots up!

I tried assets:install and assetic:dump --no-debug, guess what, none of the symfony pages load anymore. They all end in 500 error.

I don't think it is caused by apache. I can load any other static of PHP pages, and I also tried nginx and got a 500 error. I have to cache:clear in order to get them back.

Any idea? I have already updated and reinstalled my web server, CGI, PHP and used a fresh copy of symfony and copied the sources, none of them helped.

dump: This is how I used Assetic with JS. There is a similar block for css:

{% javascripts
            '@SharifCalendarBundle/Resources/public/js/kendoui/jquery.min.js'
            '@SharifCalendarBundle/Resources/public/js/JQueryUi/jquery-ui-1.10.3.custom.min.js'
            '@SharifCalendarBundle/Resources/public/js/noty/jquery.noty.js'
            '@SharifCalendarBundle/Resources/public/js/noty/layouts/top.js'
            '@SharifCalendarBundle/Resources/public/js/noty/layouts/topLeft.js'
            '@SharifCalendarBundle/Resources/public/js/noty/layouts/topRight.js'
            '@SharifCalendarBundle/Resources/public/js/noty/themes/default.js'
            '@SharifCalendarBundle/Resources/public/js/kendoui/kendo.web.min.js'
        %}
    <script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
Catarina answered 14/7, 2013 at 2:32 Comment(7)
How do you insert the assets your template? Did you use the two commands assets:install and assetic:dump?Polyester
+1 got the same behavior on the DEV environment (in PROD all is working fine as it should). The console says 500 Error on jquery.js file, but when I load it in browser it loads successfully but truncated.... Very strange behavior.Hedva
@SergeVelikanov Sometimes clearing cache (cache:clear or manually clearing the cache folder) helps. And also make sure your assetic is latest version.Catarina
@Untitled, thank you! But the problem was here: I got the Linux OS in my VirtualBox running, mounting the NTFS partition (cifs) and it was having the strict chmod rules. Adding file_mode and dir_mode to my fstab helped me outHedva
I don't know if it helps, but you should reference your assets with bundles/sharifcalendar/js/... instead of @SharifCalendarBundle/Resources/public/js/.... See: craftitonline.com/2011/06/…Septic
what is the error exactly ? You could see it in the firebug by looking at the page that the request of assets returnsMokas
Could you give us the error in your apache log ? or in app/logs/dev.log ?Screwworm
F
3

In order to have a better understanding of what is going in, perhaps you could execute the commands related to assets in verbose mode (from your project root directory when using a standard Symfony2 edition) ?

php app/console assets:install --symlink -v 
php app/console assetic:dump -v
Frauenfeld answered 19/12, 2013 at 12:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.