blog posts

hosting image

Install Redis and Redis-PHP in DirectAdmin

< All Topics
You are here:



Redis is a database administration system, used because the message dealer, cache and in-memory knowledge construction retailer. It’s normally known as an information construction server, actually, the keys can comprise strings, hashes, lists, units, and sorted units. Redis is developed in ANSI C and runs in most POSIX programs. We are able to allow atomic operations on these varieties, like computing set intersection, appending to a string, pushing a component to an inventory, incrementing the worth in a hash.


Set up Redis

1) SSH to the server.

#ssh root@xx.xx.xx.xx -p xxxx

2) Then it is advisable to open a display screen part utilizing the command.

#display screen -U -S identify

3) Guarantee that your server is up-to-date by operating the next command

#yum replace

4) Set up the redis package deal utilizing:

#yum set up redis

5) Now the system will set up redis, then begin the daemon.

#service redis begin

6) Set Redis to mechanically begin on boot.

#chkconfig redis on

7) Test if redis is up and operating on the system through the use of the next command.

#redis-cli MONITOR


Configure Redis

Configure some primary persistence and tuning possibility for redis.

1) Set the next values for the appendonly and appendfsync settings in redis.conf.

#vi /and many others/redis.conf

appendonly sure

appendfsync everysec

2) Restart redis.

#service redis restart

It’s essential to set the Linux kernel overcommit reminiscence setting to 1.

In /and many others/sysctl.conf we have to add vm.overcommit_memory = 1  after which reboot or run the command sysctl vm.overcommit_memory=1 for this to take impact instantly.

Make sure that to arrange some swap in your system (we propose as a lot as swap as reminiscence). As a result of if Redis occasion unintentionally consumes an excessive amount of reminiscence and your system doesn’t have a lot swap, both the Redis will crash or the Redis course of will likely be killed by the Linux kernel OOM killer.


Set up Igbinary

We are able to use Igbinary as a substitute of the usual php serializer as a result of Igbinary is a drop in alternative for the usual php serializer. Igbinary shops php knowledge constructions in compact binary kind fairly than saving as a textual illustration which consumes extra time and house. When utilizing Memcached or related reminiscence based mostly storages for serialized knowledge financial savings are important. The 50% of the storage use may be decreased.


1) Set up Igbinary by way of pecl.

#pecl set up igbinary igbinary-devel

2) Set up the Redis PHP extension.

# cd /decide/

# wget

# tar xzvf 0ae592b

# rm -f 0ae592b

# cd phpredis-phpredis-0ae592b/

# /usr/native/bin/phpize

# ./configure –enable-redis-igbinary –with-php-config=/usr/native/bin/php-config

# make -j 4

# make set up


Configure PHP for Redis-PHP

1) Add the next extensions to /usr/native/lib/php.ini.

# vi /usr/native/lib/php.ini

2) Restart Apache net server.

# service httpd restart

3) Test whether or not it’s loaded within the PHP :

# php -m | grep -E ‘redis|igbinary’


If you happen to want any additional assist, please do attain our help division.


Knowledge Base Articles