Previously, I had shown you how to install PHP Redis from source but things changed with the latest Ubuntu LTS release. Now you can install the phpredis
extension from the Ubuntu respositories.
First, if you don’t have it installed already, let’s install Redis:
sudo apt-get install redis-server
After we get Redis installed (and/or verified that it was installed), we can install the PHP module for Redis:
sudo apt-get install php5-redis
After the module is done installing, you will want to restart your webserver and/or process manager (php-fpm
, spawncgi
, et cetera). Once you’ve restarted, you can check phpinfo()
for a new section labeled Redis.
In addition to the Redis interface, you will also gain the ability to use Redis as a save handler. For more information you can check out my post on using Redis as a PHP Session Handler.