FORUM HOME | WHUK BLOG   
WEB HOSTING UK AFFORDABLE WEBSITE HOSTING SERVICES IN UNITED KINGDOM
PHP LINUX SHARED HOSTING WINDOWS ASP.NET HOSTING PACKAGES
ECOMMERCE HOSTING ASP MSSQL MS ACCESS ODBC FRONTPAGE HOSTING
CPANEL WHM FANTASTICO RESELLER DEDICATED SERVER WEB HOSTING
CHEAP PLESK CPANEL HTML MYSQL BEST UK VPS HOSTING COMPANY
CHEAP RELIABLE UK HOSTING PROVIDER SINCE 2001
MANAGED WEB HOSTING SERVICE
AFFORDABLE WEBSITE HOSTING SERVICES IN UNITED KINGDOM

Web Hosting UK Forums | Linux Windows Dedicated Server and cPanel VPS Hosting Forum » Technical Support » PHP Hosting

Reply
 
LinkBack Thread Tools Display Modes

  #1 (permalink)  
Old 28-10-11, 06:07 PM
new member
 
Join Date: Feb 2010
Posts: 3
Default PHP BUffering

I'm hoping someone here can help me with a problem I'm having with php buffering. I've contacted Support but they don't understand why it's not working.

I have a script which takes some time so want to flush the output to my browser to inform me of the progress. Unfortunately I only see the final page of text after some time and do not see the output build up slowly.

I've gone back to basics and turned off all buffering but the output still appears all in one go. I have the following test script, at benchmarks.org.uk/flush3.php, (sorry I can't make this a link as I haven't made 5 posts yet!) which shows that buffering isn't being used and then attempts to output a line of text every second:

Code:
<html>
<body>
<?php
echo "In .htaccess we have : php_flag output_buffering Off";
echo "<br><br>This is confirmed by : ini_get('output_buffering') = ". ini_get('output_buffering');
echo "<br>ob_get_status() confirms buffering is off (it returns an empty array) : ob_get_status(true) = ";
print_r(ob_get_status(true));

for ($i=0;$i<5;$i++) {
	echo "<br><br>Wait 1 second .............................................................................. ";
	// try every flush possible and wait
	ob_end_flush(); 
	ob_flush(); 
	flush();
	sleep(1);
}
?>
<br><br>Done
</body>
</html>
I've used Wireshark to look at the packets being received by the browser and interestingly I see separate packets for the initial block of text and each following "Wait 1 second ..." message block. However they all arrive at the same time 5 seconds after requesting the page.

Does anyone have any ideas as to how I can resolve this?

Many thanks, Gary.
Reply With Quote

  #2 (permalink)  
Old 28-10-11, 10:41 PM
Cust. Interaction Assoc.
 
Join Date: Aug 2011
Posts: 149
Send a message via Skype™ to bastones
Default

Hi Gary,

I cannot figure out as to why your problem is occurring as I have never done something like this before. What I suggest you do is subscribe to the PHP Mailing List (PHP Mailing List) and ask in the PHP Mailing List as there are many experts that are subscribed to the mailing list, so you're likely to receive your answer that way .

Hope this helps.
__________________
Regards,
Ben Stones

Customer Interaction Associate

Need to contact us?

Support - 0808 262 0606 or
support.webhosting.uk.com

Customer Relations - 0808 262 0855 or
support.webhosting.uk.com

Sales - 0800 862 0890 or sales@webhosting.uk.com


Contact me
ben@webhosting.uk.com
Skype ID: whuk_ben
Reply With Quote

  #3 (permalink)  
Old 30-10-11, 09:10 AM
new member
 
Join Date: Feb 2010
Posts: 3
Default

Hi Ben,

Thanks for the suggestion. I'll take a look at the PHP Mailing List and see what I can find. At the moment I'm not convinced that it's php that's the problem here as the Wireshark output shows separate TCP messages. They just all come at once instead of every second. I'm currently investigating whether there's some sort of internal apache compression going on which is causing this problem.

If there are any other website owners out there reading this and are willing to give it a go please could you try the script on your server and see if it works for you. That may or may not rule out a problem with my script. Many thanks for your help if you do try it out.

Gary
Reply With Quote

  #4 (permalink)  
Old 30-10-11, 10:24 AM
new member
 
Join Date: Feb 2010
Posts: 3
Default

I've found the following website that allows you to test php code: writecodeonline.com/php . I've tried my script and ... it works as expected. Now I'm at a loss as to what I can do to resolve the problem .

Gary
Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT. The time now is 08:24 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Copyright 2001-2010 Web Hosting UK. All rights reserved.
Web Hosting UK Forum





Site Map

Shared Cloud
Shared Cloud From £1

Affiliate Program
Earn up to £300 Per Sale

Dedicated Servers
Dedicated Server Hosting

Cloud Hosting
Cloud Server Hosting

Load Balanced Server
Load Balancing Server

VPS Hosting
Linux VPS Hosting

Windows VPS
Windows 2003 VPS

Zimbra Hosting
Zimbra Email Hosting

cPanel Hosting
Shared Linux Hosting

Windows Hosting
Shared Windows Hosting

Coldfusion Hosting
Windows Coldfusion Hosting

cPanel Reseller Hosting
Reseller Hosting

Windows Reseller
Windows Reseller Hosting

Email Web Hosting
Email Hosting

Semi-Dedicated Server
Semi-Dedicated Hosting

Remote Backup Plans
Offsite Backup Service


cpanel hosting
Knowledgebase Articles

Pre-Sales Question
Web Hosting FAQ's

Dedicated Hosting
Dedicated Server FAQ's

Virtual Private Servers
VPS Hosting

PHP MySQL Hosting
cPanel Hosting

Windows Hosting
ASP MSSQL Hosting

Domain Name
Domain registration FAQ's

CMS Hosting
CMS Hosting FAQ's

Payment Gateways
Payment FAQ's


Support Tutorials

cPanel Tutorials
cPanel Flash Tutorials

Wordpress Tutorials
Wordpress Flash Tutorials

Plesk Tutorials
Plesk Flash Tutorials

PhpMyadmin Tutorials
PhpMyadmin Flash Tutorials

Drupal Tutorials
Drupal Flash Tutorials

Mambo Tutorials
Mambo Flash Tutorials

Joomla Tutorials
Joomla Flash Tutorials

More Hosting Tutorials