How to install PHP Redis Extension
I have been working at the rapid changing software development field over 19 years as a software engineer, architect, devops. I am an expert in designing and implementing scalable architectures to deal with large transactions and massive requests on e-commerce and messaging services. I am skillful at using opensource technologies like Node.js, Nginx, Redis, Cassandra, ELK and Kafka to secure site reliability. I also have proficiency in C#, Java, Javascript, Python and Go.
Code Igniter is a powerful PHP framework for building full featured web applications. But, I found that storing sessions to database causes blocking by table locking. Using redis session can mitigate the blocking problem and relieve user experience even surging requests.
PHP Redis extension can be installed with these steps.
Installation from PECL
pecl install redis
Installation from sources
wget https://pecl.php.net/get/redis-5.3.2.tgz
tar xvf redis-5.3.2.tgz
cd redis-5.3.2
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
Copying redis module
cp /usr/local/php/lib/php/extensions/no-debug-non-zts-20151012/redis.so \
/usr/local/php/lib/php/extensions/
Modifying php.ini
# nginx
sudo vi /usr/local/php/etc/php.ini
# apache
sudo vi /usr/local/apache/conf/php.ini
; redis
extension=redis.so
Restarting PHP-FPM (for Nginx)
sudo service php-fpm stop
sudo service php-fpm start
Restarting HTTPD (for Apache)
sudo service httpd restart