# Problems with running 2 instances with local APCu

**URL:** <https://help.nextcloud.com/t/problems-with-running-2-instances-with-local-apcu/160817>\
**Category:** ℹ️ Support\
**Tags:** apcu, nc26\
**Created:** [April 24, 2023, 8:15am UTC](https://help.nextcloud.com/t/problems-with-running-2-instances-with-local-apcu/160817 "2023-04-24T08:15:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ingmar3](https://help.nextcloud.com/letter_avatar/ingmar3/32/5_5575768a8748004e209b776fc1b2916d.png) [@ingmar3](https://help.nextcloud.com/u/ingmar3)\
**Post date:** [April 24, 2023, 8:15am UTC](https://help.nextcloud.com/t/problems-with-running-2-instances-with-local-apcu/160817/1 "2023-04-24T08:15:10Z")

</div>

Nextcloud version: 26.0.1  
Operating system and version: Ubuntu 20.04.6 LTS  
Apache or nginx version: Apache 2.4.41  
PHP version: 8.1

Using an LAMP-server with 2 instances of Nextcloud (no docker, just 2 domains), I faced an error 500 after updating both instances to 26.0 (and 26.0.1 doesn’t change anything). I’m using

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

```

I debugged the problem and realized, that the ClassLoader is getting the wrong file path and then PHP tries to include a file located in the path of the other instance. In detail the instance who first wins adds it’s path to apcu and apcu\_fetch always returns that path, even to the other instance. For one instance it’s fine, the other one fails due to open\_basedir restriction.

I fixed it by changing the APCu-Prefix for one of the two instances in ./lib/base.php:601.

I didn’t find a way to change the prefix in config.  
So is this a bug or am I doing something wrong? Do I need to configure APCu different?

---

<div class="post-metadata">

**Author:** ![tflidd](https://help.nextcloud.com/letter_avatar/tflidd/32/5_5575768a8748004e209b776fc1b2916d.png) [@tflidd](https://help.nextcloud.com/u/tflidd)\
**Post date:** [April 24, 2023, 8:18am UTC](https://help.nextcloud.com/t/problems-with-running-2-instances-with-local-apcu/160817/2 "2023-04-24T08:18:32Z")

</div>

They have a patch for this problem already:

> <https://github.com/nextcloud/server/pull/37872>
>
> backport of #37853

and the original bug report:

> <https://github.com/nextcloud/server/issues/37610>
>
> \### ⚠️ This issue respects the following points: ⚠️
> 
> \- \[X\] This is a \*\*bug\*\*, …not a question or a configuration/webserver/proxy issue.
> \- \[X\] This issue is \*\*not\*\* already reported on Github \_(I've searched it)\_.
> \- \[X\] Nextcloud Server \*\*is\*\* up to date. See \[Maintenance and Release Schedule\](https://github.com/nextcloud/server/wiki/Maintenance-and-Release-Schedule) for supported versions.
> \- \[X\] Nextcloud Server \*\*is\*\* running on 64bit capable CPU, PHP and OS.
> \- \[X\] I agree to follow Nextcloud's \[Code of Conduct\](https://nextcloud.com/contribute/code-of-conduct/).
> 
> \### Bug description
> 
> I updated from nextcloud 25 to 26, and I have 2 instances of nextcloud running on the same server with differnet domains, databases and data folders. The open\_basedir and permission structure does not allow them to see/read each other.
> 
> Nevertheless, after upgrading I could see errors in nextcloud.log that one instance tries to access files of the oter, and after restarting php-fpm and accessing the second instance, it tried to access files of the other as well - only the first instance I opened kept working, the second showed a HTTP500 and the errors in log with file access.
> 
> I have \`"memcache.local": "\\\\OC\\\\Memcache\\\\Redis",\` enabled with a Redis configuration using a separate \`dbindex\` for each of the instances.
> 
> Only after disabling \`apcu\` it worked. Even if the memcache config should use Redis with its own database.
> 
> \### Steps to reproduce
> 
> 1. Have 2 instances on the same system
> 2. Upgrade from NC 25 to NC 26
> 3. Enable apcu
> 
> 
> \### Expected behavior
> 
> Two instances should not interfere with each other, even with apcu they should use an apcuPrefix or similar. I have no idea if this is related to the upgrade or anything else - but that's the only action I executed.
> 
> \### Installation method
> 
> Community Manual installation with Archive
> 
> \### Nextcloud Server version
> 
> 26
> 
> \### Operating system
> 
> Debian/Ubuntu
> 
> \### PHP engine version
> 
> PHP 8.1
> 
> \### Web server
> 
> Nginx
> 
> \### Database engine version
> 
> MySQL
> 
> \### Is this bug present after an update or on a fresh install?
> 
> Updated to a major version (ex. 22.2.3 to 23.0.1)
> \--\> Also tested with a FRESH install, same behavior after adding memcached+redis config with active apcu module
> 
> \### Are you using the Nextcloud Server Encryption module?
> 
> None
> 
> \### What user-backends are you using?
> 
> \- \[X\] Default user-backend \_(database)\_
> \- \[\] LDAP/ Active Directory
> \- \[\] SSO - SAML
> \- \[\] Other
> 
> \### Configuration report
> 
> \`\`\`shell
> {
> "system": {
> "instanceid": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "passwordsalt": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "secret": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "simpleSignUpLink.shown": false,
> "trusted\_domains": \[
> "files.example.com"
> \],
> "datadirectory": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "overwrite.cli.url": "https:\\/\\/files.example.com",
> "dbtype": "mysql",
> "version": "26.0.0.11",
> "dbname": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "dbhost": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "dbport": "",
> "dbtableprefix": "oc\_",
> "mysql.utf8mb4": true,
> "dbuser": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "dbpassword": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "installed": true,
> "mail\_from\_address": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "mail\_smtpmode": "smtp",
> "mail\_smtpauthtype": "LOGIN",
> "mail\_domain": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "maintenance": false,
> "theme": "",
> "memcache.local": "\\\\OC\\\\Memcache\\\\Redis",
> "redis": {
> "host": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "dbindex": 2,
> "port": 6379
> },
> "updater.release.channel": "stable",
> "mail\_smtphost": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "loglevel": 2,
> "default\_phone\_region": "AT",
> "updater.secret": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*"
> }
> }
> \`\`\`
> 
> 
> \### List of activated Apps
> 
> \`\`\`shell
> Enabled:
> - activity: 2.18.0
> - circles: 26.0.0
> - cloud\_federation\_api: 1.9.0
> - comments: 1.16.0
> - contactsinteraction: 1.7.0
> - dav: 1.25.0
> - federatedfilesharing: 1.16.0
> - federation: 1.16.0
> - files: 1.21.1
> - files\_pdfviewer: 2.7.0
> - files\_rightclick: 1.5.0
> - files\_sharing: 1.18.0
> - files\_trashbin: 1.16.0
> - files\_versions: 1.19.1
> - firstrunwizard: 2.15.0
> - logreader: 2.11.0
> - lookup\_server\_connector: 1.14.0
> - nextcloud\_announcements: 1.15.0
> - notifications: 2.14.0
> - oauth2: 1.14.0
> - password\_policy: 1.16.0
> - photos: 2.2.0
> - privacy: 1.10.0
> - provisioning\_api: 1.16.0
> - recommendations: 1.5.0
> - related\_resources: 1.1.0-alpha1
> - serverinfo: 1.16.0
> - settings: 1.8.0
> - sharebymail: 1.16.0
> - support: 1.9.0
> - survey\_client: 1.14.0
> - systemtags: 1.16.0
> - text: 3.7.2
> - theming: 2.1.1
> - twofactor\_backupcodes: 1.15.0
> - updatenotification: 1.16.0
> - user\_status: 1.6.0
> - viewer: 1.10.0
> - weather\_status: 1.6.0
> - workflowengine: 2.8.0
> Disabled:
> - admin\_audit: 1.16.0
> - bruteforcesettings: 2.6.0
> - dashboard: 7.6.0 (installed 7.0.0)
> - encryption: 2.14.0
> - files\_external: 1.18.0
> - suspicious\_login: 4.4.0
> - twofactor\_totp: 8.0.0-alpha.0
> - user\_ldap: 1.16.0
> \`\`\`
> 
> 
> \### Nextcloud Signing status
> 
> \`\`\`shell
> No errors have been found.
> \`\`\`
> 
> 
> \### Nextcloud Logs
> Tested with a FRESH install. It worked, until I added the memcached config with Redis
> 
> \`\`\`
> 'memcache.local' =\> '\\\\OC\\\\Memcache\\\\Redis',
> 'redis' =\>
> array (
> 'host' =\> 'localhost',
> 'dbindex' =\> 2,
> 'port' =\> 6379,
> ),
> 
> \`\`\`
> 
> \`\`\`
> {"reqId":"dqf7hKO1FtScvE769qZz","level":3,"time":"2023-04-06T08:20:11+00:00","remoteAddr":"127.0.0.1","user":"webapp2","app":"PHP","method":"GET","url":"/apps/files/?dir=/&fileid=2","message":"include(): open\_basedir restriction in effect. File(/var/www/webapp1/apps/firstrunwizard/lib//AppInfo/Application.php) is not within the allowed path(s): /var/www/webapp2/:/usr/lib/php/:/var/lib/php/sessions/:/usr/share/GeoIP/:/tmp/:/opt/nextcloud-data-webapp2) at /var/www/webapp2/lib/composer/composer/ClassLoader.php#578","userAgent":"Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36","version":"26.0.0.11","data":{"app":"PHP"}}
> \`\`\`
> 
> \### Additional info
> 
> \_No response\_

---

<div class="post-metadata">

**Author:** ![ingmar3](https://help.nextcloud.com/letter_avatar/ingmar3/32/5_5575768a8748004e209b776fc1b2916d.png) [@ingmar3](https://help.nextcloud.com/u/ingmar3)\
**Post date:** [April 24, 2023, 8:23am UTC](https://help.nextcloud.com/t/problems-with-running-2-instances-with-local-apcu/160817/3 "2023-04-24T08:23:05Z")

</div>

Thanks and sorry for reopening that, didn’t find that. So I wait for 26.0.2.

---

<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, 12:21pm UTC](https://help.nextcloud.com/t/problems-with-running-2-instances-with-local-apcu/160817/4 "2024-12-14T12:21:18Z")

</div>


