Tag: oauth

  • Warning: Use of undefined constant OAUTH_REQENGINE_CURL

    Warning: Use of undefined constant OAUTH_REQENGINE_CURL

    On an Ubuntu server (Ubuntu 20.04.2 LTS) when running a PHP script, I get the following error.

    Warning: Use of undefined constant OAUTH_REQENGINE_CURL - assumed 'OAUTH_REQENGINE_CURL' (this will throw an Error in a future version of PHP
    

    On checking phpinfo, I get

    Ubuntu PHP OAuth

    Request engine support	php_streams
    

    curl is missing in “Request engine support”.

    This is because the default php-oauth package does not support curl. To fix, uninstall php-oauth and install oauth package using pecl.

    Uninstall pcel

    apt install php-oauth -y
    

    install curl dev package

    apt install libcurl4-gnutls-dev
    ln -s /usr/include/x86_64-linux-gnu/curl /usr/include/curl
    

    Install PHP PECL

    apt install php-pear
    

    Install oAuth

    pecl install oauth
    

    Edit php.ini file

    vi /etc/php/7.4/cli/php.ini
    

    Add at end of the file

    extension=oauth.so
    

    You need to do the same for Apache and php-fpm php.ini files located at

    /etc/php/7.4/apache2/php.ini
    /etc/php/7.4/fpm/php.ini
    

    7.4 is for PHP version 7.4. Change this to whatever PHP version you have on your server. After making the change, phpinfo() page shows curl

    ubuntu php oauth

    See php