Jump to content
Larry Ullman's Book Forums

Output Buffering Already Started


Recommended Posts

Hello,

 

How do I get rid of the output buffering already sent ? I need to generate the page title dynamically and this require to echo it before the header and it causes the the output buffer already sent to appear.

I also use the header() function in many places in my code.

 

I can't change the setting on the server because it is shared hosting.

 

 

Bahaa,

Link to comment
Share on other sites

Hello,

 

How do I get rid of the output buffering already sent ? I need to generate the page title dynamically and this require to echo it before the header and it causes the the output buffer already sent to appear.

I also use the header() function in many places in my code.

 

I can't change the setting on the server because it is shared hosting.

 

 

Bahaa,

 

This problem can be solved by omitting the closing php tags at the bottom of scripts. Possibly i could be wrong but since i started i will add the other info i found:

 

Omit the closing PHP tag (?>) in files that contain only PHP code. The closing PHP tab is optional, provided nothing else (e.g., HTML) comes after the PHP code. Leaving out the closing tag has the advantage of preventing unwanted whitespace triggering the "headers already sent" error when using includes.

Link to comment
Share on other sites

 Share

×
×
  • Create New...