Configure localhost to display header send warnings [duplicate]

0

I would like to configure apache on my localhost so that I can see the header send warnings.

  

Warning: Can not modify header information - headers already sent by ...

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

    
asked by anonymous 12.04.2016 / 17:28

1 answer

0

You can configure error viewing 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 types of errors and warnings E_ALL is enough however in php5.3 some warnings have been separated for E_STRICT , so keeping the two is more compatibility issue and certainty that all types errors / warnings will be displayed.

Per file

You can view the errors / warnings of only one particular file using the error_reporting() and ini_set() functions.

The first function overrides the default value (that comes from php.ini) of the display_errors directive to display the errors another passable value 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'
    
12.04.2016 / 19:08