I can't deploy static content on my production site. Running command:

php bin/magento setup:static-content:deploy en_GB

Gives me following error:

[Magento\Framework\Exception\FileSystemException] Cannot read contents from file "magento2/http/pub/static/adminhtml/Magento/backend/en_US/Magento_ConfigurableProduct/product/product.css" Warning!file_get_contents(magento2/http/pub/static/adminhtml/Magento/backend/en_US/Magento_ConfigurableProduct/product/product.css): failed to open stream: No such file or directory

For some reason, when not specifying the locale, it went through fine.

What could be causing the problem?


The file permission of the aforementioned file looks a bit weird?

lrwxrwxrwx 1 xxx xxx  113 May  8 15:08 product.css -> magento2/http/vendor/magento/module-configurable-product/view/adminhtml/web/product/product.css


Found out that this is a symlink that points to a file somewhere else on my server. These are the file permissions of the file where the symlink is pointing to:

-rw-r--r-- 1 xxx xxx 3863 May  7 06:35 product.css

Should I change these file permissions? If so, what would I changed them to to keep me site secure?


That caused by permission.

  1. You can upgrade and deploy again.

php bin/magento setup:upgrade php bin/magento setup:static-content:deploy en_GB

  1. if it still error, pls run command on root:

find app/code lib var generated vendor pub/static pub/media app/etc ( -type d -or -type f ) -exec chmod g+w {} + && chmod o+rwx app/etc/env.php

After that, repeat step 1.

  • This is my production site, will this cause any downtime? – Greg May 16 '19 at 12:01
  • it may downtime about some minutes when running command. You can put site with maintainance mode. – the light May 16 '19 at 12:01
  • +1 from me, I'll wait for a bit, maybe someone will have a solution that will involve no downtime :) If not, I'll try your solution. – Greg May 16 '19 at 12:03
  • Got bash syntax error when trying to complete step 2: -bash: syntax error near unexpected token `(' – Greg May 16 '19 at 12:26
  • I think your missing -f in the end , php bin/magento setup:static-content:deploy en_GB -f – aravind May 16 '19 at 12:45

It seems like permission issue for pub/static

So just give necessary permission for pub/static then run your command and of course static content deploy will create a down time as well.

As of now run the below command in your root

chmod -R 755 pub/static/


chmod -R 777 pub/static/


Run the below command then deploy

rm -rf pub/static/adminhtml

Hope this helps.

  • Tried that but with no luck :/ – Greg May 16 '19 at 12:26
  • updated the answer @Greg – Prathap Gunasekaran May 16 '19 at 12:42
  • See my updated question, the file permission looks weird on that file... Or is it correct? – Greg May 16 '19 at 12:44
  • Ahh, just found that this is a symlink – Greg May 16 '19 at 12:49
  • Have a look at the updated question :) – Greg May 16 '19 at 12:55

Found a solution by disabling the Symlinks.

Navigate to Stores -> Configuration -> Advanced -> Developer -> Template Settings and set “Allow Symlinks” to “No”.

Change Materialization Strategy in magento_root/app/etc/di.xml. Change this:

<virtualType name="developerMaterialization" type="Magento\Framework\App\View\Asset\MaterializationStrategy\Factory">
            <argument name="strategiesList" xsi:type="array">
                <item name="view_preprocessed" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink</item>
                <item name="default" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Copy</item>


<virtualType name="developerMaterialization" type="Magento\Framework\App\View\Asset\MaterializationStrategy\Factory">
            <argument name="strategiesList" xsi:type="array">
                <item name="view_preprocessed" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Copy</item>
                <item name="default" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Copy</item>

Then remove the static files, flush cache and deploy static content:

From magento_root (Be careful not to remove the .htaccess files):

  1. rm -rf pub/static/adminhtml pub/static/frontend && php bin/magento cache:clean && php bin/magento cache:flush

  2. php bin/magento setup:static-content:deploy

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.