Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Wed Sep 22, 2010 4:39 pm 
Offline
Newbie

Joined: Wed Sep 22, 2010 4:30 pm
Posts: 3
I'm working on migrating to Linode and followed the LEMP guide in the library. Everything is working great except my pages don't render until all php processing is done.

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?


Last edited by Dylan on Thu Sep 23, 2010 2:11 am, edited 1 time in total.

Top
   
 Post subject:
PostPosted: Wed Sep 22, 2010 10:25 pm 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
Set fastcgi_max_temp_file_size to 0 in your nginx.conf and restart nginx


Top
   
 Post subject:
PostPosted: Wed Sep 22, 2010 10:28 pm 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
If your PHP page takes so long to load that it makes your users mad, you have a bigger problem. Displaying some parts of the page early on is only a band-aid. Have you tried caching the part that takes so long to generate? Can you generate the page without that part, and load the rest using AJAX or an iframe?


Top
   
 Post subject:
PostPosted: Thu Sep 23, 2010 2:14 am 
Offline
Newbie

Joined: Wed Sep 22, 2010 4:30 pm
Posts: 3
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 implicit_flush made the new server behave as I'd expect. I've read that implicit_flush is to be avoided though, so I've turned it off and am sprinkling flush() calls in the code where needed instead.


Top
   
 Post subject:
PostPosted: Thu Sep 23, 2010 11:20 am 
Offline
Senior Member
User avatar

Joined: Tue May 26, 2009 3:29 pm
Posts: 1691
Location: Montreal, QC
Dylan wrote:
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 implicit_flush made the new server behave as I'd expect. I've read that implicit_flush 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.


Top
   
 Post subject:
PostPosted: Sat Oct 02, 2010 2:31 pm 
Offline
Newbie

Joined: Wed Sep 22, 2010 4:30 pm
Posts: 3
For anyone who finds this later, I never did get php's flush() to work with nginx (after trying many different buffer settings). Ended up going back to Apache.

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.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group