### How to use GitHub
* Please use the 👍 [reaction](https://blog.github.com/2…016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to show that you are affected by the same issue.
* Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
* Subscribe to receive notifications on status change and new comments.
### Steps to reproduce
1. Upgrading to Nextcloud 21
2. Run ``php ./occ`` in Nextcloud root directory
3. ``./occ`` crashes
### Expected behaviour
Occ should work normally, for example printing available commands
### Actual behaviour
Occ crashes with the following error:
```
$ sudo -u http ./occ update
PHP Warning: Module “gd” is already loaded in Unknown on line 0
PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 20480 bytes) in /usr/share/webapps/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php on line 133
```
To be more precise, this also happens running php cli against other files of Nextcloud, for example ``index.php`` or ``console.php``.
Surprisingly Nextcloud is running fine through php-fpm and web server. It was even able to perform the upgrade to v21 just fine.
Another user commented on the [ArchLinux bug tracker:](https://bugs.archlinux.org/task/69726#comment197002)
> If it could help, I added a trace in /usr/share/webapps/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php on line 133, and I get in an infinite loop the following messages:
>
> Could not resolve OC\User\Manager!
> Could not resolve OC\Security\CSRF\CsrfTokenManager!
>
> As if it was unable to locate its lib/private/ folder.
> If I set memory_limit to -1, it fill completely memory and hit OOMkiller.
> (tried with both php7 and php8, with nextcloud-21.0.0-7)
Possibly not only related to ArchLinux setups. An other user reported the exact issue [here](https://help.nextcloud.com/t/nextcloud-consuming-all-memory-and-swap-and-crashing-server/108532), which was triggered on a Ubuntu installation.
### Server configuration
**Operating system:** Archlinux x64
**Web server:** Caddy 2
**Database:** Mysql
**PHP version:** 8.0.2
**Nextcloud version:** (see Nextcloud admin page) 21.0.0
**Updated from an older Nextcloud/ownCloud or fresh install:** Yes
**Where did you install Nextcloud from:** Package repository
**Signing status:**
<details>
<summary>Signing status</summary>
```
Unable to access for now
```
</details>
**List of activated apps:**
<details>
<summary>App list</summary>
```
accessibility/ drawio/ files_trashbin/ nextcloud_announcements/ settings/ twofactor_gateway/
activity/ encryption/ files_versions/ notes/ sharebymail/ updatenotification/
admin_audit/ extract/ files_videoplayer/ notifications/ spreed/ user_ldap/
apporder/ federatedfilesharing/ firstrunwizard/ oauth2/ support/ user_status/
calendar/ federation/ integration_discourse/ password_policy/ survey_client/ viewer/
cloud_federation_api/ files/ integration_github/ photos/ suspicious_login/ weather_status/
comments/ files_ebookreader/ integration_reddit/ polls/ systemtags/ workflowengine/
contacts/ files_external/ integration_twitter/ privacy/ tasks/
contactsinteraction/ files_pdfviewer/ keeweb/ provisioning_api/ text/
dashboard/ files_rightclick/ logreader/ recommendations/ theming/
dav/ files_sharing/ lookup_server_connector/ serverinfo/ twofactor_backupcodes/
```
</details>
**Nextcloud configuration:**
<details>
<summary>Config report</summary>
```
<?php
$CONFIG = array (
'instanceid' => '****',
'datadirectory' => '/var/lib/nextcloud/data',
'dbtype' => 'mysql',
'version' => '21.0.0.18',
'dbname' => 'nextcloud',
'dbhost' => 'mysql.pi',
'mysql.utf8mb4' => true,
'dbuser' => 'nextcloud',
'dbpassword' => '****',
'installed' => true,
'maintenance' => false,
'loglevel' => 0,
'cron_log' => true,
'maxZipInputSize' => 5145728000,
'allowZipDownload' => true,
'memcache.local' => '\\OC\\Memcache\\APCu',
'allow_local_remote_servers' => true,
'trusted_domains' =>
array (
0 => 'nextcloud.****.org',
),
'passwordsalt' => '***',
'secret' => '****',
'mail_domain' => '******.org',
'mail_smtpmode' => 'php',
'mail_from_address' => 'nextcloud',
'trashbin_retention_obligation' => 'auto',
'updatechecker' => false,
'app.mail.verify-tls-peer' => false,
'overwrite.cli.url' => 'https://nextcloud.***.org',
'default_phone_region' => 'DE',
);
```
</details>
**Are you using external storage, if yes which one:** None, had configured SFTP mount point
**Are you using encryption:** No
**Are you using an external user-backend, if yes which one:** No
### Client configuration
**Browser:** Latest Firefox
**Operating system:** NixOS
#### Nextcloud log (data/nextcloud.log)
<details>
Nothing exceptional here, also no error logs
<summary>Nextcloud log</summary>
```
[...]
{"reqId":"pti6pSFymOb7PvbzzzmM","level":0,"time":"2021-02-21T18:08:04+00:00","remoteAddr":"2****","user":"--","app":"files_sharing","method":"GET","url":"/cron.php","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0","version":"21.0.0.18"}
{"reqId":"pti6pSFymOb7PvbzzzmM","level":0,"time":"2021-02-21T18:08:04+00:00","remoteAddr":"*****","user":"--","app":"keeweb","method":"GET","url":"/cron.php","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0","version":"21.0.0.18"}
{"reqId":"pti6pSFymOb7PvbzzzmM","level":0,"time":"2021-02-21T18:08:04+00:00","remoteAddr":"*****","user":"--","app":"onlyoffice","method":"GET","url":"/cron.php","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0","version":"21.0.0.18"}
```
</details>