Articles

How to Install the PHP OAuth Extension

In the examples shown, replace "5.X" or "7.X" with your app's PHP version (for example, "5.4" or "7.1"). To install a PECL extension for multiple PHP versions, repeat the PECL extension installation for each PHP version.

OAuth

The OAuth extension provides OAuth consumer and provider bindings. OAuth is an authorization protocol built on top of HTTP which allows applications to securely access data without having to store usernames and passwords.

Installing OAuth on PHP 7.0, 7.1, or 7.2

To install this extension on PHP 7.X, run the following commands as your server's root user:

sudo apt-get -y install gcc make autoconf libc-dev pkg-config
sudo pecl7.X-sp install oauth

Once installed, create a configuration file for the extension and restart PHP by running the following commands as root:

sudo bash -c "echo extension=oauth.so > /etc/php7.X-sp/conf.d/oauth.ini"
sudo service php7.X-fpm-sp restart

Installing OAuth on PHP 5.4, 5.5, or 5.6

To install this extension on PHP 5.X, run the following commands as your server's root user:

sudo apt-get -y install gcc make autoconf libc-dev pkg-config
sudo pecl5.X-sp install oauth-1.2.3

Once installed, create a configuration file for the extension and restart PHP by running the following commands as root:

sudo bash -c "echo extension=oauth.so > /etc/php5.X-sp/conf.d/oauth.ini"
sudo service php5.X-fpm-sp restart

Verifying the Installation

You can verify the oauth extension is installed correctly by running this command:

phpX.Y-sp -i | grep -i "OAuth"

You should see output like the following:

OAuth
OAuth support => enabled

Last updated: August 31, 2017