• I have a very weird situation on my hands and I cannot understand what is happening. It is a true mystery.

    I am using a theme called, IpinPro its basically a Pinterest clone. It all works perfectly fine with the exception for fetching images.

    What makes it so mysterious is that fetching the images works perfectly fine when WP_DEBUG is set to true. When WP_DEBUG is false, the timeouts return.

    So when:

    WP_DEBUG = TRUE , the code below works perfectly fine

    WP_DEBUG = FALSE, the code below DOESNT work and will timeout on mod_fcgid

    Let me first show the code that is part of this mystery.

    Everything is peachy all upto curl_exec. I added logging to a file myself, but nothing is logged.

    if (function_exists('curl_init')) {
            $ch = curl_init();
    
            $fp = fopen("curl_exec.log", 'a+');
    
            curl_setopt($ch, CURLOPT_URL, $imgsrc);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    
    //extra options added by me, to figure out what is going in.
            curl_setopt($ch, CURLOPT_HEADER, false);
            //curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,5);
            curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
            curl_setopt($ch, CURLOPT_STDERR, $fp);
    
            $image = curl_exec($ch);
            fclose ($fp);
    
            if($image === false) {
                $curl_error = curl_error($ch);
            }
    
            curl_close($ch);
        } elseif (ini_get('allow_url_fopen')) {
            $image = file_get_contents($imgsrc, false, $context);
        }

    The error messages that I see :

    (1)
    [Thu Dec 11 22:17:14 2014] [warn] [client X.X.X.X] mod_fcgid: read data timeout in 31 seconds, referer: https://somesite.nl/itm-settings/
    [Thu Dec 11 22:17:14 2014] [warn] [client X.X.X.X] (110)Connection timed out: mod_fcgid: ap_pass_brigade failed in handle_request_ipc function, referer: https://somesite.nl/itm-settings/
    
    (2)
    [Thu Dec 11 22:42:14 2014] [warn] [client X.X.X.X] mod_fcgid: read data timeout in 31 seconds, referer: https://somesite.nl/itm-settings/
    [Thu Dec 11 22:42:14 2014] [error] [client X.X.X.X] Premature end of script headers: index.php, referer: https://somesite.nl/itm-settings/

    I have no clue what is going on.

    Increasing timeout for MOD_FCGID is no solution. Because the codes works flawlessly when WP_DEBUG = TRUE.

    Anyone?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘curl_exec causes timeout on mod_fcgid’ is closed to new replies.