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).

Comments

mausolos’s picture

i'll work on this today.

mausolos’s picture

Status: Active » Needs review
StatusFileSize
new2.23 KB

patch attached

Status: Needs review » Needs work

The last submitted patch, chmod_warnings_on_ubuntu-2003420-2.patch, failed testing.

rbayliss’s picture

PHP 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.

mausolos’s picture

Just 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)

cd /usr/share/drupal
sudo chown -R <myuser>:www-data d8
sudo chmod -R 777 d8

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.

kartagis’s picture

Priority: Normal » Major

I 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.

swentel’s picture

Status: Needs work » Closed (duplicate)
swentel’s picture

Issue summary: View changes

Updated issue summary.

therobyouknow’s picture

I'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 /tmp e.g. /tmp/sites-caching/php and set the permissions of this to www-user (not www-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) and chgrp -R www-data /tmp/sites-caching

In settings.local.php add the lines:

$settings['php_storage']['twig']['directory'] = '/tmp/sites-caching/php';
$settings['php_storage']['twig']['secret'] = $settings['hash_salt'];

And make sure that settings.local.php is referenced from settings.php

Clear the cache - drush cr Reload 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...