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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...