Sunday, May 22, 2011

oauth for php (and Ubuntu)

There is a "standard" PHP OAuth library, documented in the manual, and which is installed via pecl. There is no package shortcut under Ubuntu; you still have to use pecl
sudo pecl install oauth

If you get a complaint about no "phpize", install the "php5-dev" ubuntu package. And then if you get an error in "php_pcre.h" when compiling, then you need to install the "libpcre3-dev" ubuntu package.

Finally, you need to enable it. Still as root:
cd /etc/php5/conf.d
echo "" >oauth.ini

(This creates a config file just for oauth; you could also simply put the extension line in php.ini.)

Finally, "php -m" should list "OAuth", and you can create a OAuth object in your php scripts.

Ubuntu package manager lists "liboauth-php"; the minimal information, and the lack of mention of pecl, should have given me the clue that it is something different.

Also different is this:


Anonymous said...

Awesome! Thanks for the quick howto!

Anonymous said...

Yeah, thank you very much, that was exactly what I needed!

Hooray for you! :)

Big Rich said...

Cheers for this, I was stuck in classpath hell until I came across your post.

Anonymous said...

Saved and bookmarked!!

Thanks a TON!!

Kalmar said...

Anybody discovered what this "liboauth-php" is?