Warning: file_put_contents(sites/default/files/php/twig/5ec7c76bcb94c_menu.html.twig_ms5R93s-wUkYaDlrCxbz7FVzS/.htaccess): failed to open stream:


Those kind of messages are a folder permission problem at the most of time. And may be it's the case of your Drupal installation. So I invite to verify the owner of "files" directory:

chown -R :www-data files

Then setting the proper permission on the Files directory:

chmod g+ws files

Fixing the permissions of pre-existing files in the Files directory:

cd files && find . -type d -exec chmod g+ws {} \ && find . -type f -exec chmod 664 {} \;

As recommended by Chris Toler.

And be careful because may be you are using a Dockerfile that force Nginx to use another user then www-data or may be you are using a shared volume for "files" directory as a cloud webapp. In that case you need to verify permissions on volumes at the host machine or using the Cloud UI to find the right permissions for your volumes. For further reading you can take a look at this Drupal topic.

Tags: Drupal

Similar questions

Omega 4 Sub-Theme problem with file_get_contents(make.libraries) failed to open stream
when creating an omega 4 sub-theme using drush 6 on windows 7 and xampp and drupal 7, see attached pic,'file_get_contents(libraries.make) : failed to open stream : no such file or directory make.utilities.inc:471 Can anyone help?
WSOD on deploy: failed to open stream: No such file or directory
I am trying to deploy a site to a live server, but running into a "white screen of death". Enabling logs revealed that the zurb foundation starter theme was the source of my issues, so I disabled that and was able to use the site. I then switched it back on and went straight into white screen of death again. Then I used drush to get a login url and...
weird error - failed to open stream - .module file in theme path?
I am just editing empty template, creating regions and so on. After I first time cleared cache weird error started to appear at every cache clearing: Warning: include_once(C:\xampp\htdocs\hkmzvolen/sites/all/themes/activit/activit.module): failed to open stream: No such file or directory v _theme_process_registry() (riadok 565 z C:\xampp\htdocs\hkm...
Image upload: Failed to open output stream
I created a media entity browser and for the image upload widget i choose the DropzoneJS.The widget settings are in the image bellow, pretty standard. And regardless of image type (png, jpg, jpeg) any image selected for upload returns with the follow error message "Failed to open output stream". I'm guessing the upload is ok but it can't be saved? ...
Drupal 7.21 install error -- failed to open stream
I am trying to install Drupal onto a server. I had originally installed 7.22, found errors, read that I should instead install 7.21 and upgrade, so I attempted that but am now receiving the following error at the Configure Site page of the install process. I am installing with root authority, so I am stumped as to why I am getting a permissions err...
Drupal 7 failed to open stream: Permission denied in image_gd_save()
I am trying to generate and scaled image for thumbnails, scaling image has no problem and when use (using the same folder an replacing) this code has not problem, the problem starts when I tried to save images in another destination folder using destination parameter: then the error occurs: Warning: imagejpeg(C:\xampp\htdocs\drupal-devel\sites\defa...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.