0

I am trying to importing the theme-unit-test xml file from wordpress.org to my own wordpress(4.0) through import section. This is my php.ini setting

enter image description here

But still get the max execution time limit error. I tried one more way with .htaccess to my worpdress site.

php_value max_execution_time 3000

But it is also not working. This is the exact error:

Fatal error: Maximum execution time of 60 seconds exceeded in C:\wamp\www\omnipress\wp-includes\class-http.php on line 1498

Then i decided to go into the core file and checked the line has the following method:

private function stream_body( $handle, $data ) {
    $data_length = strlen( $data );

    if ( $this->max_body_length && ( strlen( $this->body ) + $data_length ) > $this->max_body_length )
        $data = substr( $data, 0, ( $this->max_body_length - $data_length ) );

    if ( $this->stream_handle ) {
        $bytes_written = fwrite( $this->stream_handle, $data );
    } else {
        $this->body .= $data;
        $bytes_written = $data_length;
    }

    // Upon event of this function returning less than strlen( $data ) curl will error with CURLE_WRITE_ERROR.
    return $bytes_written;
}

And this method is called in the following CURL request:

if ( true === $r['blocking'] ) {
        curl_setopt( $handle, CURLOPT_HEADERFUNCTION, array( $this, 'stream_headers' ) );
        curl_setopt( $handle, CURLOPT_WRITEFUNCTION, array( $this, 'stream_body' ) );
    }

This CURL request has the connection timeout parameter, that i set to 0 (means unlimited timeout)

$timeout = (int) ceil( 0 );
curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, $timeout );
curl_setopt( $handle, CURLOPT_TIMEOUT, $timeout );

But still it is not working :( Please give me the right direction to achieve this, what i have missed. This is the link of test data that i want to import into my wordpress.
https://wpcom-themes.svn.automattic.com/demo/theme-unit-test-data.xml

2
  • Had you tried choosing to skip importing media? As far as I remember there are sometimes quirks with network timeouts and those images hosted on wordpress com.
    – Rarst
    Oct 23, 2014 at 9:45
  • @Rarst, yes after skip importing media, it works fine.
    – jogesh_pi
    Oct 24, 2014 at 4:43

1 Answer 1

0

From personal experience this is network/hosting issue with original images used, which are hosted (and CDNed) by wordpress com. I had never had it bad enough to break import, but I had errors with importing them on multiple occasions.

Possible solutions:

  • the issue comes and goes, import on another day (sounds silly, but least effort :)
  • increase PHP execution time limit
  • filter http_request_timeout to reduce network timeout wait time (defaults to 5 seconds)

Note that even without errors there are several megabytes worth of them and on slow enough connection it can be sizable to download in short time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.