cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with css and js load

SOLVED

Problem with css and js load

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?

 

Thanks in advance

4 REPLIES

Re: Problem with css and js load

This is most likely a problem with permissions. If you view the site using Chrome web tools (network tab) or similar, do you see a 404 error or other error on the CSS/JS files? Have you tried installing the latest Magento 2.0.6? It includes some changes to the permission model so the default umask will work with most server setups, including shared hosts. You need to ensure that the Magento files are owned by the same user that the web server and PHP is running under. With that set, it should work fine with chmod 644 for files and 755 for directories. 777 permissions are not recommended as they potentially are a security risk.

 

Are you using a dedicated server/VPS or shared host? If it is shared, chances are high that they already run some form of SuEXEC, which will ensure that PHP scripts are executing under the same user as your account/file owner. In the case of a dedicated server/VPS, it might require a manual setup of the user accounts and file ownership to get it working.

Sindre M, CEO & Founder
ProperHost.com - The Magento Hosting Experts

Re: Problem with css and js load

Hi,

 

Thanks for your suggestion, you are right, i got 404 error "Failed to load resource: the server responded with a status of 404 (Not Found)". I am trying to install meganto 2.0.6. Hope this will solve the problem. I am using shared hosting

Re: Problem with css and js load

Update to 2.0.6 solve the problem

Re: Problem with css and js load

Great to hear that!
Sindre M, CEO & Founder
ProperHost.com - The Magento Hosting Experts