-1

I'm using XAMPP 8.1.1 as dev. environment. In the php.ini is set: error_reporting = E_ALL

With this code I'm expecting the warning: "Cannot modify header information - headers already sent by..."

<?php
echo 'It works!<br>';
//Expected Warning "Cannot modify header information - headers already sent by"
header ('Content-Type: text/html; charset=utf-8');

echo '<br>...not!';
?>

If I call this function my ISP, I will get the warning, but not on my XAMPP installation. What should I change, that I will get this warning too on my XAMPP installation? I don't have access to the php.ini File at my ISP to compare the settings, all I found out, is that the error reporting is a little bit less strict, but with the same settings on my XAMPP, I do even not get the warning.

Thank you very much for your help.

  • Sorry. you are right. Is there anything else that may effect on reporting level? something like ( frameworks and xdebug ) maybe / https://stackoverflow.com/questions/13508426/header-error-not-shown-in-php – Debuqer Jan 04 '22 at 09:43

1 Answers1

2

Your ISP has output buffering disabled. On your XAMPP installation it's enabled. Outputting content before sending headers will not generate the warning unless content length exceeds configured output_buffering value (4096 by default). https://www.php.net/manual/en/outcontrol.configuration.php

Sharky
  • 419
  • 2
  • 8