Change record status: 
Project: 
Introduced in branch: 
10.2.x
Introduced in version: 
10.2.0
Description: 

Drupal now recommends sites enable PHP output buffering by default, if PHP is run as a server module, e.g. with Apache's mod_php. The reason is to enable output flushing prior to Drupal ending its execution. Services implementing DestructableInterface are then able to perform clean-up operations that would otherwise slow down delivery of page content.

A new warning will appear on the status report page for affected sites.

Sites which do not enable output buffering by default will continue to work, albeit with a potential performance penalty.

Impacts: 
Site builders, administrators, editors

Comments

anybody’s picture

Just saw this message in some installations and I'm still curious, what the php.ini / ini_set value should look like.

Could we perhaps add an example to the message in the status report or at least in the Change record?
Linking the php.net website is nice, but doesn't help a lot to tell the user what exactly to do and not to introduce even worse misconfigurations. Not all Drupal Users are Server Administration professionals, but they see the message and will try to get it away...

http://www.DROWL.de || Professionelle Drupal Lösungen aus Ostwestfalen-Lippe (OWL)
http://www.webks.de || webks: websolutions kept simple - Webbasierte Lösungen die einfach überzeugen!
http://www.drupal-theming.com || Individuelle Responsive Themes

spiralarts’s picture

Hello, any update on how to enable output buffering?

sidgrafix’s picture

Add the directive as line entry to your php.ini config file per https://www.php.net/manual/en/outcontrol.configuration.php#ini.output-bu... like the following:

output_buffering=On

- That enables output buffering for all files, you can also limit the size in bytes if you like as follows:

output_buffering=4096

When viewing https://www.php.net/manual/en/function.ob-start.php regarding actual use of output buffering with the likes of ob_start() I believe it is reference for contributed development, like what module develpers and contributers would use to work directly with output buffering. I would imagine Drupal core (now suggesting its use) has core functions that can utilize output buffering using ob_start() as well as [ ob_end_clean(), ob_end_flush(), ob_clean(), ob_flush(), etc. etc. ] - but don't quote me on that it could be in preparation for said use as well.

I think the important part is the line added to php.ini configuration for site maintaners.

If your unsure where to find your php.ini files go to /admin/reports/status/php page, you'll see php information and down a little ways you will see "Additional .ini files parsed" on the left and to its right you will see all php related .ini files any of which can be used (if you have many) or just above that you will see "Scan this dir for additional .ini files" and to its right you'll see the path to the php/conf.d directory where you can even just add a new ini file for example output-buffering.ini with a single line entry. Regardless of what ini you edit or if you add a new one apache service will need to be restarted for the change to take affect!
If your a cPanel user I believe there should be a php.ini file you can edit directly through cPanel (I haven't used cPanel in years, so I don't know for sure) - that may have changed.