I need to share what helped solve it for me, after several days of banging my head against the wall trying to solve this issue.
For me, it happed after upgrading my Apache/PHP to any version above 8.1.10. None of the solutions listed here or on Google helped.
Eventually, I discovered that it was caused by a single line in my .htaccess file. php_value output_buffering off
all I had to do was change "off" to "0".