[Emergency] Uncaught LogicException: Cookie can't be set. The site started outputting content at line 419 in public_html/vendor/silverstripe/framework/src/Control/HTTPResponse.php

Silverstripe Version: 4.6.1

What could cause this error: [Emergency] Uncaught LogicException: Cookie can’t be set. The site started outputting content at line 419 in public_html/vendor/silverstripe/framework/src/Control/HTTPResponse.php?

The website ran without any issues for a while and out of a sudden there is a server error. The hosting company claims they haven’t changed anything, but nobody touched the website (neither files changed nor admin area) for a few weeks.

Has anybody any idea what could cause this?

Thanks a lot.

Well, something has changed.

This error will be happening because somewhere there is some output being made before SilverStripe’s output handler has started sending the HTTP response.

Often this can come when closing PHP tags are used unnecessarily (make sure no PHP files have ?> tags at the end) and then are followed by some whitespace.

Sometimes you may accidently be echoing something to the page by mistake or as part of debugging, perhaps because the site is not set to “live” mode.

Alternatively, someone may have nefariously accessed the site and made some changes that are causing early output.

Sorry, for the late reply. This all happened while I was on holidays.
It turned out that the web hosting company did some changes in the configuration.
fileinfo and mysqlnd, pdo_mysql and mysqli were not present and inconsistent in version.

This was actually related to my other threat: https://forum.silverstripe.org/t/user-notice-mysqlnd-php-library-is-not-available-numeric-values-will-be-fetched-from-the-db-as-strings/3765?u=kimk