I have a script that builds my webpage in one string ($content) and then echo it to the user.
My script looks like this:
$time1= microtime(true);
$conten
Let's narrow the issue down and factor out some things...
In the question you indicate you're echoing out 10-15kb. That's a significant amount no matter how it's buffered to output--remember php is single thread, once you flush your buffer you got to wait for all the output to happen via the shell or HTTP before the script continues. It will eventually have to flush the internal buffer before continuing the echo. To get good time without the flushing overhead of echo
Try replacing the
$time = microtime(true);
echo $content;
$echo_time = (microtime(true)-$time);
With
ob_start();
$time = microtime(true);
echo $content;
$echo_time = (microtime(true)-$time);
ob_clean();
This will echo to a buffer, but not actually spit it out via HTTP or whatever. That should give you the 'real' time of the echo command without any concern sending out what's in the buffer.
If echo_time shrinks down, you have a transport issue to address as best you can with buffering.
If echo_time is still to large, you'll need to start digging into the PHP C code.
Either way you're a lot closer to finding your issue and a solution