1

I am setting up a Magento 2.2.5 instance on a production environment (single-user / shared hosting). When it comes to file permissions, I found two documentation pages:

When following the instructions for a shared hosting environment at the first link, everything is fine. But, I assumed I had to follow the instructions at the second link as well since I am configuring a production environment. As soon as I run the command to "Make code files and directories read-only", I get an error like this: Backend fatal error: PHP Fatal error: Uncaught Zend_Cache_Exception, because cache_dir var/page_cache is not writable.

This seems logical since the command made var read-only.

So, is the documentation wrong? Or should I somehow only follow the documentation at the first link, not the second?

2

Here's an explanation of what each folder does in var: https://devdocs.magento.com/guides/v2.2/howdoi/php/php_clear-dirs.html

It makes sense that view_preprocessed folder is made read only after the files have been generated. It also makes sense that the generated folder is write only after its generated, but some things can't be read only in var (example: logs).

Looks like a devdocs mistake with the command not doing what the best practice describes above it.

  • I am on a single-user environment (edited question to add that information). Both owner and group of all files are set to this user. My question is, why does the documentation state to make var read-only, while Magento does seem to need to write to it? – user125661 Aug 9 '18 at 7:05
  • I see what you mean. The devdocs say that for production mode for single user, that var/view_preprocessed should not have write permissions, but the command they offer removes write access to var. – ByteCreation Aug 9 '18 at 7:20
  • Var cannot be read only for the user running hosting software. Example: log writing. Parts of it maybe, and if logs are managed by a different system maybe, but not out of the box. – ByteCreation Aug 9 '18 at 7:21
  • Here's an explanation of what each folder does in var: devdocs.magento.com/guides/v2.2/howdoi/php/php_clear-dirs.html . It makes sense that view_preprocessed made read only after the files have been generated, also makes sense that the generated folder is write only after its generated, but some things can't be read only in var. Looks like a devdocs mistake with the command not doing what the best practice describes above it. – ByteCreation Aug 9 '18 at 7:26
  • Thanks! Maybe you could put that in a separate answer so I can accept that? – user125661 Aug 9 '18 at 7:52

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.