Thursday, November 1, 2018

How To Save Session on Redis for PHP7, Ubuntu 18.04

Hi guys,
Asume that you have PHP7 already installed.
All steps as following :

1. Dowload PhpRedis
cd /tmp
wget https://github.com/phpredis/phpredis/archive/master.zip -O phpredis.zip

2. Unpack, compile and install PhpRedis
unzip -o /tmp/phpredis.zip && mv /tmp/phpredis-* /tmp/phpredis && cd /tmp/phpredis && phpize && ./configure && make && sudo make install


3. Now it is necessary to add compiled extension to php config
Add PhpRedis extension to PHP 7. 
Use proper path to your php configs e.g. /etc/php/7.0/ , /etc/php/7.1/

sudo touch /etc/php/7.0/mods-available/redis.ini && echo extension=redis.so > /etc/php/7.0/mods-available/redis.ini

sudo ln -s /etc/php/7.0/mods-available/redis.ini /etc/php/7.0/apache2/conf.d/redis.ini

4. Restart PHP-FPM if you have PHP 7

sudo service php7.0-fpm restart

5. Restart Apache 
 sudo service apache2 restart

check status of apache2
sudo systemctl status apache2

Sublime Text 3 Usage

1. Download and install sublime 2. Install some essential packages: - Seti.sublime-theme  : theme beautiful - HTML-CSS-JS Prettify (nee...