• 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

APCU in PHP 7.0

EnriqueR

Regular Pleskian
Because the new version no longer support PHP APC (becouse it has OPCache), I uninstalled APC and I installed APCU. This works correctly in the system, but in the PHP 7.0.1 version installed by your auto-installer does not work. Could you please tell me how to activate this package in the PHP 7.0.1 version?

I have put apcu.ini in /opt/plesk/php/7.0/etc/php.d/ with the module activated and execute 'plesk bin php_handler --reread', but not working.
 
@EnriqueR

Please do not use APC/APCu in PHP 7, it is asking for problems in general and certainly when taking into account that PHP 7 has a built-in opcache.

Regards....
 
Hello,

APC/APCu are not officially supported by Plesk and were not tested with Plesk. We do not recommend to use it.
 
@Lev,

Thanks for more or less confirming what I already stated.

APC cannot be tested with PHP 5.6 or higher, it is not compatible.

APCu is compatible with all or most PHP versions, but it is rather buggy (understatement of the century) and will cause conflicts within Plesk.

That is the short summary of all possible tests.

In short, not surprising that APC/APCu is not supported (and is not recommended).

Regards....
 
@EnriqueR

There are various alternatives, but note that Zend Opcache is the obvious alternative: it is already present and activated by default for PHP versions 5.5 and higher.

In short, not really a necessity to have a look at other packages and/or php extensions to cache data.

Regards...
 
OPcache is only opcode cache and APCu is only data store. I think that together are fully compatible. They complement each other.

Y have array data to store in cache and OPCache not have this option. So I opted for APCu, because this store data array in cache by code.
 
@EnriqueR

Really, you forget to read that I stated "various alternatives".

In essence, when it comes to performance boosts in the form of a data store, APCu is not the obvious alternative: Redis and, to a lesser degree, Memcache are.

Regards.....
 
Finally I have installed Redis with the commands:
yum --enablerepo=remi install redis
yum install php-pecl-redis
service redis start
echo "extension=redis.so" > /opt/plesk/php/7.0/etc/php.d/redis.ini
service httpd restart
service php-fpm restart
plesk bin php_handler --reread

When I go to Tools & Settings > PHP Settings > PHP version default is available and checked. However in version 7.0 it is not available.
What is happening?? Am I missing something to recognize Redis in PHP version 7.0?
 
Using the first url I execute:

/opt/plesk/php/7.0/bin/pecl install redis

with this output:

PHP Warning: PHP Startup: Unable to load dynamic library '/opt/plesk/php/7.0/lib64/php/modules/redis.so' - /opt/plesk/php/7.0/lib64/php/modules/redis.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: Zend OPcache huge_code_pages: mmap(HUGETLB) failed: Cannot allocate memory (12) in Unknown on line 0
pecl/redis requires PHP (version >= 5.2.0, version <= 6.0.0, excluded versions: 6.0.0), installed version is 7.0.1
No valid packages found
install failed

What is happening??
Did I forget to install something?
 
Last edited:
@EnriqueR

My apologies, I was primarily responding to your implicit question on how to add a custom PHP Handler. That is, I assumed that this was the question.

Your last post opened my eyes (amongst others, I also concluded that I need more sleep, that would certainly help).

You should be aware of the facts that

- at this moment, there is no Redis module compatible with PHP 7 (all work in progress, at best)
- most Redis modules are compatible with Redis server version 2.x (at best) and not with the current stable release 3.0.6

and that would explain the miscommunication we had AND the contents of your latest post(s).

A good alternative is to switch to PHP 5.6.16 and enable the Redis module.

However, plain PHP 7 does perform just as well as any common alternative involving PHP 5.6.16 with Redis module: in order to get the most out of Redis, one has to write a customized (i.e. aligned with the caching requirements for a specific site) "redis-index.php" file and that is far-fetched at this moment.

By the way, note that the PHP 5.6.16 version in Plesk is pre-packaged with a proper Redis module.

Regards.....
 
@EnriqueR,

Note that we are currently testing a Redis module for PHP 7, compatible with Redis 2.x and (to a high degree) with Redis 3.x.

I will keep you informed, if you want that.

Regards....
 
@EnriqueR and @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: 30
Last edited:
@Elmer van der Veer

It should be compatible, if I am not mistaken.

However, it can be time to update some parts of the module.

As soon as I can find some time, I will update the module.

Regards...
 
Back
Top