• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Redis module for PHP 7.0.1 and 7.0.2

trialotto

Golden Pleskian
Plesk Guru
@Everyone interested,

I have compiled and tested a redis module that works like a charm on PHP 7.0.1.

I have added a ZIP file, with two files:

- redis.so (the redis module for PHP 7.0.1)
- redis.php (a test script to check yourselves whether the module is working)

The module can be installed by following the steps:

a) upload the ZIP file to a directory on your server

b) run from the command line: echo "extension=<path to directory>/redis.so" > /opt/plesk/php/7.0/etc/php.d/redis.ini

Note: do not forget to use the proper path to the directory in which the file redis.so resides. You can use any directory to your liking.

c) run from the command line: plesk bin php_handler --reread

and that´s all, unless you want to use the test script:

d) move redis.php to the httpdocs directory of any domain to your liking,

e) open a browser and access http://<domain>/redis.php and the output should indicate a "yes".


As a final remark, note that this module

- is based upon phpredis
- has been created and tested very quickly, no guarantees, but it should work like a charm,
- is forwards compatible to PHP version 7.0.3 (dev),
- is NOT an official Plesk module (!)

In the case of questions, just mail, post or start a personal conversation with me.

Regards....
 

Attachments

  • Redis.zip
    414.8 KB · Views: 270
I just installed, seems to work fine. I'm a beginner and had a hard time getting it to work. It would show as an active module in PHP 7 settings, but the wordpress plugin kept saying the redis php module was missing.

So i tried deactivating the module and Plesk gave me an error stating a missing file (redis.so) in the modules folder.

So I copied the redis.so to the modules folder... and I guess it works :)

Activated the Wordpress plugin and voila, no errors!

Now how can we monitor Redis?
 
@PTOEM,

A Redis Monitor, that can be installed as a Plesk extension and therefore used from the Plesk Panel, is on the "project list".

Still work in progress, next to a number of other relevant extension projects.

Time can be harsh, there is never enough of it.

But I will provide the extension, if and as soon as it becomes available.

Regards......
 
Indeed, it would.

The problem is that the list of "projects" is becoming longer and longer and, to illustrate, the following list:

1 - an update of the various caching modules (redis/memcached)
2 - OpenDKIM/DMARC/SPF,
3 - DMARC Report panel,
4 - Nginx SDK,
5 - Nginx Security (i.e. increasing security via Nginx)
6 - CDN SDK
7 - Dynamic IP blacklist (i.e. central webservice to share bad IPs amongst Plesk servers and block them)
8 - OPCache Panel (i.e. management and performance reports)

and so on.

In short, quite a long list.

Any preference in the priority of one or more of those projects? Feedback is always welcome!

Regards....
 
Here is my list :)

1 - an update of the various caching modules (redis/memcached)
2 - Nginx Security (i.e. increasing security via Nginx)
3 - Dynamic IP blacklist (i.e. central webservice to share bad IPs amongst Plesk servers and block them)
4 - OPCache Panel (i.e. management and performance reports)
 
I would love to get this working but I am not succesfull up untill now. I have done the following:

1. created /bin/redis7.d/redis.so
2. ran echo "extension=/bin/redis7.d/redis.so" > /opt/plesk/php/7.0/etc/php.d/redis.ini
3. checked redis.ini and correct filepath is there
4. ran plesk bin php_handler --reread
5. restarted server

Uploaded redis.php to site.

When calling this file the only thing I get is a blank page. Any other things I could try?

I can see redis in the PHP Settings of PHP7 in Plesk Panel.

EDIT!!! I got it working bij putting the extension=/bin/redis7.d/redis.so in the PHP settings for the domain.

Thanks!
 
Last edited:
PHP Warning: PHP Startup: Unable to load dynamic library '/opt/plesk/php/7.0/lib64/php/modules/redis.so' - /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /opt/plesk/php/7.0/lib64/php/modules/redis.so) in Unknown on line 0

It seems this is for CentOS 7 / newer Debian|Ubuntu? ;-)
 
Hi StéphanS,

/lib64/libc.so.6: version `GLIBC_2.14' not found
your message just points out, that the program was compiled with glibc version 2.14 and on your server is a lower libc6 - package installed. You have two possibilities: Either compile redis with the version used on your server, or update your libc6 - package on your server. :)
 
Hi StéphanS,


your message just points out, that the program was compiled with glibc version 2.14 and on your server is a lower libc6 - package installed. You have two possibilities: Either compile redis with the version used on your server, or update your libc6 - package on your server. :)

hehe, I know, but updating libc6 doesn't seem like a trivial task / a good idea.

I compiled my own yesterday using:

Code:
cd /opt/plesk/php/7.0/include/php/ext
wget -O phpredis-php7.zip https://github.com/phpredis/phpredis/archive/php7.zip
unzip phpredis-php7.zip
rm -fv phpredis-php7.zip
cd phpredis-php7
/opt/plesk/php/7.0/bin/phpize
./configure --with-php-config=/opt/plesk/php/7.0/bin/php-config
export CFLAGS="-march=native -O2 -fomit-frame-pointer -pipe"
make
make install
ls -la /opt/plesk/php/7.0/lib64/php/modules/redis.so
/opt/plesk/php/7.0/bin/php -v
/opt/plesk/php/7.0/bin/php -i | grep redis
echo 'extension=redis.so' > /opt/plesk/php/7.0/etc/php.d/redis.ini
plesk bin php_handler --reread
 
Edit of my post: Got PHP Redis compiled and working on CentOS 7 and Plesk 12.5.

The problem was I haven't installed the needed librarys.
So on a fresh server this is the command to get it working:

Code:
yum update
yum install make plesk-php70-devel gcc glibc-devel zlib-devel
cd /opt/plesk/php/7.0/include/php/ext
wget -O phpredis-php7.zip https://github.com/phpredis/phpredis/archive/php7.zip
unzip phpredis-php7.zip
rm -fv phpredis-php7.zip
cd phpredis-php7
/opt/plesk/php/7.0/bin/phpize
./configure --with-php-config=/opt/plesk/php/7.0/bin/php-config
export CFLAGS="-march=native -O2 -fomit-frame-pointer -pipe"
make
make install
ls -la /opt/plesk/php/7.0/lib64/php/modules/redis.so
echo "extension=redis.so" >/opt/plesk/php/7.0/etc/php.d/redis.ini
/usr/local/psa/bin/php_handler --reread
 
Last edited:
Hello,

will the ZIP package in first post work with Ubuntu 14.04.4 LTS and php 7.0.9 (Plesk 12.5) ? Or only with CentOS ?

Thanks for a answer. :)
 
@Joachim_Weisse

It should work fine with php 7.0.9 and the OS is not really relevant: any deb (Ubuntu/Debian) or rpm (CentOS/Rhel etc) based OS should be possible.

Regards.....

PS I still have to update the package, I will do so if and when I have time.
 
Anyone manage to get phpredis 3.0.0 working? Plesk won't let me install it using pecl because PHP 5 is the default.
 
Use PHP7 pecl - /opt/plesk/php/7.0/bin/pecl

What exactly are the commands I should be using? Because I cannot install phpredis 3.0.0 using pecl.

Code:
/tmp/redis/common.h:3:43: fatal error: ext/standard/php_smart_string.h: No such file or directory
#include <ext/standard/php_smart_string.h>
                                           ^
compilation terminated.
make: *** [redis.lo] Error 1
ERROR: `make' failed
 
And even if I do install php-devel for PHP7, this error will show,

Code:
 /opt/plesk/php/7.0/bin/pecl install redis
downloading redis-3.0.0.tgz ...
Starting to download redis-3.0.0.tgz (189,720 bytes)
.....................done: 189,720 bytes
20 source files, building
running: phpize
Can't find PHP headers in /usr/include/php
The php-devel package is required for use of this command.
ERROR: `phpize' failed

forcing me to install php-devel for PHP 5.4, and thus, phpredis 2.
 
Back
Top