curl_exec failed
Posted by: l_x_young@hotmail.com (---.hsd1.il.comcast.net)
Date: March 29, 2012 02:56AM

Hi,

I am using Wampserver version 2.1 (64-bit). The PHP version is 5.3.4. I enabled the php_curl extension. I

verified that it is enabled by displaying the localhost page (its listed under enabled extensions). However, when

my PHP script executes curl_exec, I get the following error:

PHP Fatal error: curl_exec failed. in C:\wamp\www\WebExtend\eventsFeedOOv2.php on line 80

It works just fine on a real web server. Can you offer any advice on why its failing on Wampserver?

Thanks,

Laura

Options: ReplyQuote
Re: curl_exec failed
Posted by: RiggsFolly (---.as13285.net)
Date: April 05, 2012 10:31AM

1. Check all the logs in c:\wamp\logs or whereever you may have moved them to.

2. Check you Windows Event log for any errors that may have been reported in there from apache or php.

Options: ReplyQuote
Re: curl_exec failed
Posted by: l_x_young@hotmail.com (---.hsd1.il.comcast.net)
Date: April 05, 2012 04:35PM

The error log shows the following which doesn't tell me much other than curl_exec() failed:

[05-Apr-2012 14:08:09] PHP Fatal error: curl_exec failed. in C:\wamp\www\WebExtend\eventsFeedOOv2.php on line 93.


I checked the apache log - no errors.

I checked Windows Event log - no errors.

Options: ReplyQuote
Re: curl_exec failed
Posted by: toivo (---.belrs5.nsw.optusnet.com.au)
Date: April 06, 2012 04:10AM

Is your curl_exec() using a cURL handle returned by curl_init() which succeeded?

Options: ReplyQuote
Re: curl_exec failed
Posted by: l_x_young@hotmail.com (---.hsd1.il.comcast.net)
Date: April 06, 2012 04:23AM

I'm assuming the cURL handle is valid since I am checking the return value from curl_init() and it is not equal to FALSE.

Here is my code:

if ( ($ch = curl_init()) === FALSE )
trigger_error("Could not initialize cURL session.", E_USER_ERROR);

// Set the URL to fetch.
if ( !curl_setopt($ch, CURLOPT_URL, $events_list_URL) )
trigger_error("Could not set CURLOPT_URL.", E_USER_ERROR);

// Return the transfer as a string instead of directly outputting it.
if ( !curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE) )
trigger_error("Could not set CURLOPT_RETURNTRANSFER.", E_USER_ERROR);

// Execute a cURL session. It should return a list of events encoded in JSON.
$json = curl_exec($ch);
if ( $json === FALSE )
trigger_error("curl_exec failed.", E_USER_ERROR);

// Close the cURL session.
curl_close($ch);

return $json;

Options: ReplyQuote
Re: curl_exec failed
Posted by: RiggsFolly (---.as13285.net)
Date: April 11, 2012 10:32AM

I assume that you have checked that the curl extension has been turned on?

wamp manager -> php -> php_extensions -> php_curl

If not ticked then tick it.

Options: ReplyQuote
Re: curl_exec failed
Posted by: l_x_young@hotmail.com (---.hsd1.il.comcast.net)
Date: April 11, 2012 04:37PM

Yes, I did turn on the curl extension and I verified that it is enabled by displaying the localhost page (its listed under enabled extensions).

I did some research on the internet and found one gentleman who was using a configuration similar to mine (Wampserver version 2.1 (64-bit). The PHP version is 5.3.4. using WIndows 7) His curl_exec was also failing. He went to the trouble of installing a sniffer program. He fixed the problem by doing the following:

"I just added the "KeepAliveTime" setting with windows 7 regedit.exe in
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/services/Tcpip, as a
REG_DWORD value, set it to decimal 25000 (so 25 seconds), rebooted,
and it all works as i want it now.."

I'm not technical enough to understand his solution. I'm currently investigating it.

Let me know if you have any suggestions.

Options: ReplyQuote


Sorry, only registered users may post in this forum.