A partial archive of https://discourse-mediawiki.wmflabs.org as of Saturday May 21, 2022.

Installing OAuth PHP class on Toolforge, in kubernetes

Smith609

I’m working on getting a bot to authenticate using OAuth. I’ve got this working on my local machine, but not yet on toolforge.
I’m running php5.6 in the k8s environment.

When I run the script I receive “PHP Fatal error: Class ‘OAuth’ not found”.

pecl install OAuth returns Cannot install, php_dir for channel "pecl.php.net" is not writeable by the current user

How I can install the OAuth PHP class?

Tgr

Why I am sure it’s possible to get PECL projects installed, it’s probably easier to just use a pure-PHP library such as oauthclient-php (makes it less effort to fork your code, test locally, test on Travis etc).

Smith609

Thanks for the tip. Unfortunately, having very little experience of PHP libraries, I’m struggling with some of the basics here. My workflow comprises getting code running on my Windows machine, clearing CI at Travis, then running the code on Toolforge.

[EDIT:] I’ve now learned that you can install composer on Windows, and updated the Oauthclient-php documentation with the steps I’ve needed to take. This has got me to a point where I can change the code to the OAuth format. Thanks!