💾 Archived View for alaskalinuxuser.ddns.net › 2021-07-23_4.gmi captured on 2024-09-29 at 00:07:53. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

Nextcloud: Removing a memcache warning

">

72w, https://alaskalinuxuser3.ddns.net/wp-content/uploads/2021/05/allgood-

300x87.png 300w" sizes="(max-width: 672px) 100vw, 672px" />

Every time I log into my Nextcloud server as the administrator, the overview

tab shows me a warning about memcache. It also provides_a_link_where_you_can

read_about it and learn what to do about this warning. One key thing that I

noted was that it is not required, per their administrator manual:

You can significantly improve your Nextcloud server performance with

memory caching, where frequently-requested objects are stored in

memory for faster retrieval. There are two types of caches to use: a

PHP opcode cache, which is commonly called opcache, and data caching

for your Web server. If you do not install and enable a local

memcache you will see a warning on your Nextcloud admin page. A

memcache is not required and you may safely ignore the warning if you

prefer.

https://docs.nextcloud.com/server/20/admin_manual/

configuration_server/caching_configuration.html

That said, I like the idea of improving performance, and I also like to learn

new things. To be honest, I’ve never set up memory caching for a web server

before, so this was a great opportunity to learn something new. Granted, in the

past I’ve set up caching for compiling, such as ccache for compiling Android,

so I figured it would be along that line of thought.

So, a quick perusal of the instructions offered 3 different suggested methods:

Redis, memcached, and APCu. After reviewing the instructions, the Nextcloud

environment did not recommend memcached, and Redis looked like more work than

setting up APCu, so I went with APCu instead. A quick search revealed it was

already in the Ubuntu repository:

$ sudo aptitude search php-apcu\n[sudo] password for alaskalinuxuser: \np

php-apcu - APC User Cache for PHP \np

php-apcu-bc - APCu Backwards Compatibility Module

And so I installed it, and restarted my apache server:

$ sudo apt install php-apcu\nReading package lists... Done\nBuilding dependency

tree \nReading state information... Done\nThe following additional

packages will be installed:\n php-apcu-bc\nThe following NEW packages will be

installed:\n php-apcu php-apcu-bc\n0 upgraded, 2 newly installed, 0 to remove

and 21 not upgraded.\nNeed to get 50.7 kB of archives.\nAfter this operation,

236 kB of additional disk space will be used.\nDo you want to continue? [Y/n]

y\nGet:1 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 php-apcu

amd64 5.1.18+4.0.11-1build1 [41.8 kB]\n<<< TRIMMED FOR SPACE >>>\nProcessing

triggers for libapache2-mod-php7.4 (7.4.3-4ubuntu2.4)

...\nalaskalinuxuser@alaskalinuxuser-PowerEdge-R520:~$ sudo systemctl restart

apache2

Then I edited my Nextcloud config.php file, and added this line:

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

Note, I added it above some other lines, so I needed the comma. Supposedly, all

I had to do now was refresh my admin overview tab and the problem would be

solved, which it was! I was greeted with the green check mark of all is well.

But, further reading in the instructions for setting APCu up in Nextcloud said

that I *may* run into problems with my Nextcloud cron job, because APCu is

disabled from running in the CLI unless I made provision for that. Fortunately

for me, they provided ample instructions, and all I had to do was add this

block to my /etc/php/7.4/apache/php.ini file:

[apc]\napc.enable_cli=1\n; Just added for APCu to ensure no issues with cron.

All told, this was a great learning experience that took less than 30 minutes!

Linux – keep it simple.