Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7508733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:43:38+00:00 2026-05-29T22:43:38+00:00

I have a script that builds my webpage in one string ($content) and then

  • 0

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);
$content = create_content();
$content_time=(microtime(true)-$time1)

$time = microtime(true);
echo $content;
$echo_time = (microtime(true)-$time);

Now $content_time is always well under 0.5s so thats no problem. However a few times a day the $echo_time is well above one second and can even go up to 15 seconds. The content isn’t really big, about 10-20kb and the times at which this happens are completly random, so it’s not on the busy times and even happen in the middle of the night.

Anybody have any idea what that can be?

EDIT
The site is hosted on a (remote) dedicated server and only host this site. There is a database involved but like I say the $content_time is well under 1 second, so what this function does can not be the delay.

When the time of my site is above a certain value (lets say 5s) I log this. Even Googlebots seems to have these issues sometimes so I don’t think they use a dial-up connection 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T22:43:38+00:00Added an answer on May 29, 2026 at 10:43 pm

    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

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a script that takes lots of content and builds 1000s of MovieClips
I have a script that I'd like to continue using, but it looks like
I have a Bash script that builds a string to run as a command
I have a PHP script that builds a binary search tree over a rather
I have a MSBuild script that I am executing through TeamCity. One of the
I know this is kinda dumb, but... If I have a php script that
I am in the process of writing a script that builds upon user input,
I have a script that builds a list based on a directory structure. It
I have a simple shell script that builds my Roxygen documents, builds the package,
In a project, I have a script called make.sh that builds the project and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.