Config.php is not recognized correctly

I would first of all like to seek help urgently.
My NC is acting up, the NC itself is accessible but it does not recognize config.php correctly.
For example, even if I set maintenance to true in config.php, it does not enter maintenance mode. And it is the same with the occ command.

I am using redis for file locking and am being asked to authenticate redis. Of course the password for redis is not wrong. I have removed redis from config.php and it still asks for redis authentication.

It is as if a different config.php exists and NC is reading it. Of course there is only one config.php file in the config directory.

My NC is able to read files but not write them. I urgently need to be able to write files first. Is there a solution?

Also, the OCC command is unusual.
For example, there is no OCC files:scan.

Added:
I then discovered an anomaly. For some reason, “appdata_ABCDEFG” in the data directory was created in the data directory. ABCDEFG is the instanceid. That is different from the instanceid written within config.php. And when I change the permissions on that self-created “appdata_ABCDEFG” and make it unreadable, NC causes an internal error.


Nextcloud 23.0.5, CentOS 7.9, php 8.0.20, redis 7.0.2

Yes, but it’s explained here how to work with it:

https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/occ_command.html

I can’t get NC to go into maintenance mode, but when I turn maintenance:mode on, files:scan can run. But files:scan had no effect.

It seems that the NC system is still looking at the newly created “appdata_ABCDEFG”. I changed the instanceid value in config.php to ABCDEFG, but still it is not working as instructed in config.php. I can’t even change NC to maintenance mode.

This may be the biggest mystery of all.
If I edit config.php via ssh or FTP, it is not recognized. However, I can only edit it from the NC Web UI.
I edit config.php via ssh. Then I change the NC configuration via web. Then the changes made via SSH are gone and only the items that can be configured via web are recorded in the file.
So, for example, I can never configure the memory cache.

I am keeping my abnormal state and proceeding to recovery.
I have learned, for example, that if I set up a basic configuration item, like email, config.php is set to just that.
As a workaround, I edit config.php via ssh and restart php-fpm when I am done editing. Now NC will recognize the edited config.php via ssh.

I can’t seem to edit the profile either. How can this data handling anomaly be repaired?

Current Status:
I was able to recover to the point where I could perform general operations. Remaining/occurring problems.

  • That php-fpm must be restarted for config.php configuration items to function. If I set up NC to edit config.php, it erases all but the relevant settings.
  • Cannot enter maintenance mode. occ maintenance:mode outputs “Maintenance mode is currently enabled”.
  • Unable to edit profiles of admin users.
  • Internal error when trying to open external storage settings. → Run truncate oc_storages_credentials in MySQL.
  • truncate oc_filecache" was also effective.
  • Destruction of shared status among users.
  • The shared directory had turned into a single fake PDF file or document file or picture file… Of course it cannot be opened.
  • Shared files and folders are displayed as “Pending” in the file list.

Looks like your installation is broken heavily.

You can try to install a ready made Nextcloud image and compare with your installation what is wrong.

I have updated to NC 23.0.6 and there is no change at all in the behavior of the settings and maintenance mode from the web UI.

But it really is the biggest mystery of all.
Is there a file somewhere other than /NEXTCLOUD/config/config.php that holds it?

Cause of the Problem

Sorry for the later information. The problem started with the update from NC23.0.5 to NC24.0.2.

I always update the source manually. When I first started using NC, I never had any success updating online. I installed the files reliably as usual. Then I ran occ ugrade and completed successfully. I then accessed the web and it was an internal NC error. I am an internal error message as soon as I type in the URL.

In my experience with my NC, I was able to overcome the internal errors by excluding the apps one by one, but that did not work this time. I could not resolve the internal error by reducing config.php to just the basic items. I was able to get config.php changes to reflect in nextcloud without restarting php-fpm before I did this update action.

I quickly restored from backup (including MySQL). At this point I could no longer enter maintenance mode and I knew something was wrong with config.php. *There are no warnings such as “downgrade not allowed.”

I then noticed that a new “appdata_ABCDEFG” was created in the data directory.

How to Repair

If I go on like this I will never be able to update to NC24. even NC25? In other words I will most likely have NC23 as my final version.

That may be the reconstruction of the NC, but the biggest factor preventing that is the “user’s shared settings status”. They share each other so intricately that it is too difficult a request to get them to rebuild it.

What should I do to find the root of the problem?

I didn’t mention the logs so I will describe them.

When I tried to upgrade from NC23.0.5 to NC24.0.2, only the start of that upgrade was recorded. After that, I only have a record of what happened after I reverted back to NC23. And I got a lot of errors like the following.

{"reqId":"t2cYXuUUMWG9BGb7QgMf","level":4,"time":"June 23, 2022 00:54:54","remoteAddr":"REMOTE-IP","user":"--","app":"files_trashbin","method":"PUT","url":"/index.php/apps/user_status/heartbeat","message":"Error during app service registration: Call to undefined method OCP\\AppFramework\\Bootstrap\\IRegistrationContext@anonymous::registerUserMigrator()","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0","version":"23.0.5.1","exception":{"Exception":"Error","Message":"Call to undefined method OCP\\AppFramework\\Bootstrap\\IRegistrationContext@anonymous::registerUserMigrator()","Code":0,"Trace":[{"file":"/NEXTCLOUD/lib/private/AppFramework/Bootstrap/Coordinator.php","line":129,"function":"register","class":"OCA\\Files_Trashbin\\AppInfo\\Application","type":"->"},{"file":"/NEXTCLOUD/lib/private/AppFramework/Bootstrap/Coordinator.php","line":85,"function":"registerApps","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->"},{"file":"/NEXTCLOUD/lib/base.php","line":640,"function":"runInitialRegistration","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->"},{"file":"/NEXTCLOUD/lib/base.php","line":1089,"function":"init","class":"OC","type":"::"},{"file":"/NEXTCLOUD/index.php","line":34,"args":["/NEXTCLOUD/lib/base.php"],"function":"require_once"}],"File":"/NEXTCLOUD/apps/files_trashbin/lib/AppInfo/Application.php","Line":57,"CustomMessage":"Error during app service registration: Call to undefined method OCP\\AppFramework\\Bootstrap\\IRegistrationContext@anonymous::registerUserMigrator()"}}

{"reqId":"ad9uqWSfnbexw7Xwvd5X","level":4,"time":"June 23, 2022 01:00:27","remoteAddr":"REMOTE-IP","user":"--","app":"dav","method":"LOCK","url":"/remote.php/webdav/FILENAME).odt","message":"Error during app service registration: Call to undefined method OCP\\AppFramework\\Bootstrap\\IRegistrationContext@anonymous::registerUserMigrator()","userAgent":"Microsoft-WebDAV-MiniRedir/10.0.19044","version":"23.0.5.1","exception":{"Exception":"Error","Message":"Call to undefined method OCP\\AppFramework\\Bootstrap\\IRegistrationContext@anonymous::registerUserMigrator()","Code":0,"Trace":[{"file":"/NEXTCLOUD/lib/private/AppFramework/Bootstrap/Coordinator.php","line":129,"function":"register","class":"OCA\\DAV\\AppInfo\\Application","type":"->"},{"file":"/NEXTCLOUD/lib/private/AppFramework/Bootstrap/Coordinator.php","line":85,"function":"registerApps","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->"},{"file":"/NEXTCLOUD/lib/base.php","line":640,"function":"runInitialRegistration","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->"},{"file":"/NEXTCLOUD/lib/base.php","line":1089,"function":"init","class":"OC","type":"::"},{"file":"/NEXTCLOUD/remote.php","line":114,"args":["/NEXTCLOUD/lib/base.php"],"function":"require_once"}],"File":"/NEXTCLOUD/apps/dav/lib/AppInfo/Application.php","Line":171,"CustomMessage":"Error during app service registration: Call to undefined method OCP\\AppFramework\\Bootstrap\\IRegistrationContext@anonymous::registerUserMigrator()"}}

{"reqId":"bh6umlx1wEZQgjVKML46","level":4,"time":"June 23, 2022 01:10:25","remoteAddr":"REMOTE-IP","user":"--","app":"settings","method":"PROPFIND","url":"/remote.php/webdav","message":"Error during app service registration: Call to undefined method OCP\\AppFramework\\Bootstrap\\IRegistrationContext@anonymous::registerUserMigrator()","userAgent":"Microsoft-WebDAV-MiniRedir/10.0.19044","version":"23.0.5.1","exception":{"Exception":"Error","Message":"Call to undefined method OCP\\AppFramework\\Bootstrap\\IRegistrationContext@anonymous::registerUserMigrator()","Code":0,"Trace":[{"file":"/NEXTCLOUD/lib/private/AppFramework/Bootstrap/Coordinator.php","line":129,"function":"register","class":"OCA\\Settings\\AppInfo\\Application","type":"->"},{"file":"/NEXTCLOUD/lib/private/AppFramework/Bootstrap/Coordinator.php","line":85,"function":"registerApps","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->"},{"file":"/NEXTCLOUD/lib/base.php","line":640,"function":"runInitialRegistration","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->"},{"file":"/NEXTCLOUD/lib/base.php","line":1089,"function":"init","class":"OC","type":"::"},{"file":"/NEXTCLOUD/remote.php","line":114,"args":["/NEXTCLOUD/lib/base.php"],"function":"require_once"}],"File":"/NEXTCLOUD/apps/settings/lib/AppInfo/Application.php","Line":136,"CustomMessage":"Error during app service registration: Call to undefined method OCP\\AppFramework\\Bootstrap\\IRegistrationContext@anonymous::registerUserMigrator()"}}

{"reqId":"orno0ULK3xYzXjsFpyUN","level":4,"time":"June 23, 2022 01:10:26","remoteAddr":"118.236.210.241","user":"--","app":"files_trashbin","method":"PROPFIND","url":"/remote.php/webdav/NC-USERNAME/desktop.ini","message":"Error during app service registration: Call to undefined method OCP\\AppFramework\\Bootstrap\\IRegistrationContext@anonymous::registerUserMigrator()","userAgent":"Microsoft-WebDAV-MiniRedir/10.0.19044","version":"23.0.5.1","exception":{"Exception":"Error","Message":"Call to undefined method OCP\\AppFramework\\Bootstrap\\IRegistrationContext@anonymous::registerUserMigrator()","Code":0,"Trace":[{"file":"/NEXTCLOUD/lib/private/AppFramework/Bootstrap/Coordinator.php","line":129,"function":"register","class":"OCA\\Files_Trashbin\\AppInfo\\Application","type":"->"},{"file":"/NEXTCLOUD/lib/private/AppFramework/Bootstrap/Coordinator.php","line":85,"function":"registerApps","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->"},{"file":"/NEXTCLOUD/lib/base.php","line":640,"function":"runInitialRegistration","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->"},{"file":"/NEXTCLOUD/lib/base.php","line":1089,"function":"init","class":"OC","type":"::"},{"file":"/NEXTCLOUD/remote.php","line":114,"args":["/NEXTCLOUD/lib/base.php"],"function":"require_once"}],"File":"/NEXTCLOUD/apps/files_trashbin/lib/AppInfo/Application.php","Line":57,"CustomMessage":"Error during app service registration: Call to undefined method OCP\\AppFramework\\Bootstrap\\IRegistrationContext@anonymous::registerUserMigrator()"}}

{"reqId":"RAuKyrvUvMH95leA76p3","level":3,"time":"2022-06-22T17:59:30+00:00","remoteAddr":"REMOTE-IP2","user":"--","app":"PHP","method":"GET","url":"/index.php/login","message":"file_put_contents(/NEXTCLOUD/data/appdata_ABCDEFG/js/core/merged-template-prepend.js): Failed to open stream: No such file or directory at /NEXTCLOUD/lib/private/Files/Storage/Local.php#282","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.125 Safari/537.36","version":"23.0.6.1","exception":{"Exception":"Error","Message":"file_put_contents(/NEXTCLOUD/data/appdata_ABCDEFG/js/core/merged-template-prepend.js): Failed to open stream: No such file or directory at /NEXTCLOUD/lib/private/Files/Storage/Local.php#282","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/NEXTCLOUD/lib/private/Files/Storage/Local.php","line":282,"function":"file_put_contents"},{"file":"/NEXTCLOUD/lib/private/Files/Storage/Wrapper/Wrapper.php","line":258,"function":"file_put_contents","class":"OC\\Files\\Storage\\Local","type":"->"},{"file":"/NEXTCLOUD/lib/private/Files/Storage/Wrapper/Wrapper.php","line":258,"function":"file_put_contents","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->"},{"file":"/NEXTCLOUD/apps/files_accesscontrol/lib/StorageWrapper.php","line":183,"function":"file_put_contents","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->"},{"file":"/NEXTCLOUD/lib/private/Files/View.php","line":1169,"function":"file_put_contents","class":"OCA\\FilesAccessControl\\StorageWrapper","type":"->"},{"file":"/NEXTCLOUD/lib/private/Files/View.php","line":706,"function":"basicOperation","class":"OC\\Files\\View","type":"->"},{"file":"/NEXTCLOUD/lib/private/Files/Node/File.php","line":71,"function":"file_put_contents","class":"OC\\Files\\View","type":"->"},{"file":"/NEXTCLOUD/lib/private/Files/SimpleFS/SimpleFile.php","line":108,"function":"putContent","class":"OC\\Files\\Node\\File","type":"->"},{"file":"/NEXTCLOUD/lib/private/Template/JSCombiner.php","line":202,"function":"putContent","class":"OC\\Files\\SimpleFS\\SimpleFile","type":"->"},{"file":"/NEXTCLOUD/lib/private/Template/JSCombiner.php","line":105,"function":"cache","class":"OC\\Template\\JSCombiner","type":"->"},{"file":"/NEXTCLOUD/lib/private/Template/JSResourceLocator.php","line":115,"function":"process","class":"OC\\Template\\JSCombiner","type":"->"},{"file":"/NEXTCLOUD/lib/private/Template/JSResourceLocator.php","line":71,"function":"cacheAndAppendCombineJsonIfExist","class":"OC\\Template\\JSResourceLocator","type":"->"},{"file":"/NEXTCLOUD/lib/private/Template/ResourceLocator.php","line":78,"function":"doFind","class":"OC\\Template\\JSResourceLocator","type":"->"},{"file":"/NEXTCLOUD/lib/private/TemplateLayout.php","line":388,"function":"find","class":"OC\\Template\\ResourceLocator","type":"->"},{"file":"/NEXTCLOUD/lib/private/TemplateLayout.php","line":216,"function":"findJavascriptFiles","class":"OC\\TemplateLayout","type":"::"},{"file":"/NEXTCLOUD/lib/private/legacy/OC_Template.php","line":182,"function":"__construct","class":"OC\\TemplateLayout","type":"->"},{"file":"/NEXTCLOUD/lib/public/AppFramework/Http/TemplateResponse.php","line":204,"function":"fetchPage","class":"OC_Template","type":"->"},{"file":"/NEXTCLOUD/lib/private/AppFramework/Http/Dispatcher.php","line":171,"function":"render","class":"OCP\\AppFramework\\Http\\TemplateResponse","type":"->"},{"file":"/NEXTCLOUD/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/NEXTCLOUD/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/NEXTCLOUD/lib/base.php","line":1008,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/NEXTCLOUD/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/NEXTCLOUD/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"}}

Could it be an error related to WebDAV? When I reverted back to NC23 I could not get it to show external storage in the settings. *I was then able to resolve the issue by adjusting the MySQL tables.

NC won’t load config.plist without restarting PHP-FPM. At least I want to solve this riddle.
I checked my.cnf in mariadb, nginx.conf in nginx and php.ini in php 8.0 and it has not changed before and no clear error. What else affects the reading of config.plist?

I have set up a new NC within the same server. The NCs are separated by subdomains. It is, of course, completely new NC. I have not inherited any of my previous NC environment (except nginx, php, mariadb(my.cnf), redis). DB file is also new.

The same problem of not loading config.php in the new NC, the config.php was overwritten in a strange way. I still have to restart PHP-FPM after editing config.php.

NC corruption broke PHP, nginx, MariaDB, Redis?

I have not figured out the cause, but I was able to eliminate the config.php recognition glitch.

I focused on each preference file and verified it. I finally figured out that the problem was in the opcache section of php.ini. I’m currently on PHP 8.0. I took the opcache section from my old PHP 7.4 php.ini and replaced it with the entire PHP 8.0 opcache section. Then I can activate the config.php changes by simply reloading NC in my web browser. Abnormal rewriting of config.php due to configuration changes at NC also does not occur. But there is an oddity. I have since reverted back to php(8.0).ini (no modifications). Then NC recognizes the change in config.php without any problem. I wonder why?
Apparently this “replacement” was important. Because before I replaced it, I had “adjusted the values.”

I had already done the opcache clear ( opcache_reset() ) before adjusting php.ini. And why did the NC update destroy php.ini (or opcache)?