Reputation: 127
I bought a jobs portal script, I've successfully installed it and when I try to register I get this error:
cURL error 28: Connection timed out after 2013 milliseconds (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
I asked support and they said:
you need to increase read_timeout and timeout. The error is clear, you don’t have enough time to get the response. increase time in php.ini
I tried increasing max_execution_time, default_socket_timeout in php.ini both to 500, but I'm getting the same error. Then I tried manually adding read_timeout=500 and timeout=500 and again the same error.
What should I do?
Upvotes: 2
Views: 51711
Reputation: 463
Use the below mention in your curl request
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 400); //timeout in seconds
Upvotes: 0
Reputation: 1229
CURLE_OPERATION_TIMEDOUT (28)
Operation timeout. The specified time-out period was reached according to the conditions
You can set the total time of the cURL transfer using:
curl_setopt($ch, CURLOPT_TIMEOUT, 500);
Where 500 is the maximum number of seconds to allow cURL functions to execute.
Here is an example of initializing a new cURL session and fetching a web page:
<?php
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/");
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 500);
// grab URL and pass it to the browser
curl_exec($ch);
// close cURL resource, and free up system resources
curl_close($ch);
?>
Upvotes: 0