Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top