Unable to configure Opcache

Info

Nextcloud version 12.0.0.29:
Operating system and version _NethServer release 7.3.1611 (Final)
(basado en _:
Apache vesion: _httpd-2.4.6-45.el7.centos.4.x86_64
PHP version (eg, 5.6):
Is this the first time you’ve seen this error?: No

Steps to replicate:

  1. Verify apcu module is installed and enabled:

    root  ~  php -v
    PHP 5.6.25 (cli) (built: Oct 21 2016 18:00:07)
    Copyright (c) 1997-2016 The PHP Group
    Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    root  ~  php -m | grep -i pcu
    apcu
    root  ~  grep enabled /etc/opt/rh/rh-php56/php.d/40-apcu.ini
    apc.enabled=1

  2. Verify opcach_* options set:

    root  ~  vi /etc/opt/rh/rh-php56/php-fpm.conf
    root  ~  grep include /etc/opt/rh/rh-php56/php-fpm.conf
    ; Include one or more files. If glob(3) exists, it is used to include a bunch of
    include=/etc/opt/rh/rh-php56/php-fpm.d/*.conf
    root  ~  tail -20 /etc/opt/rh/rh-php56/php-fpm.d/www.conf

    ; Default Value: nothing is defined by default except the values in php.ini and
    ; specified at startup with the -d argument
    ;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
    ;php_flag[display_errors] = off
    php_admin_value[error_log] = /var/opt/rh/rh-php56/log/php-fpm/www-error.log
    php_admin_flag[log_errors] = on
    ;php_admin_value[memory_limit] = 128M

    ; Set session path to a directory owned by process user
    php_value[session.save_handler] = files
    php_value[session.save_path] = /var/opt/rh/rh-php56/lib/php/session
    php_value[soap.wsdl_cache_dir] = /var/opt/rh/rh-php56/lib/php/wsdlcache
    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

(I’ve tried adding those parameters in /usr/share/nextcloud/.user.ini with the same result)

  1. Add lines to /usr/share/nextcloud/config/config.php :

'memcache.local' => '\OC\Memcache\APCu',


The issue I am facing:

I get the following warnings:

No memory cache has been configured. To enhance your performance please configure a memcache if available. Further information can be found in our documentation.
The PHP Opcache is not properly configured.

The output of my Nextcloud log in Admin > Logging:

OC\HintException: Memcache \OC\Memcache\APCu not available for local cache at /usr/share/nextcloud/lib/private/Memcache/Factory.php#96

The output of my config.php file

<?php
$CONFIG = array (
  'passwordsalt' => 'Holis',
  'secret' => 'Chaupis',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => 'muteriver.infoestructura.local',
    2 => '192.168.50.8',
    3 => 'infoestructura.local',
  ),
  'datadirectory' => '/var/lib/nethserver/nextcloud/',
  'overwrite.cli.url' => 'http://localhost',
  'dbtype' => 'mysql',
  'version' => '12.0.0.29',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nextcloud',
  'dbpassword' => 'HEY',
  'installed' => true,
  'instanceid' => 'ocmstnc1xrkf',
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => '\\OCA\\User_LDAP\\LDAPProviderFactory',
  'maintenance' => false,
  'updater.secret' => '$2y$#0$rK1f%eiH/TXsssssssssssssssssssssssHzi9N79Ta1D17ö4hÑ6',
);

The output of your Apache/nginx/system log in /var/log/httpd/ssl_access:

192.168.50.47 - - [23/Aug/2017:15:06:31 -0300] "GET /nextcloud/core/vendor/jsTimezoneDetect/jstz.js?v=267bdad1cab11800275b289f598573ad-0 HTTP/1.1" 200 14565
192.168.50.47 - - [23/Aug/2017:15:06:31 -0300] "GET /nextcloud/index.php/js/core/merged-login.js?v=267bdad1cab11800275b289f598573ad-0 HTTP/1.1" 200 1867
192.168.50.47 - - [23/Aug/2017:15:06:32 -0300] "GET /nextcloud/index.php/apps/theming/js/theming?v=0 HTTP/1.1" 200 203
192.168.50.47 - - [23/Aug/2017:15:06:32 -0300] "GET /nextcloud/core/img/background.jpg?v=0 HTTP/1.1" 200 95212
192.168.50.47 - - [23/Aug/2017:15:06:32 -0300] "GET /nextcloud/core/img/logo.svg?v=0 HTTP/1.1" 200 1232
192.168.50.47 - - [23/Aug/2017:15:06:32 -0300] "GET /nextcloud/core/img/actions/confirm-white.svg?v=2 HTTP/1.1" 200 841
192.168.50.47 - - [23/Aug/2017:15:06:32 -0300] "GET /nextcloud/core/fonts/OpenSans-Regular.woff HTTP/1.1" 200 20544
192.168.50.47 - - [23/Aug/2017:15:06:32 -0300] "GET /nextcloud/core/fonts/OpenSans-Light.woff HTTP/1.1" 200 62844
192.168.50.47 - - [23/Aug/2017:15:06:32 -0300] "GET /nextcloud/core/fonts/OpenSans-Semibold.woff HTTP/1.1" 200 69888
192.168.50.47 - - [23/Aug/2017:15:06:32 -0300] "GET /nextcloud/cron.php HTTP/1.1" 200 20

Please could you help me?

Thanks in advance!

So basically you have two seperate errors:

  1. OPCache settings are not applied.
  2. APCu is not active for Nextcloud

1. OPCache

I am no php_fpm user, but by chance I was just dealing with this:

Inside php-fpm.d/www.conf you need to set these values similar to the others with php_value/php_admin_value. I guess php_admin_value would work for all of them, for some of them it is necessary: PHP: Runtime Configuration - Manual (the ones with PHP_INI_SYSTEM) =>

php_value[opcache.enable] = 1
php_admin_value[opcache.enable_cli] = 1
php_admin_value[opcache.interned_strings_buffer] = 8
php_admin_value[opcache.max_accelerated_files] = 10000
php_admin_value[opcache.memory_consumption] = 128
php_admin_value[opcache.save_comments] = 1
php_value[opcache.revalidate_freq] = 1

should work.

Otherwise inside .user.ini you can just set the values listet as PHP_INI_ALL (link above). There they need to be set without this php_value stuff.

The traditional way would still be to set the values inside your php.ini/php.d configuration files, in this case preferred the sub file that will be only used, of the opcache module is active: /etc/opt/rh/rh-php56/php.d/XX-opcache.ini (seems to be the location in your case?)

2. APCu

I am little confused that in your case apache and php config files seem to be in one place? I am not sure which one is used in which case etc. But actually as php apcu module is active, apc.enabled=1 should be set as default: http://php.net/manual/en/apc.configuration.php
You could try to set it inside www.conf via php_admin_value[apc.enabled] = 1 as well.

Otherwise my config.php looks like this:
'memcache.local' => '\\OC\\Memcache\\APCu',
But the double backslash was set automatically and single should also work, if I remember well.