Magento2: setup:di:compile's generated cache files inaccessible by the web-server user

Created on 1 Nov 2017  路  6Comments  路  Source: magento/magento2

Preconditions

  1. OS: Linux Mint 18.2 (based on Ubuntu Xenial).
  2. Magento CE 2.2.0 with sample data is installed by Composer.
  3. Permissions and ownership set up as instructed on http://devdocs.magento.com/guides/v2.1/install-gde/prereq/file-system-perms.html#perms-private for two-user system (users "magento_user" and "www-data").

Steps to reproduce

  1. Run bin/magento setup:di:compile as Magento file system owner ("magento_user").
  2. Open the web site.

Expected result

  1. Web site opens.

Actual result

  1. var/cache/* folders lose their set-gid bits.
  2. var/cache/mage-tags/* folders are created with "magento_user"'s primary group and 660 permissions.
  3. The web user ("www-data") fails opening the site because it cannot access this content:
1 exception(s):
Exception #0 (Exception): Warning: file_put_contents(/var/www/m2training/public/var/cache//mage-tags/mage---762_COMPILED_CONFIG): failed to open stream: Permission denied in /var/www/m2training/public/vendor/colinmollenhour/cache-backend-file/File.php on line 663

The problem was reported also in this StackExchange question: https://magento.stackexchange.com/q/193727/60128

Fixed in 2.1.x Fixed in 2.2.x Fixed in 2.3.x Clear Description Confirmed Format is valid Ready for Work Reproduced on 2.1.x Reproduced on 2.2.x

All 6 comments

@JanisE, thank you for your report.
We've created internal ticket(s) MAGETWO-83148 to track progress on the issue.

Hi @JanisE. Thank you for your report.
The issue has been fixed in magento/magento2#14361 by @xtremeperf in 2.2-develop branch
Related commit(s):

The fix will be available with the upcoming 2.2.5 release.

Hi @JanisE. Thank you for your report.
The issue has been fixed in magento/magento2#14416 by @xtremeperf in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming 2.3.0 release.

Hi @JanisE. Thank you for your report.
The issue has been fixed in magento/magento2#14417 by @xtremeperf in 2.1-develop branch
Related commit(s):

The fix will be available with the upcoming 2.1.14 release.

@JanisE does the documentation need to be updated as a result of this fix?

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

@keharper , no, not as a result of this fix.

Although I'm probably not going to check if it actually fixed the problem for me, at least not any time soon.

Was this page helpful?
0 / 5 - 0 ratings