How use OCC as a beginner. Have never used it

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face: is for home/non-enterprise users. If you’re running a business, paid support can be accessed via where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:


Or for longer, use three backticks above and below the code snippet:


Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 28.): 28
Operating system and version (eg, Ubuntu 22.04): Ubuntu 22.04
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.25
PHP version (eg, 7.4): 8.1

The issue you are facing:
Try to get occ commands to work but no success. Anyone has a simple tutorial

So this is a self-hosted installation and you have access via SSH or something? Or is this running in a hosted environment without SSH?

Full access via ssh

When I try this: sudo -u www-data php occ -V

i get
CP\HintException: [0]: Memcache OC\Memcache\APCu not available for local cache (Is the matching PHP module installed and enabled?) It is installed

APCu is disabled by default when running via CLI. See Memory caching — Nextcloud latest Administration Manual latest documentation. You should find quite some threads when searching for that error as well.

1 Like

Well you can call it much, but not simple

In link above from @SysKeeper

APCu is disabled by default on CLI which could cause issues with nextcloud’s cron jobs. Please make sure you set the apc.enable_cli to 1 on your php.ini config file or append --define apc.enable_cli=1 to the cron job call.

(ok not only cron jobs also your issue)

Memory caching — Nextcloud latest Administration Manual latest documentation

1 Like

Well they are set to 1 in both php.ini to be sure. php restarted. Still same error

Are you sure the php-apcu package is actually installed?

What’s the output of the following command:

php --info|grep -i apcu

If it says nothing or just igbinary APCu serializer ABI => 0 it isn’t installed, so install it:

apt install php-apcu

If it says APCu Support => Disabled, enable it by adding the following line:


…to the following file:


If there is no apcu.ini file, that would be another indicator that the php-apcu package isn’t properly installed, so install it, and in case you are using third party repos for PHP, make sure you install the correct version of the package that matches the PHP version you’re system is actively using.

Edit: The php --info|grep -i apcu command will also show you the path to the apcu.ini.conf file of the active php version, if the package is propperly installed.

If php-apcu is installed and enabled for the CLI the output should look like this:

APCu Support => Enabled
APCu Debugging => Disabled
igbinary APCu serializer ABI => 0

Almost correct.

Please allow me to make these small corrections:

To avoid later problems with updates, one should instead of

… which basically just installs a dependency package, install the package directly in the right version:

sudo apt-get install php8.1-apcu

Since the APC user cache - if installed - is activated by default except for the cli-SAPI, it is possible but not necessary to enter the apc.enable-cli directive in the module-wide ini file:

… but should be appended to the cli-SAPI-specific ini file "/etc/php/8.1/cli/php.ini" instead.

… the path that it shows, is a symlink to /etc/php/8.1/mods-available/apcu.ini created by the phpenmod script.

Please read this: apcu.configuration


See comments about about apc. This is the full command I have to run on Centos v7 with Nginx:

sudo -u nginx php --define apc.enable_cli=1 /data/nextcloud/occ

So combine this with the help page listed above, and Bob’s your uncle.

Well, that’s a matter of opinion, I would say. :wink: If you’re on Ubuntu LTS, and you’re using the Ubuntu packages of PHP, it’s fine to let Ubuntu handle the version, since the version doesn’t change, unless you upgrade to a newer Ubuntu release. So this shouldn’t be an issue, or it may even be desired, especially since Nextcloud always supports the PHP version that is shiped with the current Ubuntu LTS.

you definitely have more knowledge than me when it comes to PHP, however, I think that’s again a matter of opinion, and since we don’t use just PHP here, but Ubuntu/Debian PHP, why not use the mechanics they implemented? :wink:

Also, In my opinion this option is first and foremost module-specific and only secondarily specific to the CLI. In other words, yes, it is CLI-specific, but it only makes sense to enable this option if the corresponding module is installed and enabled in the first place. Therefore it makes more sense to me to add it to the apcu.ini file, rather than to the more global php.ini file.

Yeah saw that too, after I already posted it. :wink:

But that is the crux. The cli specific php.ini file is LESS global in this case :wink:


Ok, actually you’re right, now that I think about it again :wink:

Now my question would be: Are you aware of any negative effects when this specific option is enabled globally? Or to put it simple: Should I change it on my system?

No :wink:

To be precise, APCu should in general not be enabled for CLI at all, as it only leads to delays on the small scale and not to optimization. Nextcloud is a real exception. So if you want to solve the problem in the best possible way, then you should specify apc.enable_cli in the respective call. Aliases or wrappers can be used for this. This ensures that it is only loaded when it does something or is requested by the script.

Here again the entry from

  • apc.enable_cli int
    Mostly for testing and debugging. Setting this enables APC for the CLI version of PHP. Under normal circumstances, it is not ideal to create, populate and destroy the APC cache on every CLI request, but for various test scenarios it is useful to be able to enable APC for the CLI version of PHP easily.


1 Like

Thanks for the detailed explanation. :+1: :slight_smile:

Of course it is. I would have been surprised if it wasn’t. :wink:


This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.