Nextcloud depends on PHP's memory_limit setting for web requests, background jobs, previews, upgrades, and occ maintenance tasks. Raising the limit is common when the administration overview warns about low PHP memory or when larger operations stop before the server itself is short on RAM.
The setting belongs to the active PHP runtime, not /var/www/nextcloud/config/config.php. PHP-FPM or the Apache PHP module handles browser traffic, while the CLI runtime handles occ and cron jobs; both layers need the intended value when the same instance uses web and command-line paths.
Nextcloud's current administration documentation says memory_limit should be at least 512 MB. Set a concrete value such as 1024M instead of relying on an unlimited or distro-default value that may differ between PHP runtimes, and replace 8.3 in /etc/php/8.3/…/conf.d paths with the active PHP version on the server.
$ php --ini Configuration File (php.ini) Path: "/etc/php/8.3/cli" Loaded Configuration File: "/etc/php/8.3/cli/php.ini" Scan for additional .ini files in: "/etc/php/8.3/cli/conf.d" Additional .ini files parsed: /etc/php/8.3/cli/conf.d/10-opcache.ini, ##### snipped #####
The CLI path controls occ and cron jobs. The web runtime is checked separately through a temporary web probe later.
$ php -r 'echo ini_get("memory_limit"), PHP_EOL;'
512M
$ sudoedit /etc/php/8.3/fpm/conf.d/90-nextcloud-memory-limit.ini
memory_limit = 1024M
This path matches PHP-FPM packages on Debian and Ubuntu. Apache module installs use the matching /etc/php/8.3/apache2/conf.d tree instead of /fpm.
$ sudoedit /etc/php/8.3/cli/conf.d/90-nextcloud-memory-limit.ini
memory_limit = 1024M
$ sudo php-fpm8.3 -t [29-Jun-2026 07:13:54] NOTICE: configuration file /etc/php/8.3/fpm/php-fpm.conf test is successful
$ sudo systemctl reload php8.3-fpm
If the service unit has a different version suffix, reload that unit instead. Apache module installs usually need an apache2 reload or restart rather than a PHP-FPM reload.
$ sudo tee /var/www/nextcloud/memory-limit-check.php > /dev/null <<'PHP'
<?php echo ini_get('memory_limit'), PHP_EOL;
PHP
Remove this file after checking the value. It exposes a PHP runtime setting through the public web path.
$ curl -sS https://cloud.example.com/memory-limit-check.php 1024M
A web response of 1024M confirms that the PHP runtime behind the site loaded the new FPM or web-server setting.
$ sudo rm /var/www/nextcloud/memory-limit-check.php
$ sudo -E -u www-data php -r 'echo ini_get("memory_limit"), PHP_EOL;'
1024M
On Debian and Ubuntu, www-data is the usual web-server user. Replace it with the account that owns the Nextcloud files on other platforms.
Related: How to run Nextcloud occ commands
$ sudo -E -u www-data php /var/www/nextcloud/occ setupchecks
The PHP memory-limit warning should no longer appear. Use the remaining red or yellow items as separate follow-up work instead of changing unrelated PHP settings.
Related: How to check Nextcloud administration overview warnings