Latest news for Small Business Owners

How do you keep up to date with new ideas, new technology & market changes?
Do you have time to scour the web looking for new ideas & the next best thing to add to your website?
You want the latest news about your company & industry news all in one easy-to-access place.
2 minutes reading time (392 words)

Joomla and PHP Output Buffering

Joomla and PHP Output Buffering

 When doing a fresh install of Joomla, a popular CMS, users are often confronted with a message that states:
Output Buffering should be disabled.  

This article attempts to explain, in non-technical terms, what Output Buffering is and why Joomla recommends that you disable it. 
We have also included a simple guide to show you how to disable PHP Output buffering.

What is PHP Output Buffering?

What is PHP Output buffering?
Output buffering is a mechanism for controlling how much output data (excluding headers and cookies) PHP should keep internally before pushing that data to the client. So your webserver will wait (buffer) until it has all the information needed before sending out the data. 
i.e webpages are stored and then sent to the browser as one piece. 

So why is this a good thing?
Broadly speaking, Output buffering is a way to get your website pages to load faster on the user's browser.

This is simply because a webserver can buffer much faster than it can send bits and pieces of the website code over the Internet.

Why does Joomla recommend that you set Output Buffering to OFF?

Actually, Joomla! always uses output buffering, except when it only needs to issue a redirection. Therefore you should turn it off so as not to have any conflicts with Joomla!.

by Nicholas K. Dionysopoulos
Joomla Core Developer

So the simple answer....no need to enabled it in PHP because Joomla already has Output buffering built into its code.

Joomla always does Output buffering, it just doesn't need PHP to do it.  
And since Joomla already does all its own output buffering, there is NO additional value by enabling external PHP buffering as well.
Worse, PHP buffering may cause conflicts with Joomla's internal operations, so webpages may not load properly.

Notice that disabling PHP Output buffering is only a Joomla recommendation, and in most cases leaving it enabled will have no noticeable effect. But if its not needed, why leave it on?  Its just another thing that could go wrong.


How do you disable PHP output buffering? 

Option 1:  Edit php.ini 
(This will affect all websites on the server)

Find this line:  output_buffering = 4096
Change it as follows:  output_buffering = Off

Option 2:  Edit .htaccess 
(This will only affect the current website. Only applies to Apache webservers, NGINX and IIS do not use .htaccess)

Add this line to your .htaccess file:  php_value output_buffering off

×
Stay Informed

When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.

POPIA – South Africa’s new data protection law, in...
 

Comments

No comments made yet. Be the first to submit a comment
Guest
Thursday, 18 August 2022

Captcha Image