0

Problem:

I am installing Magento 2 on live server. While the site displays product info and some of the product images, there are no styles and JavaScript functions don't work.

Solution attempts/debugging:

I have seen a number of articles on inaccessible css/js files and have tried what they suggested to no avail. I follow instructions from here: https://mage2.pro/t/topic/259. But still no luck.

i've tried suggestion from Sandeep Pandey in https://mage2.pro/t/topic/259, it manage to solve the problem at first, but then when i change logo of my website or add new product, the problem occur again, the css and js wont load.

Questions

Does anyone have any ideas for solving this problem? Should i run command chmod 777 var -R & chmod 777 pub -R everytime i made changes on my website? Any suggestion?

Raul Sanchez
  • 3,036
  • 3
  • 28
  • 63
Orochi
  • 111
  • 1
  • 4
  • try this http://magento.stackexchange.com/questions/96289/no-images-or-js-on-new-magento-2-installation/96291#96291 – Magento 2 May 23 '16 at 05:16
  • In magento2 the permission are very closely maintained you can try out the steps mentioned in http://devdocs.magento.com/guides/v2.0/install-gde/prereq/file-system-perms.html#mage-owner-about-group and see if it helps – Atish Goswami May 23 '16 at 05:58
  • Solve it! Update into 2.0.6 and those problems gone. Thanks for the advice tho – Orochi May 24 '16 at 13:37

4 Answers4

0

You can run the following command

php bin/magento setup:static-content:deploy
Swapna Taru
  • 191
  • 3
0

There are 2 methods to solve it:

  • Using command:

    1. Open terminal and cd to magento installation directory.

    2. Run below command:

    php bin/magento setup:static-content:deploy

  • Manual:

    1. Go to pub/static folder and remove everything, except .htaccess file.

    2. Open up app/etc/di.xml find the path Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink and replace to Magento\Framework\App\View\Asset\MaterializationStrategy\Copy.

    3. Remove cache and reload frontend.

Mohit Kumar Arora
  • 9,951
  • 7
  • 27
  • 55
0
php bin/magento setup:static-content:deploy

remove var/view_preprocessed folder

Dipesh Rangani
  • 3,035
  • 4
  • 21
  • 43
-1

Update to the latest version solve this problem.

Orochi
  • 111
  • 1
  • 4
  • This does not provide any explanation, but it's true, because in Magento 2.0.6 they made the file permissions less restrictive by default to address exactly this problem. – Fabian Schmengler Jun 02 '16 at 06:44