• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Contribution How to: Compile PECL Redis for PHP7

Zorrobyte

New Pleskian
Hello! This is one large command to:
1. Install Redis
2. Change to 4gb memory, allkeys-lru
3. Download, compile and install the Redis 7 PECL PHP Module
4. Start & Enable Redis Server on boot
5. Force reread of Plesk PHP modules

Works on CentOS 7 & Cloudlinux 7
Read, Edit, Run at your own risk!

cd && wget -r --no-parent -A 'epel-release-*.rpm' http://dl.fedoraproject.org/pub/epel/7/x86_64/e/ && rpm -Uvh dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-*.rpm && yum -y install redis && systemctl enable redis.service && sed -i 's/# maxmemory <bytes>/maxmemory 4gb/g' /etc/redis.conf && sed -i 's/# maxmemory-policy noeviction/maxmemory-policy allkeys-lru/g' /etc/redis.conf && systemctl start redis.service && yum -y install make plesk-php56-devel gcc glibc-devel libmemcached-devel zlib-devel plesk-php70-devel git && git clone https://github.com/phpredis/phpredis.git && cd phpredis && git checkout php7 && /opt/plesk/php/7.0/bin/phpize && PATH=/opt/plesk/php/7.0/bin:$PATH ./configure && make && sudo make install && echo "extension=redis.so" > /opt/plesk/php/7.0/etc/php.d/redis.ini && plesk bin php_handler --reread
 
@Zorrobyte,

This "large" command does a lot, but some commands are "not quite ok".

Nevertheless, it is good! At least for users that want a simple and ready solution for the usage of Redis with PHP 7.

Thanks........
 
Can we make step by step guide for Redis cache, since PECL stable redis is available for PHP7.

# yum install gcc plesk-php70-devel make
# /opt/plesk/php/7.0/bin/pecl install redis
# echo "extension=redis.so" > /opt/plesk/php/7.0/etc/php.d/redis.ini
# plesk bin php_handler --reread

That's all :)
 
Can we make step by step guide for Redis cache, since PECL stable redis is available for PHP7.
@trialotto maybe you can start a thread for it . I will be happy to help and test it.
https://pecl.php.net/package/redis

@moonlight,

You can follow the approach given by @IgorG.

Another more elaborate approach is to use a Vagrant machine to compile the Redis module, with this approach having the following advantages:

a) easy selection of PHP versions and compilation of the latest (PECL) package for the specific PHP version,

b) easy update of the Redis module, to include bug fixes (note: this is rather relevant when using a Redis cluster) and other code updates.

I will create a manual for this second approach, just give me some time to run through the steps.

Regards........
 
Thank you @IgorG and @trialotto

Could you also include Redis Stable server setup steps somewhere in your guide which will Help total newbies.
We can maybe cover at least cover 2-3 popular Distros.

For Centos 7 e.g.

yum install epel-release
yum install redis
sudo systemctl start redis.service
sudo redis-cli ping
(test output should be PONG)
sudo systemctl enable redis.service
Below some useful commands
sudo systemctl stop redis.service
sudo systemctl restart redis.service ( When making config changes)

Regards
moonlight
 
Last edited:
Back
Top