4

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?

2

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 <? phpinfo(); ?> 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.

0

Re oauth @nilsum's suggestion shed light into my seeming oblivion as well. I am on drupal 8 but i suppose solution would apply to Drupal 7.

You may check if this module is already installed in your server as it usually would be part of php in most cases. You may be able to install “PHP Pecl” modules if you have root access (SSH or WHM). Otherwise request your webhost to install particular module of interest in this case oauth.so . This would be found in '/opt/cpanel/ea-php72/root/usr/lib64/php/modules'. I was able to install the package and then added the extension to php.ini.

Again, where you have root access to php.ini, confirm this extension is present or not. If absent, (which is the reason some fail to enable oauth module and twitter), then add the extension 'extension=oauth.so'. Otherwise create a php.ini file on your drupal root server and add the extention (alongside any file/memory size changes you might wish to adjust. If successful, oauth easily enables which allows twitter to also be enabled. Hope this helps.enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.