Web page redirection and output buffering

Why cannot all web servers by default buffer there output and only send the output to the client when the page is finish created? I developed an PHP driven website and used the header function often to redirect to a different page. Those that know PHP also know that HTML headers cannot be change when some output has already gone to the client.

To make a long story short the server I was developing on (PHP 5.0.4) was buffering PHP output by default due to a setting in the php.ini file so the call to the header function was working perfectly. When this application was put on another server that was running an older version of PHP (4.3.0), everything just broke.

What a slept to change all the pages by including ob_start() and ob_end_flush() on all the pages that used the header function.

Well I suppose things will get better in the future!!

Leave a Reply

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

*