I've recently upgraded to Yosemite and installed the Liip 5.5 php-osx package.
curl_exec()
returns quickly with a "Failed initialization" error. i.e. echo curl_strerror(curl_errno($ch));
prints Failed initialization
.
I've checked the URL from my machine, and it's fine. I've reproduced the error in a very basic script like this:
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.google.com/");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
All curl_setopt()
calls are returning true
. The Failed Initialization error is only reported after the curl_exec()
call.
php -v shows:
PHP 5.5.18 (cli) (built: Oct 20 2014 17:14:13)
From php -i:
Configure Command => […] '--with-curl=shared,/usr/local/php5'
…
cURL support => enabled
cURL Information => 7.37.1
It looks as though I have 3 curl binaries on my system:
- /usr/bin/curl
- /usr/local/php5-5.5.18-20141021-213554/bin/curl
- /usr/local/php5-5.5.5-20131020-222726/bin/curl
I've tried renaming each of these in turn to something else and trying again, but to no avail. In fact, renaming all three at the same time doesn't affect the outcome either.
I've tried installing the 5.4 and 5.6 versions of the package, with the same results.
Interestingly… if pecl_http is installed, then I get the "Failed initialization" error. If I remove pecl_http, I don't. Unfortunately, I need to use both cURL and pecl_http.
I'd appreciate any help you could offer.