I recently stumbled upon an issue when trying to set cURL as the request engine on PECL OAuth. For some odd reason, I got a warning that the expected data type of OAUTH_REQENGINE_CURL
was a long and a string was passed instead.
$oauth = new OAuth( $consumerKey, $consumerSecret ); $oauth->setRequestEngine( OAUTH_REQENGINE_CURL );
This baffled me because the cURL library and PHP extension were installed on the server. So digging further I noticed on phpinfo()
that the only request engine supported by PECL OAuth was php_streams
.
I decided to re-install the OAuth extension to be 100% sure that something didn’t go wrong on my previous installation. Looking at the installation log I noticed that it couldn’t locate the default cURL path.
checking for PHP prefix... /usr checking for PHP extension directory... /usr/lib/php5/20090626 checking for PHP installed headers prefix... /usr/include/php5 checking for oauth support... yes, shared checking for cURL in default path... cURL not found
So I decided to do some research on why this was the case and I stumbled upon this comment on StackOverflow. It seems the reason why the default cURL path wasn’t found was that the installer required some header (.h) files which were supposed to be located in /usr/include/curl
. In order to get those files I had to install the development package libcurl-dev
.
apt-get install libcurl3-dev
Once I installed the package and re-installed PECL OAuth I noticed the default path was found.
checking for cURL in default path... found in /usr
Thanks so much for this, this was exactly the issue I faced.