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 7650289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:12:50+00:00 2026-05-31T11:12:50+00:00

I have an issue with a URL my application is trying to access timing

  • 0

I have an issue with a URL my application is trying to access timing out. I am trying to catch this timeout and to solve this problem am using this code:

    $timeout = 120;

    if(false == $handle = @fsockopen($host, $port, $errno, $errstr, $timeout))
    {
        throw new Exception("Could not connect to url: ".$errstr);
    }

    $getRequest = "GET {$url} HTTP/1.0\r\n";
    $getRequest .= "Host: {$urlParts['host']}\r\n";
    $getRequest .= "Connection: close\r\n\r\n";

    fwrite($handle, $getRequest);

    $maxExecutionTime = ini_get('max_execution_time');
    set_time_limit($timeout+10);
    stream_set_timeout($handle, $timeout);

    $head = fread($handle, 1024); // Read the first 1024 bytes

    if($maxExecutionTime == 0) {
        $maxExecutionTime = 30;
    }
    set_time_limit($maxExecutionTime);

    $stream_metadata = stream_get_meta_data($handle);

    if($stream_metadata['timed_out'] === true) {
        throw new Exception("Connection timed out");
    }

My URL I am using for the timeout is behind a firewall, so I can not share it, but it is designed to sleep() for 5 minutes. When I try to run this code, execution stops at $head = fread($handle, 1024); and after 90 seconds I get a 500 error from the server “Premature end of script”. When I investigate at the debug level in the apache logs I see:

[Fri Aug 26 11:10:45 2011] [warn] [client 192.168.10.202] mod_fcgid: read timeout from pipe
[Fri Aug 26 11:10:45 2011] [error] [client 192.168.10.202] Premature end of script headers: validateUrl.php

with ‘validateUrl.php’ being the url I am accessing this script through. I’m not sure increasing FcgidIOTimeout to a higher value is safe, as it would apply to all of my pages. Any ideas/ comments?

System details:
PHP Version 5.2.13 running on Windows NT EPG-WEB 5.2 build 3790
Apache: Apache/2.2.19 (Win32) mod_fcgid/2.3.6

  • 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-31T11:12:51+00:00Added an answer on May 31, 2026 at 11:12 am

    Try some of those directives in your httpd.conf:

    <IfModule fcgid_module>
    
        FcgidIOTimeout 1200
        FcgidConnectTimeout 1200
        FcgidBusyScanInterval 1200
        FcgidBusyTimeout 1200
        FcgidErrorScanInterval 1200
        FcgidIdleScanInterval 1200
        FcgidIdleTimeout 1200
    
        FcgidProcessLifeTime 3600
        FcgidZombieScanInterval 1200
    
    </IfModule>
    

    source: http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html

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

Sidebar

Related Questions

I'm trying my new hand at Code Igniter and have this issue come up.
I have been trying to parse this ( http://app.calvaryccm.com/mobile/android/v1/devos ) URL using a SAX
i am trying to make the post using my linkedin api application, The issue
Right I have given in, after about 2 hours trying to figure out this
I'm using knockoutjs 2.0 I've been trying to have this table work in IE8
I have big issue with url-rewriting for IIS 7.0. I've written simple module for
I have an issue that is driving me a bit nuts: Using a UserProfileManager
We have an issue using the PEAR libraries on Windows from PHP . Pear
We have an issue related to a Java application running under a (rather old)
I have an issue with using AWK to simply remove a field from a

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.