# Upgrade failed because of APCU, now disabled

**URL:** <https://help.nextcloud.com/t/upgrade-failed-because-of-apcu-now-disabled/120092>\
**Category:** ℹ️ Support\
**Tags:** nc21\
**Created:** [July 12, 2021, 6:37pm UTC](https://help.nextcloud.com/t/upgrade-failed-because-of-apcu-now-disabled/120092 "2021-07-12T18:37:55Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![ygoe](https://help.nextcloud.com/letter_avatar/ygoe/32/6_22734026db12803ebb3e059622ac3534.png) [@ygoe](https://help.nextcloud.com/u/ygoe)\
**Post date:** [July 12, 2021, 6:37pm UTC](https://help.nextcloud.com/t/upgrade-failed-because-of-apcu-now-disabled/120092/1 "2021-07-12T18:37:55Z")

</div>

Nextcloud version _(eg, 20.0.5)_: 21.0.3  
Operating system and version _(eg, Ubuntu 20.04)_: Ubuntu 20.04  
Apache or nginx version _(eg, Apache 2.4.25)_: Apache 2.4.x (irrelevant)  
PHP version _(eg, 7.4)_: 7.4.21

The issue you are facing:  
I upgraded Nextcloud from 20.x to 21.x using the shell upgrade script. It replaced the files fine but the occ part failed with this message:

```auto
An unhandled exception has been thrown:
OC\HintException: [0]: Memcache \OC\Memcache\APCu not available for local cache (Is the matching PHP module installed and enabled?)

```

The APCU module is available, according to the output of phpinfo(). I don’t know what else to do.  
To try to resolve the error, I edited config.php and commented out a line that looked similar, it contained something with apcu. I cannot quote it now because it was finally deleted by the upgrade. After deleting that line the occ upgrade worked and I can use Nextcloud again. Am I missing something now without that line, besides having back a functional system? Should I care about that deleted line or is it irrelevant and just troublesome?

Is this the first time you’ve seen this error? _(Y/N)_: Y

The output of your Nextcloud log in **Admin \> Logging** :

```auto
Where is this? Can't find it.

```

The output of your config.php file in `/path/to/nextcloud` (make sure you remove any identifiable information!):

```auto
<?php
$CONFIG = array (
  'passwordsalt' => ' ****',
  'secret' => ' ****',
  'trusted_domains' =>
  array (
    0 => ' ****',
  ),
  'datadirectory' => ' ****',
  'overwrite.cli.url' => ' ****',
  'htaccess.RewriteBase' => '/',
  'dbtype' => 'pgsql',
  'version' => '21.0.3.1',
  'dbname' => ' ****',
  'dbhost' => ' ****',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => ' ****',
  'dbpassword' => ' ****',
  'installed' => true,
  'instanceid' => ' ****',
  'mail_domain' => ' ****',
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => 'noreply',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'mail_smtpauth' => 1,
  'mail_sendmailmode' => 'smtp',
  'mail_smtphost' => ' ****',
  'mail_smtpsecure' => 'tls',
  'mail_smtpport' => '587',
  'mail_smtpname' => ' ****',
  'mail_smtppassword' => ' ****',
);

```

(not much left after masking private data)

The output of your Apache/nginx/system log in `/var/log/ ____ `:

```auto
(empty)

```

---

<div class="post-metadata">

**Author:** ![ygoe](https://help.nextcloud.com/letter_avatar/ygoe/32/6_22734026db12803ebb3e059622ac3534.png) [@ygoe](https://help.nextcloud.com/u/ygoe)\
**Post date:** [July 12, 2021, 6:51pm UTC](https://help.nextcloud.com/t/upgrade-failed-because-of-apcu-now-disabled/120092/2 "2021-07-12T18:51:27Z")

</div>

Short update: I found the [documentation](https://docs.nextcloud.com/server/21/admin_manual/configuration_server/caching_configuration.html) linked in one of the admin pages. I re-added that line to my config.php and everything still worked, also the warning on that info page disappeared.

But it also said I should update some database indexes. When I tried, with the provided occ command (I had to prefix it with “php”), I got the same error message about APCU again. So I commented the cache line in config.php, ran occ, uncommented it again and the web UI is still there and that warning also disappeared.

Something seems to have changed with the occ program in Nextcloud 21. It still upgraded from 20.x to 20.x but then the next major upgrade failed.

---

<div class="post-metadata">

**Author:** ![mlsxlist](https://help.nextcloud.com/user_avatar/help.nextcloud.com/mlsxlist/32/5873_2.png) [@mlsxlist](https://help.nextcloud.com/u/mlsxlist)\
**Post date:** [July 12, 2021, 6:57pm UTC](https://help.nextcloud.com/t/upgrade-failed-because-of-apcu-now-disabled/120092/3 "2021-07-12T18:57:09Z")

</div>

I experienced the same error. Setting  
apc.enable\_cli=1 resolved the error for me. According to Nextcloud documentation this should be set for APCU anyhow.

---

<div class="post-metadata">

**Author:** ![ygoe](https://help.nextcloud.com/letter_avatar/ygoe/32/6_22734026db12803ebb3e059622ac3534.png) [@ygoe](https://help.nextcloud.com/u/ygoe)\
**Post date:** [July 12, 2021, 7:37pm UTC](https://help.nextcloud.com/t/upgrade-failed-because-of-apcu-now-disabled/120092/4 "2021-07-12T19:37:31Z")

</div>

Where does that setting go? In what file?

---

<div class="post-metadata">

**Author:** ![j-ed](https://help.nextcloud.com/user_avatar/help.nextcloud.com/j-ed/32/7281_2.png) [@j-ed](https://help.nextcloud.com/u/j-ed)\
**Post date:** [July 14, 2021, 8:43am UTC](https://help.nextcloud.com/t/upgrade-failed-because-of-apcu-now-disabled/120092/5 "2021-07-14T08:43:22Z")

</div>

Check-out the PHP apcu.ini file, which e.g. exists on my server in

```auto
/etc/php7/cli/conf.d/apcu.ini
/etc/php7/fpm/conf.d/apcu.ini

```

---

<div class="post-metadata">

**Author:** ![janvlug](https://help.nextcloud.com/user_avatar/help.nextcloud.com/janvlug/32/7652_2.png) [@janvlug](https://help.nextcloud.com/u/janvlug)\
**Post date:** [July 22, 2021, 3:16pm UTC](https://help.nextcloud.com/t/upgrade-failed-because-of-apcu-now-disabled/120092/6 "2021-07-22T15:16:33Z")

</div>

I also ran into this problem, and unfortunately, I could not solve it until now. It also happened on an upgrade of nextcloud 20 to nextcloud 21.  
I did find this issue that describes the problem as well:

> <https://github.com/nextcloud/vm/issues/2039>
>
> \<!--
> Thank you for reporting your issue to us!
> 
> Please report only issues cor…responding to the VM for Nextcloud 10 or later. If you found a bug that is related to the server core, you can file your report here: https://github.com/nextcloud/server
> 
> A general note: 
> This is the \*\*issue tracker of Nextcloud\*\*, please do NOT use this to get answers to your questions or get help for fixing your installation. This is a place to report bugs to developers, after your server has been debugged.
> You can find help debugging your system on our home user forums: (https://help.nextcloud.com/c/support/appliances-docker-snappy-vm) instead. You can also buy support here: https://shop.hanssonit.se or check out the options at https://nextcloud.com/support/
> 
> Thank you!
> \--\>
> \## Steps to reproduce
> 1. Open PuTTY and log in to Nextcloud
> 2. Update the VM with the script: \`sudo bash /var/scripts/menu.sh\`
> 3. Attempt a minor release update
> 
> \## Expected behavior
> The update usually completes without any hiccups.
> 
> \## Actual behavior
> The script errors out with the following message:
> \`\`\`
> An unhandled exception has been thrown:
> OC\\HintException: \[0\]: Memcache \\OC\\Memcache\\APCu not available for local cache (Is the matching PHP module installed and enabled?)
> \`\`\`
> 
> \## Server configuration
> 
> \*\*Nextcloud server version:\*\* 21.0.2
> 
> \*\*Server OS\*\* 20.04.2 LTS
> 
> \*\*PHP Version\*\* 7.4
> 
> \*\*How did you install the VM?\*\* (Scripted install from master \*\*OR\*\* Released version)
> Purchased from TechAndMe.se
> 
> \## Network
> \*\*Do you use DHCP?\*\*
> No
> 
> \*\*Is port 80 and/or 443 open?\*\*
> Yes to both
> 
> \## Logs / Screenshots
> \<!--
> \################ Please use https://0bin.net for long error messages or logs. Thanks! ################
> \--\>
> 
> \#### Log file (/var/log/nextcloud/nextcloud.log)
> \`\`\`
> {"reqId":"HlrzHllugT6koEfqzcoJ","level":2,"time":"2021-06-23T18:55:02-05:00","remoteAddr":"","user":"--","app":"OC\\\\Log\\\\Rotate","method":"\>
> {"reqId":"wxFT1zguKoQ62axvDr3R","level":3,"time":"2021-06-23T19:02:40-05:00","remoteAddr":"213.70.130.70","user":"6DE4C6DA-602E-486D-8389-A\>
> {"reqId":"WLafzNgke46jPytF22Zl","level":3,"time":"2021-06-29T14:11:28-05:00","remoteAddr":"213.70.126.219","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"muUEtUp6kTGOsc4fZQBk","level":2,"time":"2021-06-30T10:47:23-05:00","remoteAddr":"213.69.71.49","user":"0269457C-E7F6-432A-A0A5-18\>
> {"reqId":"E1pzMrN6IQocSuucHLEo","level":3,"time":"2021-06-30T12:24:46-05:00","remoteAddr":"162.41.74.90","user":"6DE4C6DA-602E-486D-8389-A\>
> {"reqId":"FUU64O3lpfJ6QsJt3c0p","level":3,"time":"2021-06-30T12:28:44-05:00","remoteAddr":"162.41.74.210","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"yJ2GE2yyty89OcHT3IpN","level":3,"time":"2021-06-30T12:30:10-05:00","remoteAddr":"213.70.126.133","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"wPYWNP84goMQB4hZeefX","level":3,"time":"2021-06-30T12:32:11-05:00","remoteAddr":"162.41.75.13","user":"6DE4C6DA-602E-486D-8389-A\>
> {"reqId":"zHtmkGciPWreMvzUEvBZ","level":3,"time":"2021-06-30T12:34:00-05:00","remoteAddr":"162.41.75.27","user":"6DE4C6DA-602E-486D-8389-A\>
> {"reqId":"qQXOkOJ9NgE12hfIG7BW","level":3,"time":"2021-06-30T12:37:11-05:00","remoteAddr":"162.41.74.176","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"ejPCzT6FTe9FwdfgaINg","level":3,"time":"2021-06-30T12:42:54-05:00","remoteAddr":"162.41.75.21","user":"6DE4C6DA-602E-486D-8389-A\>
> {"reqId":"BwApm6zeDhhlx3Cy1q4O","level":3,"time":"2021-06-30T12:44:11-05:00","remoteAddr":"162.41.74.134","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"BlQPqfAk1ZMqmLklzvNy","level":3,"time":"2021-06-30T12:48:38-05:00","remoteAddr":"108.162.216.229","user":"6DE4C6DA-602E-486D-8389\>
> {"reqId":"cv7IlHNjmeMN1qdNPIzj","level":3,"time":"2021-06-30T12:51:29-05:00","remoteAddr":"162.41.74.200","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"e5eRxC38LVGwT4TuoHGR","level":3,"time":"2021-06-30T12:53:42-05:00","remoteAddr":"162.41.74.190","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"6U0DM3UkUSKRVcqgWvEO","level":3,"time":"2021-06-30T12:55:35-05:00","remoteAddr":"162.41.74.240","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"7bbK1BAu3UnYZSqOStt9","level":3,"time":"2021-06-30T12:57:40-05:00","remoteAddr":"162.41.74.190","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"X42b6PBu3CwnTfX54oUy","level":3,"time":"2021-06-30T12:59:32-05:00","remoteAddr":"162.41.74.102","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"vpbggeo5EQuSQocnwgxL","level":3,"time":"2021-06-30T13:01:27-05:00","remoteAddr":"162.41.74.140","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"RZBHnDmSOdZykEVgWVQx","level":3,"time":"2021-06-30T13:03:27-05:00","remoteAddr":"162.41.74.190","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"4tfmHrwDpviuenXBdkTn","level":3,"time":"2021-06-30T13:05:25-05:00","remoteAddr":"162.41.75.35","user":"6DE4C6DA-602E-486D-8389-A\>
> {"reqId":"aomEBlZS4tgkhuyvaZhQ","level":3,"time":"2021-06-30T13:07:16-05:00","remoteAddr":"162.41.75.29","user":"6DE4C6DA-602E-486D-8389-A\>
> {"reqId":"sCNncJocMkla7r1Dxnkp","level":3,"time":"2021-06-30T13:09:31-05:00","remoteAddr":"108.162.216.241","user":"6DE4C6DA-602E-486D-8389\>
> {"reqId":"VsxdwRlCL5WNliuVkS1R","level":3,"time":"2021-06-30T13:11:31-05:00","remoteAddr":"162.41.74.130","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"OZxHnRKylZkl5jb1tebN","level":3,"time":"2021-06-30T13:13:44-05:00","remoteAddr":"162.41.74.102","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"pvvzmshhcHAOBNriZglv","level":3,"time":"2021-06-30T13:16:12-05:00","remoteAddr":"162.41.74.234","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"bPl3R1d6fUJl4m4VCPqc","level":3,"time":"2021-06-30T13:17:59-05:00","remoteAddr":"162.41.74.200","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"Nwa7rz0a4Nixp7tBb6aR","level":3,"time":"2021-06-30T13:20:14-05:00","remoteAddr":"162.41.74.206","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"bBFZdU5uKNqRXnJMFyQ1","level":3,"time":"2021-06-30T13:21:47-05:00","remoteAddr":"162.41.74.234","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"IRlX5vjZR9G75yshoduQ","level":3,"time":"2021-06-30T13:23:26-05:00","remoteAddr":"162.41.74.220","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"uAX3kI89UCw88HxJWHUI","level":3,"time":"2021-06-30T13:25:04-05:00","remoteAddr":"162.41.74.106","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"aLFO68s2KtHxzGxzPiD6","level":3,"time":"2021-06-30T13:31:36-05:00","remoteAddr":"162.41.75.29","user":"6DE4C6DA-602E-486D-8389-A\>
> {"reqId":"p7RQU8qCFdhfk24TGfB6","level":3,"time":"2021-06-30T13:34:59-05:00","remoteAddr":"162.41.75.11","user":"6DE4C6DA-602E-486D-8389-A\>
> {"reqId":"qmdQcWjNf3912GVNMjmn","level":3,"time":"2021-06-30T13:36:50-05:00","remoteAddr":"108.162.216.235","user":"6DE4C6DA-602E-486D-8389\>
> {"reqId":"l3YGmJRSIoAJxjg6xKHu","level":3,"time":"2021-06-30T13:38:23-05:00","remoteAddr":"162.41.74.216","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"ysrmIqNRmbouAPzuWQQA","level":3,"time":"2021-06-30T13:40:05-05:00","remoteAddr":"162.41.74.160","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"b6sxNXBg3bwfculFrzYj","level":3,"time":"2021-06-30T13:41:53-05:00","remoteAddr":"162.41.74.102","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"EHJhBN0Q52O3bb5qMe0y","level":3,"time":"2021-06-30T13:43:14-05:00","remoteAddr":"162.41.74.212","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"IG0owdOxUCYcpStDVsX0","level":3,"time":"2021-06-30T13:44:54-05:00","remoteAddr":"162.41.74.105","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"mMJg2u0RzpJsmJNO4Wbr","level":3,"time":"2021-06-30T14:06:04-05:00","remoteAddr":"162.41.74.170","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"YC8hFUL5vmLFOMAA8qOF","level":3,"time":"2021-06-30T14:19:17-05:00","remoteAddr":"213.70.127.14","user":"6DE4C6DA-602E-486D-8389-A\>
> {"reqId":"D2WKTAIjpEYTHTs8j1fr","level":3,"time":"2021-06-30T14:23:33-05:00","remoteAddr":"213.70.126.63","user":"6DE4C6DA-602E-486D-8389-A\>
> {"reqId":"2XNDfRVtKZMAL3upBz8n","level":3,"time":"2021-06-30T14:31:31-05:00","remoteAddr":"213.70.126.35","user":"6DE4C6DA-602E-486D-8389-A\>
> {"reqId":"IN4J1U4FmuwI3kEexym8","level":3,"time":"2021-06-30T15:17:51-05:00","remoteAddr":"213.70.126.99","user":"6DE4C6DA-602E-486D-8389-A\>
> {"reqId":"Zpx6iPvILQfPPXBUOX3K","level":3,"time":"2021-06-30T15:25:40-05:00","remoteAddr":"213.70.126.51","user":"6DE4C6DA-602E-486D-8389-A\>
> {"reqId":"Oz6ckYdKGtPpfVtvGFJO","level":3,"time":"2021-06-30T15:31:49-05:00","remoteAddr":"213.70.126.189","user":"6DE4C6DA-602E-486D-8389-\>
> {"reqId":"OxN6jeU6WHZc3KdGaNac","level":2,"time":"2021-07-01T09:52:05-05:00","remoteAddr":"213.69.68.21","user":"--","app":"no app in cont\>
> {"reqId":"fSrQgt5LNamHkN9rGYSE","level":2,"time":"2021-07-01T09:52:13-05:00","remoteAddr":"213.69.68.21","user":"--","app":"no app in cont\>
> {"reqId":"3DhBcyhtvnTNp5UglLBA","level":2,"time":"2021-07-01T09:52:37-05:00","remoteAddr":"213.69.68.21","user":"--","app":"no app in cont\>
> \`\`\`
> 
> \#### Installation log (command output)
> \`\`\`
> All files are backed up.
> Maintenance mode enabled
> Removing old Nextcloud instance in 5 seconds...
> Extracting new package....
> Restoring config to Nextcloud...
> \[⣾⣽⣻⣾⣽⣻Setting secure permissions...
> Creating possible missing Directories
> chmod Files and Directories
> chown Directories
> ⣾⣽⣻⣾⣽⣻chmod/chown .htaccess
> \]
> An unhandled exception has been thrown:
> OC\\HintException: \[0\]: Memcache \\OC\\Memcache\\APCu not available for local cache (Is the matching PHP module installed and enabled?)
> Sorry but something went wrong. Please report this issue to https://github.com/nextcloud/vm/issues and include the output of the error message. Thank you!
> sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off failed
> \`\`\`

I tried to enable in all php.ini files that I could find:  
`apc.enable_cli=1`  
but still I get the error.

I have Nextcloud running on a Synology, which has a bit of an uncommon way of configuring things. This complicates the issue for me.

So, at the moment I’m stuck with a broken Nextcloud. Does anyone have a suggestion on how to finish the upgrade?

---

<div class="post-metadata">

**Author:** ![ygoe](https://help.nextcloud.com/letter_avatar/ygoe/32/6_22734026db12803ebb3e059622ac3534.png) [@ygoe](https://help.nextcloud.com/u/ygoe)\
**Post date:** [July 22, 2021, 6:54pm UTC](https://help.nextcloud.com/t/upgrade-failed-because-of-apcu-now-disabled/120092/7 "2021-07-22T18:54:07Z")

</div>

This requirement seems like bad design. Google has mostly Nextcloud trouble on page 1 for this PHP setting. And the [PHP documentation](https://www.php.net/manual/en/apcu.configuration.php#ini.apcu.enable-cli) does not even recommend this configuration:

> `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.

---

<div class="post-metadata">

**Author:** ![janvlug](https://help.nextcloud.com/user_avatar/help.nextcloud.com/janvlug/32/7652_2.png) [@janvlug](https://help.nextcloud.com/u/janvlug)\
**Post date:** [July 24, 2021, 11:30am UTC](https://help.nextcloud.com/t/upgrade-failed-because-of-apcu-now-disabled/120092/8 "2021-07-24T11:30:55Z")

</div>

In my case, I managed to work around this problem as described [here](https://github.com/nextcloud/vm/issues/2039#issuecomment-886039667).

---

<div class="post-metadata">

**Author:** ![ygoe](https://help.nextcloud.com/letter_avatar/ygoe/32/6_22734026db12803ebb3e059622ac3534.png) [@ygoe](https://help.nextcloud.com/u/ygoe)\
**Post date:** [July 24, 2021, 12:33pm UTC](https://help.nextcloud.com/t/upgrade-failed-because-of-apcu-now-disabled/120092/9 "2021-07-24T12:33:13Z")

</div>

@janvlug That’s exactly what I described in my first post in this topic.

---

<div class="post-metadata">

**Author:** ![Georg\_Klimm](https://help.nextcloud.com/user_avatar/help.nextcloud.com/georg_klimm/32/4563_2.png) [@Georg\_Klimm](https://help.nextcloud.com/u/Georg_Klimm)\
**Post date:** [January 6, 2023, 4:02pm UTC](https://help.nextcloud.com/t/upgrade-failed-because-of-apcu-now-disabled/120092/10 "2023-01-06T16:02:10Z")

</div>

Since php 8.1 you need  
sudo -u www-data php **–define apc.enable\_cli=1** -f /var/www/html/nextcloud/cron.php  
to activate apcu in cli.  
Any setting in php.ini seems to be ignored ☹

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 14, 2024, 3:48pm UTC](https://help.nextcloud.com/t/upgrade-failed-because-of-apcu-now-disabled/120092/11 "2024-12-14T15:48:41Z")

</div>


