Configure localhost to display header sending warnings

Asked

Viewed 41 times

0

I would like to configure apache on my localhost so I can view the header sending warnings.

Warning: Cannot Modify header information - headers already sent by...

It is very common to develop the project on the localhost it works properly, let some detail escape and only realize the problem after deploy.

  • I’m not sure I understand your question. But check out the Loglevel documentation (for example Loglevel debug rewrite:trace3) https://httpd.apache.org/docs/2.4/mod/core.html#loglevel

1 answer

0


You can configure the error display in two places in php.ini or directly in a file.

php.ini

Open the file and add or modify the line:

error_reporting = E_ALL | E_STRICT

This says to display all kinds of errors and warnings E_ALL is enough but in php5.3 some warnings have been separated for E_STRICT, so keeping both is more a matter of compatibility and certainty that all types of errors/warnings will be displayed.

By file

Can display errors/warnings of only one particular file with the use of functions error_reporting() and ini_set().

The first function overwrites the default value (which comes from php.ini) of the directive display_errors to display the errors another possible value to pass is -1 which has the same effect as true. The second function sets the level of errors that will be displayed.

<?php
ini_set('display_errors', true);
error_reporting(E_ALL|E_STRICT);

$str = 'inválido'

Browser other questions tagged

You are not signed in. Login or sign up in order to post.