Enable redis module on php – nginx webserver
Date Posted:12-02-2017
Redis is a in memory cache used as database cache, database to serve the page faster. We are not going to deal with how the application works, usage,etc., Refer redis official documentation to get to know the use case,etc.,
Prerequisites:
- Ubuntu 16
- Nginx webserver
- Php
If webserver or php not installed then follow the below post.
Install Nginx, Php, MariaDB on Ubuntu 16.04
Enable Redis Module:
Clone the redis module on the server.
cd /usr/local/src/
git clone https://github.com/phpredis/phpredis.git
Move the redis folder to /etc directory.
mv phpredis/ /etc/ && cd /etc/phpredis
Run phpize command.
phpize
Run the configure.
./configure
Compile and install the program.
make && make install
Add the extension to the enable redis module.
echo 'extension=redis.so' >/etc/php/7.0/mods-available/redis.ini
Enable the module
phpenmod redis
Restart the webserver.
service nginx restart
service php7.0-fpm restart
Verification:
Create phpinfo and check the redis module.
vi /var/www/html/info.php
<?php
phpinfo();
?>
Access the page on the browser using the domain or IP address and we can see redis module.
http://IPaddress/info.php