PHP header redirect problem

Few days back when I was writing some PHP, I found out that

 header( 'location: xyz.php' );

was not working on my hosting. The problem was headers were being sent by the server before processing the entire php. So I added this function at the top of the php file to buffer the output stream,

ob_start();

and the below function at the bottom of the php file to flush the buffer.

ob_end_flush();

This solved my problem.


Posted

in

by

Tags:

Comments

2 responses to “PHP header redirect problem”

  1. Debayan Avatar
    Debayan

    For this discovery you have been nominated for http://en.wikipedia.org/wiki/Turing_Award

    1. Roshan Singh Avatar
      Roshan Singh

      Thank you

Leave a Reply to Debayan Cancel reply

Your email address will not be published. Required fields are marked *