OpCache with iRedMail

Hi to all,

recently i choose to install a NextCloud appliance over my iRedMail server.
As OS I installed CentOS :

[root@srv-main log]# cat /etc/redhat-release CentOS Linux release 7.6.1810 (Core)

After install i’ve the following error in my NextCloud configuration i can’t fix it :

The PHP OPcache is not properly configured. For better performance it is recommended to use the following settings in the php.ini :

opcache.enable=1
opcache.enable_cli=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1

Here the php -ini :

[root@srv-main log]# php -ini
phpinfo()
PHP Version => 7.2.16

System => Linux srv-main.magri.email 3.10.0-957.10.1.el7.x86_64 #1 SMP Mon Mar 18 15:06:45 UTC 2019 x86_64
Build Date => Mar  5 2019 14:44:49
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini
Scan this dir for additional .ini files => /etc/php.d
Additional .ini files parsed => /etc/php.d/10-opcache.ini,

This program makes use of the Zend Scripting Language Engine:
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.16, Copyright (c) 1999-2018, by Zend Technologies

[root@srv-main log]# php -ini | grep opcache
Additional .ini files parsed => /etc/php.d/10-opcache.ini,
opcache.blacklist_filename => /etc/php.d/opcache*.blacklist => /etc/php.d/opcache*.blacklist
opcache.consistency_checks => 0 => 0
opcache.dups_fix => Off => Off
opcache.enable => On => On
opcache.enable_cli => On => On
opcache.enable_file_override => Off => Off
opcache.error_log => no value => no value
opcache.file_cache => no value => no value
opcache.file_cache_consistency_checks => 1 => 1
opcache.file_cache_only => 0 => 0
opcache.file_update_protection => 2 => 2
opcache.force_restart_timeout => 180 => 180
opcache.huge_code_pages => On => On
opcache.inherited_hack => On => On
opcache.interned_strings_buffer => 8 => 8
opcache.lockfile_path => /tmp => /tmp
opcache.log_verbosity_level => 1 => 1
opcache.max_accelerated_files => 4000 => 4000
opcache.max_file_size => 0 => 0
opcache.max_wasted_percentage => 5 => 5
opcache.memory_consumption => 128 => 128
opcache.opt_debug_level => 0 => 0
opcache.optimization_level => 0x7FFFBFFF => 0x7FFFBFFF
opcache.preferred_memory_model => no value => no value
opcache.protect_memory => 0 => 0
opcache.restrict_api => no value => no value
opcache.revalidate_freq => 1 => 1
opcache.revalidate_path => Off => Off
opcache.save_comments => 1 => 1
opcache.use_cwd => On => On
opcache.validate_permission => Off => Off
opcache.validate_root => Off => Off
opcache.validate_timestamps => On => On

I’ve try to put that information in the php.ini file but the alert didn’t disappear.

Can someone help me with that ?
Thanks you.

You’re mixing up the php web andphp cli component. Your output is only related to the php command line (cli), but the web part is missing. Usually you need to create a file named e.g. info.php in your web servers root directory and open it with your browser, like e.g. https://<your-domain>/info.php, to get the correct information displayed.

Remember to remove the file once you’ve solved the problem to keep your server secure!

BTW, the search function in this forum usually helps to find related topics easily :wink:

Thanks for your reply.
Here the info from phpinfo.php (web interface).
As you can see result enabled :

PHP Version 7.2.16

System Linux srv-main.magri.email 3.10.0-957.10.1.el7.x86_64 #1 SMP Mon Mar 18 15:06:45 UTC 2019 x86_64
Build Date Mar 5 2019 14:47:14
Server API FPM/FastCGI
Virtual Directory Support disabled
Configuration File (php.ini) Path /etc
Loaded Configuration File /etc/php.ini
Scan this dir for additional .ini files /etc/php.d
Additional .ini files parsed /etc/php.d/10-opcache.ini, /etc/php.d/20-bz2.ini, /etc/php.d/20-calendar.ini, /etc/php.d/20-ctype.ini, /etc/php.d/20-curl.ini, /etc/php.d/20-dom.ini, /etc/php.d/20-exif.ini, /etc/php.d/20-fileinfo.ini, /etc/php.d/20-ftp.ini, /etc/php.d/20-gd.ini, /etc/php.d/20-gettext.ini, /etc/php.d/20-iconv.ini, /etc/php.d/20-imap.ini, /etc/php.d/20-intl.ini, /etc/php.d/20-json.ini, /etc/php.d/20-ldap.ini, /etc/php.d/20-mbstring.ini, /etc/php.d/20-mysqlnd.ini, /etc/php.d/20-pdo.ini, /etc/php.d/20-pgsql.ini, /etc/php.d/20-phar.ini, /etc/php.d/20-posix.ini, /etc/php.d/20-shmop.ini, /etc/php.d/20-simplexml.ini, /etc/php.d/20-sockets.ini, /etc/php.d/20-sqlite3.ini, /etc/php.d/20-sysvmsg.ini, /etc/php.d/20-sysvsem.ini, /etc/php.d/20-sysvshm.ini, /etc/php.d/20-tokenizer.ini, /etc/php.d/20-xml.ini, /etc/php.d/20-xmlwriter.ini, /etc/php.d/20-xsl.ini, /etc/php.d/30-mcrypt.ini, /etc/php.d/30-mysqli.ini, /etc/php.d/30-pdo_mysql.ini, /etc/php.d/30-pdo_pgsql.ini, /etc/php.d/30-pdo_sqlite.ini, /etc/php.d/30-wddx.ini, /etc/php.d/30-xmlreader.ini, /etc/php.d/40-apcu.ini, /etc/php.d/40-env.ini, /etc/php.d/40-imagick.ini, /etc/php.d/40-memcache.ini, /etc/php.d/40-zip.ini, /etc/php.d/50-apc.ini, /etc/php.d/50-apm.ini

This program makes use of the Zend Scripting Language Engine:
Zend Engine v3.2.0, Copyright © 1998-2018 Zend Technologies
with Zend OPcache v7.2.16, Copyright © 1999-2018, by Zend Technologies

apc

APC Compatibility 1.0.5

apcu

APCu Support Enabled
Version 5.1.17
APCu Debugging Disabled
MMAP Support Enabled
MMAP File Mask /tmp/apc.pvJ2Tc
Serialization Support php
Build Date Feb 8 2019 12:16:56

Zend OPcache

Opcode Caching Up and Running
Optimization Enabled
SHM Cache Enabled
File Cache Disabled
Startup OK
Shared memory model mmap
Cache hits 131211
Cache misses 1258
Used memory 40023632
Free memory 94194096
Wasted memory 0
Interned Strings Used memory 3476728
Interned Strings Free memory 4911880
Cached scripts 1248
Cached keys 2375
Max keys 7963
OOM restarts 0
Hash keys restarts 0
Manual restarts 0
Directive Local Value Master Value
opcache.blacklist_filename /etc/php.d/opcache*.blacklist /etc/php.d/opcache*.blacklist
opcache.consistency_checks 0 0
opcache.dups_fix Off Off
opcache.enable On On
opcache.enable_cli On On
opcache.enable_file_override Off Off
opcache.error_log no value no value
opcache.file_cache no value no value
opcache.file_cache_consistency_checks 1 1
opcache.file_cache_only 0 0
opcache.file_update_protection 2 2
opcache.force_restart_timeout 180 180
opcache.huge_code_pages On On
opcache.inherited_hack On On
opcache.interned_strings_buffer 8 8
opcache.lockfile_path /tmp /tmp
opcache.log_verbosity_level 1 1
opcache.max_accelerated_files 4000 4000
opcache.max_file_size 0 0
opcache.max_wasted_percentage 5 5
opcache.memory_consumption 128 128
opcache.opt_debug_level 0 0
opcache.optimization_level 0x7FFFBFFF 0x7FFFBFFF
opcache.preferred_memory_model no value no value
opcache.protect_memory 0 0
opcache.restrict_api no value no value
opcache.revalidate_freq 1 1
opcache.revalidate_path Off Off
opcache.save_comments 1 1
opcache.use_cwd On On
opcache.validate_permission Off Off
opcache.validate_root Off Off
opcache.validate_timestamps On On

I start to think there is a bug in nextcloud 15 code.
From my side, i still use Opcache Statistics and i see nextcloud script stil running correctly.


I think you’re on the right track, but … do you recognize the difference:

Requirement                           Your settings
------------------------------------  ---------------------
opcache.enable=1                      opcache.enable=1
opcache.enable_cli=1                  opcache.enable_cli=1
opcache.interned_strings_buffer=8     opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000   opcache.max_accelerated_files=4000
opcache.memory_consumption=128        opcache.memory_consumption=128
opcache.save_comments=1               opcache.save_comments=1
opcache.revalidate_freq=1             opcache.revalidate_freq=1

Modify the value

opcache.max_accelerated_files=4000

in the /etc/php.d/10-opcache.ini and restart php-fpm / nginx and solve the issue…
I can’t understand why that setting was duplicate in 3 different files !!

[root@srv-main ~]# ack 'opcache.max_accelerated_files' /etc/
/etc/php-zts.d/10-opcache.ini
18:opcache.max_accelerated_files=10000

/etc/php.ini
1017:opcache.max_accelerated_files=10000

/etc/php.d/10-opcache.ini
18:opcache.max_accelerated_files=10000
1 Like