Problems adding cURL to OAuth request engine suppo

2019-02-28 00:37发布

问题:

I've recently been setting up a new environment for a web application I'm working on and I've run into this following issue that I cannot figure out.

Currently I have a docker-composer setup based off of https://hub.docker.com/r/ruslangetmansky/docker-apache-php/

Where I have my API, APP and DB running and need them to talk between each other.

During the initialisation of this, I'm currently doing the following command:

command: bash -c 'apt-get update && apt-get -y install curl libcurl3 libcurl3-dev php5-curl php5-oauth && rm -rf /var/lib/apt/lists/* && composer install && /sbin/entrypoint.sh'

I've even tried separating out the php5-oauth in-case we're running into a timing issue like so, but the same issue persists:

command: bash -c 'apt-get update && apt-get -y install curl libcurl3 libcurl3-dev php5-curl && apt-get -y install php5-oauth && rm -rf /var/lib/apt/lists/* && composer install && /sbin/entrypoint.sh'

As you can see, I've been trying everything to get php5-oauth built with cURL support, however at the moment the current build ends up with only php_streams request engine support: However it looks like cURL support is also built in: So currently when I boot my app+api, I can't talk between them due to no cURL support, as I've errors all over my application complaining of undefined constants such as the two following:

Message: Use of undefined constant OAUTH_REQENGINE_CURL - assumed 'OAUTH_REQENGINE_CURL'

and

Message: OAuth::setRequestEngine() expects parameter 1 to be long, string given

due to the lack of cURL support.

I also spotted similar questions around Stack Overflow, but nothing seems to mention what to do when these are installed and enabled but only 1 request engine is available.

Other research has led me to http://www.davidogilo.co.uk/technical/how-to-fix-oauth_reqengine_curl-is-undefined/ but my cURL default path has always been found succesfully.

Can anyone give me a hand here, or at least point out where i'm possibly going wrong? Cheers.

回答1:

Reinstall oauth with sudo pecl install oauth to compile it with cURL support