Just wondering, it may be related to cache settings, but why are there lots of php and .htaccess files in the public:// dir?

enter image description here

enter image description here


The PHP files are compiled Twig templates and the .htaccess file protects them from public access. You can switch off the caching of compiled twig templates by setting this service parameter to FALSE.

# Twig cache:
# By default, Twig templates will be compiled and stored in the filesystem
# to increase performance. Disabling the Twig cache will recompile the
# templates from source each time they are used. In most cases the
# auto_reload setting above should be enabled rather than disabling the
# Twig cache.
# Not recommended in production environments
# @default true
cache: true

You find this in sites/default/default.services.yml, which you have to rename to sites/default/services.yml to activate it.

  • i am using drupal as headless. So twig cached should be enabled or disable. I am getting continues Warning: file_put_contents(sites/default/files/php/twig/5ec7c76bcb94c_menu.html.twig_ms5R93s-wUkYaDlrCxbz7FVzS/.htaccess): failed to open stream:. Can you help May 23 '20 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.