should use @chmod() to suppress unnecessary warnings, as some systems (such as ubuntu 12.04, which is what I run) require sudo or equivalent access.
DETAIL
on page:
http://localhost/core/install.php?langcode=en&profile=standard
I get:
Warning: chmod(): Operation not permitted in Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage->ensureDirectory() (line 152 of core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php).
Warning: chmod(): Operation not permitted in Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage->cleanDirectory() (line 166 of core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php).
Warning: chmod(): Operation not permitted in Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage->save() (line 110 of core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php).
Warning: chmod(): Operation not permitted in Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage->save() (line 127 of core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php).
Warning: chmod(): Operation not permitted in Drupal\Component\PhpStorage\FileStorage->unlink() (line 112 of core/lib/Drupal/Component/PhpStorage/FileStorage.php).
Warning: chmod(): Operation not permitted in Drupal\Component\PhpStorage\FileStorage->unlink() (line 112 of core/lib/Drupal/Component/PhpStorage/FileStorage.php).
Warning: chmod(): Operation not permitted in Drupal\Component\PhpStorage\FileStorage->unlink() (line 112 of core/lib/Drupal/Component/PhpStorage/FileStorage.php).
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | chmod_warnings_on_ubuntu-2003420-2.patch | 2.23 KB | mausolos |
Comments
Comment #1
mausolos commentedi'll work on this today.
Comment #2
mausolos commentedpatch attached
Comment #4
rbayliss commentedPHP should be able to chmod these files on Ubuntu or any other *nix distro, as far as I know. But they have to be owned by the user PHP is running as (typically www-data if you are using apache, or your user if you are running drush). So I don't think we want to suppress these messages, since they are legitimately indicating that your permissions/ownership for the PHPStorage directory are wrong.
Comment #5
mausolos commentedJust before receiving the error, I did the following (as a troubleshoot/workaround for strange whitescreen/permission errors in the install process):
(d8 root dir is /usr/share/drupal/d8, for reference)
So, in spite of the fact that permissions were absurdly generous, chmod() still threw permissions errors.
My Ubuntu 12.04 is fairly out-of-box, using the taskel-installed webserver package.
Comment #6
kartagisI git pull'd Drupal 8 5 minutes ago, re-installed, and got the above warning. Then I googled and found this thread. I performed what was suggested in #5 and am still getting the warning, with an addition of Warning: file_put_contents(/var/www/drupal-8/sites/default/files/php/service_container/.htaccess): failed to open stream: Permission denied in Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage->ensureDirectory() (line 154 of core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php). I'm also changing the priority to major since I'm fairly sure noone wants to see those warnings.
Oh, by the way, I am running Drupal on a Centos VPS.
Comment #7
swentel commentedThese permissions are being discussed in #1908440: Relax MTimeProtectedFileStorage permissions for DX, drush integration and world domination
Comment #7.0
swentel commentedUpdated issue summary.
Comment #8
therobyouknow commentedI've had something similar with Linux Ubuntu 18.04 64bit LTS host and 16.04.4 Guest VM. In case any of the above ideas didn't work for you, here is what I did. Hope it saves some poor souls from the frustrated 2 hours I had :)
My solution was to change the path of the cached twig templates to a folder outside of the NFS share - i.e. change the path to something under
/tmpe.g./tmp/sites-caching/phpand set the permissions of this towww-user(notwww-data) which is the process user when these files are created.You can create the path by doing sudo mkdir -p /tmp/sites-caching/php then
sudo chown -R www-data /tmp/sites-caching(containing folder) andchgrp -R www-data /tmp/sites-cachingIn settings.local.php add the lines:
And make sure that settings.local.php is referenced from settings.php
Clear the cache -
drush crReload your page and observe the warning are gone.This gets around a limitation whereby permissions can't be changed in the guest VM for folders that are in a NFS share - which are owned by the host but mounted and accessible from the guest.
Credit to the poster of the accepted answer here: https://drupal.stackexchange.com/questions/226156/can-i-change-the-locat...