SOLVED -- Can nginx render in-process php pages?
My old server (which uses Apache) shows pages as PHP progresses. This actually matters quite a lot because there's a few pages that take a long time to load and showing nothing makes me/users mad/confused.
Is this a limitation of Nginx? Would it work the way I need it to if I upgraded to php-fpm?
5 Replies
Turning on implicitflush made the new server behave as I'd expect. I've read that implicitflush is to be avoided though, so I've turned it off and am sprinkling flush() calls in the code where needed instead.
@Dylan:
Thanks for the help, but my problem turned out to be a PHP issue. It seems likely that my old server was using implicit_flush, even though it was off in the ini file. Maybe it was using a different ini than I thought.
Turning on implicitflush made the new server behave as I'd expect. I've read that implicitflush is to be avoided though, so I've turned it off and am sprinkling flush() calls in the code where needed instead.
I agree with the previous replies, that if you need flush() anywhere except very specific cases that require partial content (I can think of some ajaxy situations where it might be handy), you're probably doing it wrong.
I agree that relying on flush() is not ideal. The site was designed when the database was quite a bit smaller! Most pages load in 1 or 2 seconds though and when a user hits a longer load, flush() can at least show the top half of the page very quickly. It's a good enough bandaid for me.