How to install oAuth using PHP 7 and PECL OAuth library? I am [unsucessfully] trying to enable the Twitter module on a Drupal 8 site that is using PHP 7 on ubuntu. The Twitter module requries oAuth to work and oAuth requires the PECL OAuth library. 

If I run sudo pecl install oauth

I get back: 

pecl/oauth is already installed and is the same as the released version 2.0.2 install failed


and then if I try drush en oauth

I get back:

Module oauth doesn't meet the requirements to be enabled.            [error]
OAuth module requires the PECL OAuth library.


Any help with how to configure the oAuth moudle and the PECL oAuth library?
Well, while I have no final solution, since I humbled over the same issue 2 years later today, I can at least put some more light on it and help with some more tests, etc.

First things first: There is some bug tracking missing in your report.

What is php -m saying? It should list all recognized php modules. The pecl php extension oauth should be listed here. If not, check if you carefully followed the instructions printed on the terminal while installing sudo pecl install oauth. It says that you have to make sure that the line  extension=oauth.so is added to your php.ini. This is a standart recommendation which can also be translated to: make sure that oauth.ini is in .../php/mods-available and symlinked from .../apache2/conf.d/... to it to be recognized as a enabled module.

If not then check php-config --extension-dir to see where all your php .so extensions are really installed and then list them with ls -ahl to make sure that oauth has been compiled correctly.

Another thing to be aware of is that php comes in 2 modes: cli mode and server mode. Both can be mixed sometimes and can cause confusion since even Drupal mixes it all the time to check php extensions. Create a simple test.php file and put &lt;? phpinfo(); ?&gt; in it and run it as a local link in browser to check if OAuth is listed there somewhere (CTRL+F oauth). If it is listed it seems that only php cli does not recognize the extension and Drupal cannot find it. In this case repeat the step above (symlink) with the extension also symlinked in .../php/cli/conf.d/.... Then php -m would show the module recognized.

Finally, if you checked it all twice like me and found out that the oauth extension still doesn't load into your php/apache2 enviroment correctly or Drupal won't find it, you will stuck on the same level like me :) And I found out, that I am not allone. There seem to be a list of issues regarding this in the web (Google) OAuth making some trouble under php7.

But if you have checked twice that php AND(!) php-cli can find the module, you will be part of the 99% who made it work with Drupal finally then. Good luck.