Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to correct error "Header already sent"

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 408
    Comment on it

    Hello readers. On developing the website the error 'Header already sent' is very likely to occur. This is cause by PHP when it receives outputs like echo or html tags now it can take the data but then further passing it to HTTP will be very difficult

    And you'll see the error

       Warning: Cannot modify header information - headers already sent by (output started at /some/file.php:12) in /some/file.php on line 23
    

    So you can remember to avoid this error by doing some corrections in your code.

    1. Whitespace before <?php or after ?>

    2.<?php # There's a SINGLE space/newline before <? - Which already seals it.

    OR

    If you have error reporting on then set the code as below

    error_reporting(E_ALL);
    ini_set("display_errors", 1);
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: