Make WordPress Core

Opened 14 years ago

Closed 12 years ago

#10638 closed defect (bug) (worksforme)

Wordpress would randomly fail, because of server configuration

Reported by: kiprasm's profile kiprasm Owned by:
Milestone: Priority: normal
Severity: critical Version: 2.8.1
Component: General Keywords: implicit_flush, random failures
Focuses: Cc:


this is a bug report + plus an actual way to fix it.

Basically, i just had an entire half of day of headaches, of why wordpress fails randomly. Sometimes it wont save pages, sometimes the voting plugin won't work, sometimes blog activation or image uploading would fail etc. etc.

Turns out it is my server configuration, which did not implicitly flush the output buffer after a script has finished executing (php.ini implicit_flush was set to 'Off'). Because of that, some ajax scripts would not work, wp-admin/index.php would freeze (left sidebar menu items would not expand after clicking on the arrows on the right), activation script was broken (only the top half would be shown), sometimes redirects would fail, throwing just blank pages (after a post edit for example), i could go on and on.. And all of this was fixed very easily (i am actually very surprised, has it never happened to other people??).

To fix it, i've added these 2 lines to wp-config.php:

ini_set('implicit_flush', 'On');

Works like a charm now. I really think you should consider adding these lines to the default Wordpress package as well.

Change History (5)

#1 @mrmist
14 years ago

A number of sites work for me with implicit_flush off in the PHP settings, so this may be something of a red herring.

#2 follow-up: @filosofo
14 years ago

Also, WordPress has a callback wp_ob_end_flush_all() attached to shutdown, so everything should already be getting flushed.

#3 in reply to: ↑ 2 @kiprasm
14 years ago

Replying to filosofo:

Also, WordPress has a callback wp_ob_end_flush_all() attached to shutdown, so everything should already be getting flushed.

I've tried to put ob_flush() and flush() and them both manually at the end of scripts, and that wouldn't help. That is probably why wp_ob_end_flush_all() didn't work either, as i see it uses ob_end_flush(). The one other thing that worked for me tho, is this sequence:
ob_end_flush(); ob_flush(); flush(); ob_start();
When i put that at the end of wp scripts, it would also work, and this was my first working solution, which i later replaced with the two lines in wp-config.php, when i saw that they work too.

Also, it might be that something is wrong with my server, since as you said a number of sites work with this configuration. Still this way it works for me, might also work for some other people out there..

#4 @ryan
14 years ago

  • Milestone changed from 2.9 to Future Release

#5 @dd32
12 years ago

  • Milestone Future Release deleted
  • Resolution set to worksforme
  • Status changed from new to closed

As it seems it's a specific server environment which does not play well with outputting 100% of page requests....

Note: See TracTickets for help on using tickets.