Bug #71420 [Opn->Fbk]: Can't echo very large strings
Edit report at https://bugs.php.net/bug.php?id=71420&edit=1
ID: 71420
Updated by: requinix@php.net
Reported by: mark at interactivedimension dot com
Summary: Can't echo very large strings
-Status: Open
+Status: Feedback
Type: Bug
Package: Performance problem
Operating System: Linux
PHP Version: 5.6.17
Block user comment: N
Private report: N
New Comment:
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();
?>
Previous Comments:
------------------------------------------------------------------------
[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
Thread (8 messages)