Jack Zheng Jack Zheng - 16 days ago 6
PHP Question

Symfony2.7.1 fresh installation. Failed to load resource

Symfony2 developers:

Recently, I am planning to get familiar with Symfony2, using it as api project. Current version is v2.7.1.

I already have apache installed as my local environment. So the installation root directory is:

//localhost/symfony

So I followed official guide to install it. Everything looks fine after installation. But when I view the page in development environment (app_dev.php).

//localhost/symfony/web/app_dev.php

Page content display as expected, but not styled. Then I open console and find some 404 response as follows:


Failed to load resource

//localhost/symfony/web/bundles/framework/css/structure.css

//localhost/symfony/web/bundles/framework/css/body.css

//localhost/symfony/web/bundles/framework/css/exception.css

//localhost/symfony/web/app_dev.php

//localhost/symfony/web/bundles/framework/css/structure.css

//localhost/symfony/web/bundles/framework/css/body.css

//localhost/symfony/web/bundles/framework/css/exception.css


I looked into project/web/bundles directory, found nothing inside but two empty file.

framework and sensiodistribution.

Fresh installation without any config change. I got this problem. Could you guys give some explanation why it occurs. Otherwise I didn't get the full package?

Do I miss those files inside project/web/bundles?

If the case in which i missed those file. So could you send me an archive file on current version 2.7.1?

Answer
  1. If these files exists then you probably have problem with URL Rewriting check your .htaccess or configure your host. You can also use command php app/console server:start and check there if it works

  2. You can run composer install to install all necessary bundles and libraries and probably composer.json has defined postinstall commands.

  3. If you use assetic then you can try to run php app/console assetic:dump more on http://symfony.com/doc/current/cookbook/assetic/asset_management.html

  4. In Symfony 2.6 you have new asset manager read more on http://symfony.com/blog/new-in-symfony-2-6-smarter-assets-install-command
Comments