2

I accidentally delete the pub/static by running the command "rm -rf pub/static*" instead of "rm -rf pub/static/*". Now, i need to run "setup:static-content:deploy -f "in developer mode every time I deleted the static folder. i tried copy and paste the .htaccess file actually the whole pub folder from the magento sample data to my current project, but the issue is not fixed. any tips will be greatly thankful.

asked Mar 25, 2019 at 18:14
1
  • magento version 2.2.7 Commented Mar 28, 2019 at 18:54

3 Answers 3

1

It is not advisable to provide full access 777 to pub directory. Instead use this command in developer mode to provide write access to the pub directory

find var generated pub/static pub/media app/etc -type f -exec chmod g+w {} + && find var generated pub/static pub/media app/etc -type d -exec chmod g+ws {} +

Execute this command as a root user from the Magento root directory. Once done change the ownership of Magento directory to Magento user. So you can execute static-content deploy in developer mode as Magento user without any permission issues.

Please find the two links which you useful to set the pre installation and ownership access to Magento directory, files systems access permission commands in developer and production modes.

https://devdocs.magento.com/guides/v2.3/config-guide/prod/prod_file-sys-perms.html

https://devdocs.magento.com/guides/v2.3/install-gde/prereq/file-system-perms.html

answered Mar 26, 2019 at 6:02
0

You need the create permissions:

chmod -Rf 777 ./pub/static

Please read this article from Magento Devdoc.

answered Mar 25, 2019 at 19:32
0

Thanks for all answer. I fixed the issues just after i posted the question. so didnt have chance to try all your tips. The way i fixed my issues is i deleted Magento core folder in the vendor folder and run composer install. sorry for replying back late. again thank for answering the question.

answered Jun 5, 2019 at 16:53
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.