Bug #71420 [Fbk->Opn]: Can't echo very large strings
| From: | mark at interactivedimension dot com | Date: | Wed, 20 Jan 2016 21:36:33 +0000 |
| Subject: | Bug #71420 [Fbk->Opn]: Can't echo very large strings | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-198810@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71420&edit=1
ID: 71420
User updated by: mark at interactivedimension dot com
Reported by: mark at interactivedimension dot com
Summary: Can't echo very large strings
-Status: Feedback
+Status: Open
Type: Bug
Package: Performance problem
Operating System: Linux
PHP Version: 5.6.17
Block user comment: N
Private report: N
New Comment:
2 million. And the page hangs, never completes. Bizarrely if I view the same page, using the same
wifi connection on a mobile it loads in under a second.
Previous Comments:
------------------------------------------------------------------------
[2016-01-20 18:34:46] requinix@php.net
To be clear: you're saying the page *hangs*, meaning it never completes? Or it completes but
leaves an empty page? And is that number near 2 million or 2 *billion*?
What about
<?php
error_reporting(-1);
ini_set('display_errors', true);
echo "start<br>\n"; flush();
$data = '';
for($i = 0; $i < 3000000; $i++) {
$data .= 1;
}
echo "end<br>\n"; flush();
echo $data; flush();
?>
------------------------------------------------------------------------
[2016-01-20 16:10:43] mark at interactivedimension dot com
Nothing at all. I don't get any errors on screen either.
------------------------------------------------------------------------
[2016-01-20 15:33:35] rasmus@php.net
Anything in your error log? You could be hitting a configured memory limit.
------------------------------------------------------------------------
[2016-01-20 14:12:44] mark at interactivedimension dot com
Description:
------------
Hi
I'm not sure if this is a php bug or some kind of server config.
The script below will not run on my shared server at all. It will however work on my local machine.
It will output a string of up to approx 2million characters but there comes a point where the page
just hangs and never loads.
I can't figure out a way around this. I've tried breaking the string into smaller parts
but I can only output so much before the same thing happens.
Test script:
---------------
<?php
$data = '';
for($i = 0; $i < 3000000; $i++) {
$data .= 1;
}
echo $data;
?>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71420&edit=1