Skip to content

21.0.3 OC\HintException: Memcache \OC\Memcache\APCu not available #27781

Closed

Description

@TP75

Nextcloud 21.0.3.1 (after upgrade from 21.0.2.1)
Debian 10.10 Buster
Apache 2.4
PHP 7.3.27

After the upgrade on my machine there is a condition not appearing in any NC version before:

$ sudo -u www-data php /var/www/nextcloud/occ  maintenance:repair
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?)

No logging entry found. This makes the NC cron job unavailable apparently.

No such issue in any version before 21.0.3. All settings in place.

see also: https://help.nextcloud.com/t/cron-not-running-in-nc-21-0-3/119415/7?u=tp75

Activity

  1. added
    0. Needs triagePending check for reproducibility or if it fits our roadmap
    on Jul 3, 2021
  2. andrewheeler82 commented on Jul 3, 2021

    @andrewheeler82

    Hello, I had the same problem. For me the solution was apc.enable_cli = 1 in php.ini !!!

  3. HuguesDug commented on Jul 3, 2021

    @HuguesDug

    Same problem: I had to switch memcache to redis instead of APcu

    Raspbian, nextcloud 21.0.2 --> 21.0.3, PHP 7.3, Nginx

    In general the update to 21.0.3 went wrong. I had to go for manual install, then, blocked in maintenance mode, then repaired manually and now still strugling with a invalid_hash for core/js/mimetypelist.js.

    I should have wait for this upgrade : my install is more or less broken.

    I hope next version will fix these install issues.

  4. mstinsky commented on Jul 3, 2021

    @mstinsky

    I can confirm after upgrading from 21.0.2 to 21.0.3 the cronjob does not seem to run anymore, without showing an error.
    Enabling apc.enable_cli = 1 fixes the issue.

  5. BernieO commented on Jul 3, 2021

    @BernieO
    Contributor

    As a workaround you can use the parameter --define apc.enable_cli=1 to tell PHP to run cli commands with APCu enabled.

    Example:

    sudo -u www-data php --define apc.enable_cli=1  /var/www/nextcloud/occ  maintenance:repair
    

    Also, adding --define apc.enable_cli=1 to the according crontab line, the cronjob will get executed again.

  6. TP75 commented on Jul 3, 2021

    @TP75
    Author

    Aha, you provided a more complete solution in this report already. thanks again.

    This fix solves the issue on my machine and the NC cron job is available again.

    However, there should be a more general fix provided by the NC devs hopefully.

    Please note on my machine there was not any upgrade or change to the PHP 7.3.27 installation or the settings provided. This configuration allowed all Nextcloud versions before 21.0.3 running without the a.m. issue.

    This points at NC 21.0.3 and some PHP code issue, I presume. Your mileage may vary.

  7. andrewheeler82 commented on Jul 3, 2021

    @andrewheeler82

    Yes, I also received this error with the update from 21.0.2 to 21.0.3. I haven't changed anything on my system. I have noticed for a long time that the developers no longer have their Nextcloud project under control, errors creep in again and again that somehow nobody notices and as soon as the version is published these errors appear.

  8. AndyXheli commented on Jul 4, 2021

    @AndyXheli
    Contributor

    I don't think this is a bug just meed to add apc.enable_cli=1 to /etc/php/8.0/mods-available/apcu.ini

    #25770

  9. TP75 commented on Jul 4, 2021

    @TP75
    Author

    Thanks @andrewheeler82 and I sadly consent.
    Apparently, the new Nextcloud policy is taking from big business now: "It's not a bug it's a feature."

    https://docs.nextcloud.com/server/21/admin_manual/configuration_server/caching_configuration.html#id1

    The admin manual has been changed to reflect this change of design only recently, I presume. This seems to be an intentional change to the PHP coding in NC 22 and obviously was backported to NC 21.0.3 without any notice to the community. Please prove me wrong, but this is my picture after reading the below reports which are one month old.

    If this is the case, this apparent negligence and way of change from Nextcloud would be especially hurting to community people like me who were running a stable NC environment for years.

  10. BernieO commented on Jul 4, 2021

    @BernieO
    Contributor

    The admin manual has been changed to reflect this change of design only recently, I presume.

    Actually, the recommendation to set apc.enable_cli to 1 in the php.ini config file has been added in Dec 2018 and was backported to the documentation of NC13:
    nextcloud/documentation@c5fa1b6#diff-48dc187eeb03371b5ad6886b33043bf060884809c1d51a3568c5d29e40e3bf13

    https://docs.nextcloud.com/server/13/admin_manual/configuration_server/caching_configuration.html#id1

    Additionally the notice about appending --define apc.enable_cli=1 to the cron job call was added in June 2020 and backported to the documentation of NC17:
    nextcloud/documentation@38a0a33#diff-48dc187eeb03371b5ad6886b33043bf060884809c1d51a3568c5d29e40e3bf13

    https://docs.nextcloud.com/server/17/admin_manual/configuration_server/caching_configuration.html#id1

  11. andrewheeler82 commented on Jul 4, 2021

    @andrewheeler82

    I look through the documentation at regular intervals. Maybe I missed the apc.enable_cli = 1 change. But really now within a smaller release. Activate something like that and the user looks like a dork.

  12. hardingt commented on Jul 5, 2021

    @hardingt

    Also got bit by this one after upgrading from 20.0.2 to 20.0.3. Adding apc.enable_cli=1 to /etc/php/8.0/mods-available/apcu.ini worked for me as well.

  13. zaku903 commented on Jul 8, 2021

    @zaku903

    Got the same issue after upgraded to 21.0.3 days ago, just solved by increase apc.shm_size in php setting to 64M from default 32M. By adding apc.enable_cli=1 only not work for me.

  14. userofgithub023897 commented on Jul 11, 2021

    @userofgithub023897

    @zaku903 Thank you very much!!!
    This fixed it!
    Cron and occ work fine again.

  15. 31 remaining items

  16. matzl commented on Dec 30, 2021

    @matzl

    Thanks for the help!
    By the way: Are we supposed to read the whole documentation for every update? And maybe I'm too old for this, but I find it quite annoying that I need to update every 4 months 😢 (including all the problems that come with it, i.e. it just took me two days because I broke my database because of a required database update, needed to update and adjust several things and so on).
    I hope this agile nightly-built banana product mentality from nowadays changes back towards a "release one product a year that actually works" mentality. It would save millions of people billions of hours of their life. I feel like I spend 20% of my work and leisure time updating and then fixing software again...

  17. thepate94227 commented on Feb 17, 2022

    @thepate94227

    As a workaround you can use the parameter --define apc.enable_cli=1 to tell PHP to run cli commands with APCu enabled.

    Example:

    sudo -u www-data php --define apc.enable_cli=1  /var/www/nextcloud/occ  maintenance:repair
    

    Also, adding --define apc.enable_cli=1 to the according crontab line, the cronjob will get executed again.

    I tried your command, but i still get the error :

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

    Do someone know why? In my /var/www/nextcloud/config/config.php file there is the line "'memcache.local' => '\OC\Memcache\APCu',"

    And how can i add the --define apc.enable_cli=1 to the according crontab line?

    My currently version is 22.2.5, but with 22.2.4 i also had this problem. Before this version, i didn't have any errors.

  18. AndyXheli commented on Feb 17, 2022

    @AndyXheli
    Contributor

    @thepate94227

    Do you have this apc.enable_cli=1 added to you apcu.ini file ?

    Should be located in /etc/php/8.0/mods-available/ or /etc/php/7.4/mods-available/

    Its recommended to have that for mem chacing makes nc running better.

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

  19. thepate94227 commented on Feb 17, 2022

    @thepate94227

    @AndyXheli thank you for your quick reply!
    In this file you mentioned (/etc/php/7.4/mods-available/apcu.ini) there is only one line:
    extension=apcu.so

    Is this correct?
    I just added your line (apc.enable_cli=1).
    Thank you! Now the command "sudo -u www-data php /var/www/nextcloud/occ db:add-missing-indices" worked!
    EDIT: Now my cron seems to work, too.

  20. AndyXheli commented on Feb 17, 2022

    @AndyXheli
    Contributor

    @thepate94227 You're very welcome!

    1. please add apc.enable_cli=1 under extension=apcu.so
    2. sudo service apache2 restart
    3. Should be all good
    4. Then to test do cd /var/www/nextcloud
    5. once your into the dir then do a sudo -u www-data php occ and see if it runs with no errors
  21. thepate94227 commented on Feb 17, 2022

    @thepate94227

    @AndyXheli thanks again for your help! Now everything works! 👍

  22. AndyXheli commented on Feb 17, 2022

    @AndyXheli
    Contributor

    You're Welcome! Happy to help

  23. mrtumnus commented on Apr 13, 2022

    @mrtumnus

    Helps to actually read. I spent way too much time figuring out that apc.enable.cli=1 is not the same as apc.enable_cli=1. Thanks @AndyXheli

  24. awestin1 commented on Jun 24, 2022

    @awestin1

    For anyone who tried all these fixes but still had it fail, I was able to fix it by installing php-redis . Some other thread seemed to indicate apcu was being phased out, so I tried: sudo apt install php-redis . After that, all worked!

  25. gjanos89 commented on Aug 6, 2022

    @gjanos89

    Hi Everyone,
    I have tried with the same issue all of the above. Added the apc.enable_cli=1 basically in every php.ini and apcu.ini, apcu_bc.ini that I could find. Still nothing...
    Then I realised the issue on my instance --> I have php version 7.4, 8.0 and 8.1 installed, so I had to specify in the OCC commands and with that in my crontab setup which version to use. So instead of ....php occ...., now I have ....php7.4 occ....
    (note: it was originally installed years ago, so I had to check under /etc/php/ all 3 versions to see which one contained the apache2 folder to figure out for me it was 7.4)

    OLD:
    */5 * * * * php -f /var/www/html/nextcloud/cron.php
    NEW:
    */5 * * * * php7.4 -f /var/www/html/nextcloud/cron.php

    Also running OCC command example:
    cd /var/www/html/nextcloud/
    (note: check your path, maybe yours is without the /html)

    sudo -u www-data php occ
    runs to error
    sudo -u www-data php7.4 occ
    executes

    I hope it helps someone...

  26. Sieboldianus commented on Aug 6, 2022

    @Sieboldianus

    My best advice: Migrate Nextcloud to the official Docker Image and configure unattended updates. A blessing, not having to manage dependencies anymore..

  27. chiuyau commented on Aug 28, 2022

    @chiuyau

    The issue occured during update from 20.0.12 to 21.0.4

    For me, the problem was that I edited the wrong php.ini.

    I edited

    /etc/php/7.3/apache2/php.ini
    

    But I should have edited

    /etc/php/7.3/cli/php.ini
    

    In this file, I needed to enable the extensions:

    extension=redis.so
    extension=igbinary.so
    

    Then the upgrade worked.

    This is helpful!

  28. Reiikz commented on Feb 14, 2023

    @Reiikz

    apc.enable_cli = 1

    thanks a bunch!
    My cron job wasn't running and now is :3

  29. brunodegoyrans commented on Apr 30, 2023

    @brunodegoyrans

    Using a Synology DS too and found a possible solution for @snowflakes: Add a "user_settings.ini" in "/usr/local/etc/php74/cli/conf.d" with the following content: "extension = apcu.so [apc] apc.shm_size = 64M apc.enable_cli = 1" Works fine for me. Found this solution in the synology forum (https://www.synology-forum.de/threads/nextcloudhub-21-0-1-und-cron.114219/page-2). Best regards

    Using also a synology NAS but with PHP8.0. Add a new nextcloud.ini in usr/local/etc/php80/cli/conf.d did NOT work for me, even after a restart. I had to add extension = apcu.so into the already existing /usr/local/etc/php80/cli/conf.d.extension.ini

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmapbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions