Nextcloud version (eg, 20.0.5): 26.0.1
Operating system and version (eg, Ubuntu 20.04): Ubuntu Server 22.04.2 LTS
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.52
PHP version (eg, 7.4): 8.1.2
The issue you are facing:
Trying to set up APCu for data caching. I have it installed (php-apcu) on the server. Even after enabling it, the cache folder remains empty for all users regardless of accessed files.
Is this the first time you’ve seen this error? (Y/N): Y
Steps to replicate it:
In the config.php file /var/www/nextcloud/config/config.php add the following two lines 'memcache.local' => '\OC\Memcache\APCu', and 'cache_path' => '/mnt/ssd100/nextCloudCache',
Create the folder /mnt/ssd100/nextCloudCache and execute the following command sudo chown -R www-data:www-data /mnt/ssd100/nextCloudCache for nextcloud to be able to access the folder
In the file /etc/php/8.1/mods-available/apcu.ini add the following line apc.enable_cli=1. The only other line in that file is the line above: extension=apcu.so .
The output of the command sudo ls -l /mnt/ssd100/nextCloudCache/Nemanja is total 0. It can be observed that the folder Nemanja has been created when accessing the files from the user Nemanja, but nothing is cached.
The output of your Nextcloud log in Admin > Logging:
The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):
The output of your Apache/nginx/system log in /var/log/____:
Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.
The cache directory defaults to data/$user/cache where $user is the current user. You may use the 'cache_path' directive in config.php (See Configuration Parameters) to select a different location.
The Configuration Parameters page further states that
When [cache_path is] specified, the format will change to $cache_path/$user where $cache_path is the configured cache directory and $user is the user.
All that would imply that cache_path does indeed refer to APCu cache folder location… I am in fact seeing that the $cache_path is being used and that the $user folders are created, but nothing is written inside them.
Is it really not the case that the cache_path is used for APCu? If not, is there a way to move the cache folder of APCu to the path given in the config.php file attached in the first post?
@ernolf Ah, thank you so much for the clarification.
A question based on your reply (sorry, I’m still learning). Is the cache_path then used just for upload (upload files first to cache, then move them to the data drive once they are uploaded)? If so, then I totally understand the part :
If so, does cache_path then reffer to opcache from the php.ini file?
Ok, for completeness sake, I’m writing the preliminary results of the findings from this thread.
In most cases, there is no need to change the cache_path parameter since it is mostly used for upload and other Nextcloud specific caching.
cache_path has nothing to do with APCu. APCu works completely automatically and is in-memory (RAM) as can be seen in the official documentation of it here. That means that other than enabling it, no further configuration is strictly needed for it to work.
I’ve changed my configuration since the post has been created two times. First time I removed the cache_path parameter from the config.php since moving it anywhere else than the disk would introduce bottleneck to the upload process since copying from the location to the data location would be needed.
After thinking about it, I created a RAM disk for the cache folder since that wouldn’t create a bottleneck.
The way I have it set up now is:
Create a mountpoint for the RAM disk. For the example, I will create a 12 GB RAM disk and name it ramdisk12. The command for creating a mountpoint is
sudo mkdir /media/ramdisk12
Create an entry in /etc/fstab to create the RAM disk at system startup and mount it to /media/ramdisk12. For this, the following line is added to etc/fstab: