CMS Drupal Mastering Development

Opcache & Theming: Why I get an error after adding a .theme file?

After creating (e.g empty) .theme file in my template folder, I get the following error message:

The website encountered an unexpected error. Please try again later.RuntimeException: Failed to start the session because headers have already been sent by "/homepages/d825952918/htdocs/themes/universaldenker/universaldenker.theme" at line 1. in Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start() (line 145 of vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php).

If I delete .theme file again, everything works again. I think it has something to do with opcache, because the path “/homepages/d825952918/htdocs/themes/universaldenker/universaldenker.theme” comes from the .opcache folder.

How can I tell Drupal not to use it and clear all opcached files? Maybe then the problem is solved…

Leave a Reply

Your email address will not be published. Required fields are marked *