0

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 the .theme file, 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 the cached files?

1

I suspect that your .theme file was not actually empty. Please try the experiment again and check the file size. If it is 3, then your file starts with a Unicode byte order mark (BOM).

The BOM is typically invisible in editors, but it gets sent to the browser before Drupal internally calls the header() function. This causes the error message you have seen.

From a glance on your paths, I would not conclude that the OPcache plays a role here.

| improve this answer | |

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.