How to Install the PHP Redis Extension

To install a PECL extension for multiple PHP versions, repeat the PECL extension installation for each PHP version.
This PHP extension provides client access to the Redis server. It is not Redis itself. Redis is a server that provides a key/value store. When you install the Redis PHP extension, it will allow PHP to communicate with a Redis server. Read more about installing the Redis server.

Installing the Redis Extension on PHP 7.X

In the examples shown, replace "7.X" with your app's PHP version (for example, "7.0").

To install the PHP Redis extension on PHP 7.0 or PHP 7.1, SSH in to your server as root and run the following command:

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

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

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

Installing the Redis Extension on PHP 5.X

The most recent version of the Redis extension can only be installed on PHP 7.0 and above. If you need to use the Redis extension on PHP 5.4, 5.5, or 5.6, you must run Version 2.2.8.

In the examples shown, replace "5.X" with your app's PHP version (for example, "5.4").

To install this extension, run the following command as your server's root user:

sudo apt-get install gcc make autoconf libc-dev pkg-config
sudo pecl5.X-sp install redis-2.2.8

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

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

Using the PHP Redis Extension

See the documentation for the PHP Redis extension for usage information.

Alert: For Control Panel Help & Tutorials, click here: Panel Tutorials
  • 0 brukere syntes dette svaret var til hjelp
Var dette svaret til hjelp?

Relaterte artikler

Customizing the PHP Configuration on your Server

Careful! We can't provide support for customizations or for any errors, downtime, or...

Disable the PHP Opcache on your Server

PHP 5.5, 5.6, and 7.0 have a built-in opcache that is enabled by default. The entire purpose of...

How to Change PHP max_execution_time

The PHP setting max_execution_time is the number of seconds PHP will allow a script to run before...

How to Change the PHP Timezone

The default timezone for PHP is UTC regardless of your server's timezone. This is the timezone...

How to Install PHP PECL Extensions

PECL extensions are third-party compiled extensions for PHP. Install the Compiler As PECL...