Nextcloud 12.0.2 Memory Cache Configuration

Nextcloud Version 12.0.2
Cent OS 7
Apache 2
PHP Version 7.2

I am attempting to configure Memory Caching as the final step in optimization. I am using WHM/cPanel and Softaculous. Through WHM, I installed APCu. At first, I was having an issue finding the ini file due to the use of MultiPHP.ini, but I found it (20-apcu.ini). I added the line as requested in the documentation:

‘memcache.local’ => ‘\OC\Memcache\APCu’,

At first, APCu wasn’t even loading, but after a long support session with cPanel, we figured out that the ini file was missing in the first place (a random bug, not able to replicate) and there was also a permission issue, but through that we were able to fix it and get it to load. Unfortunately, I still receive the error “No memory cache has been configured.”

I notice as well that I was requested to add the line to config.php, but after a thorough search, it seems that due to the way MultiPHP is installed, even though I am only using one version of PHP I still need to access through either multiphp.ini or the default ini file for the module. I could be wrong, though.

I understand that this isn’t necessary to function, but I would like to optimize every aspect for my clients.

If anyone has any theories or if I’ve done anything wrong you can tell, I would appreciate it greatly.

I am receiving this error in logging:

Function create_function() is deprecated at /home/secret stuff here :D/public_html/cloud/lib/private/Route/Route.php#155

It appears we have a similar question over here. According to the OP, they have figured out that PHP 7 is not compatible with APCu, and it stands to reason that neither is PHP 7.2. I could install MultiPHP 5.x, but if there is an alternative, that’s better. I’ll keep an eye on their thread.

I don’t really have much to add here, except for that I find memcache configuration a royal pain in the ass and I have seen the same error. What works for me is redis. I am not sure though, whether it is worth it. Subjectively I have not been able to sense a significant performance improvement. I haven’t measured it, though.

This is not correct.

Source: 6 Nextcloud installs with PHP 7

1 Like

Yep. It is compatible :slight_smile:

Definitely compatible for at least PHP7.0 + 7.1 and will be for sure for 7.2.

The module is defenitely loaded and appears in php -m?

I am not familiar with multiphp, so carefully check if the 20-apcu.ini is indeed loaded and is loaded inside.

In case module is loaded and appears in php -m could you provide the whole config.php? is loaded, 20-apcu.ini is also loaded. According to diagnostics, it is working fine…

These are the lines I have both in multiphp (php.ini) as well as 20-apcu.ini:
’apc.enabled = 1’
‘apc.enable_cli = 1’
‘memcache.local’ => ‘\OC\Memcache\APCu’,

Ah, this line should be added to nextcloud/config/config.php, not into the php config files.


Hi, my name is derp sickle and I can’t read because multiphp is confusing as heck and I thought it needed to be added in a php config file not specific to nextcloud.

Why thank you, kind savior. Your name shall be forever carved in stone as the person that both helped me and ruined my self-image. :stuck_out_tongue:

Seriously, though…thanks for that. I tried a search of config.php before in file manager, and didn’t even see it…

Hmm especially APC(u) I found really easy to install. Just apt install the module and add the line to config.php. At least for most dists and in my cases this always worked directly.

Never tried redis as local memcache, but it is useful for file locking as mentioned in admin manual. But redis is little complicated to set up from my point of view. Not only the additional lines/array in config.php, also the adjustments of redis-server config file and adding www-data to redis group to solve permission issues…

I used Apache 2 with EasyApache to install it via WHM/cPanel, in addition the initiation file wasn’t even created on install.

But yea, @Michalng, kudos.

:smile: If you would know how often I fall over my blindness and dump too simple or too complicated mind to find out about these same things.

I hope finally everything is working as expected. And then redis will be the next step :stuck_out_tongue:.

By the way the good step by step guides provided here often help to find such faults, e.g. by @JasonBayton: