To clear a Nextcloud PHP memory-limit warning, set memory_limit to at least 512M in the PHP configuration used by the web server, then restart or reload the relevant PHP service. Nextcloud's current stable Administration Manual recommends at least 512 MB for this PHP setting. The most common reason a warning remains after editing a file is that the web server is using a different PHP configuration from the command-line PHP installation.
Choose the procedure that matches your deployment: Apache with mod_php, Apache or Nginx with PHP-FPM, a container, or a managed Nextcloud package. Do not edit a host's random php.ini and assume every deployment uses it. Verify the result from Nextcloud's Admin Overview page, which reflects the web application configuration.
What does the warning mean?
PHP's memory_limit is the maximum memory a single PHP script may allocate. It is not the total RAM reserved for Nextcloud, and it does not increase the physical memory available to the server. Nextcloud's manual says to configure at least 512 MB for this directive. Separately, the system requirements explain that actual server memory needs vary with users, apps, files, and activity; they recommend at least 512 MB of RAM per PHP process, with 128 MB as a minimum.
Raising the PHP limit can resolve a configuration warning and allow memory-intensive requests more room. It cannot add RAM to an undersized host, repair a memory leak, or guarantee that every app will complete successfully. If the server is already under memory pressure, a higher per-request ceiling may increase the risk that concurrent PHP workers exhaust system RAM.
Which PHP configuration should you edit?
First identify how PHP runs Nextcloud. A terminal check such as php --ini reports the command-line (CLI) configuration. Nextcloud's web requests may use a separate Apache module or PHP-FPM service with another php.ini or pool override. Nextcloud specifically notes that web and CLI PHP may use different configuration files.
Typical locations on Debian-derived systems include /etc/php/8.x/apache2/php.ini for Apache's PHP module and /etc/php/8.x/fpm/php.ini for PHP-FPM. The actual PHP version and directory names vary. Other distributions commonly use different paths, such as a shared /etc/php.ini. Treat these as examples only; use your package manager, service configuration, and PHP runtime to locate the active file.
To inspect the CLI configuration, run:
php --ini
php -i | grep -i '^memory_limit'
These commands are useful for scheduled jobs that invoke PHP from the command line, but they do not prove that the browser-facing Nextcloud process uses the same value. Avoid leaving a public phpinfo() page on the server: it can disclose paths, modules, and runtime details.
How do you set the limit for Apache or PHP-FPM?
Back up the active configuration file before changing it. In the correct php.ini, find the existing memory_limit line and set it to 512M or a higher value selected for your workload:
memory_limit = 512M
Use one active setting rather than adding duplicate lines at the end of several files. A PHP-FPM pool can also define values for its workers, so check the pool configuration if the value in php.ini does not take effect. Some PHP deployments support a per-directory .user.ini; whether that is active depends on the server configuration and should be confirmed with the administrator.
Apache using mod_php
Edit the php.ini used by Apache, save it, then restart Apache so the module reloads its settings. Service names vary. On Debian or Ubuntu the service is commonly apache2; on RHEL-family systems it is commonly httpd. Use the service name for your operating system and maintenance procedures.
sudo systemctl restart apache2
Replace apache2 if your distribution uses a different unit name. If Nextcloud is served through PHP-FPM instead of mod_php, restarting Apache alone will not reload the PHP workers.
Apache or Nginx using PHP-FPM
Edit the PHP-FPM configuration actually used by the site. After saving the change, restart or reload the matching PHP-FPM service. Its unit may include the PHP version, for example php8.3-fpm, or use another vendor-specific name.
sudo systemctl restart php8.3-fpm
Use the correct service name for your installed PHP version. Nginx passes PHP requests to FPM, so changing PHP settings usually requires applying the change to FPM; restarting Nginx alone does not reload PHP's memory limit. If your PHP-FPM pool configuration overrides memory_limit, adjust the pool setting or remove the override, then restart the pool.
What if Nextcloud runs in Docker, AIO, Snap, or another package?
Use the configuration mechanism for that installation method. Editing the host's PHP files usually does not change the PHP runtime inside a container or an isolated package. The official Nextcloud Docker image documents the PHP_MEMORY_LIMIT environment variable, with a default of 512M in the current image documentation. Set it in the Compose file or container configuration, then recreate or restart the application container according to the deployment's procedure.
environment:
PHP_MEMORY_LIMIT: 512M
Do not copy that setting to every installation type. The Nextcloud manual says turnkey environments such as AIO, Snap, NCP, and Community Docker have preconfigured PHP and directs administrators to the package-specific instructions for customization. For those setups, use the supported interface or documentation for that package. Persistent volume mounts and generated configuration can also override a one-time manual edit.
How can you confirm the warning is fixed?
- Apply the change to the web-facing PHP configuration and restart or reload the relevant web/PHP service.
- Sign in to Nextcloud as an administrator and open Settings > Administration > Overview.
- Refresh the page and review the configuration warnings. Confirm that the PHP memory-limit warning has disappeared.
- Run a representative operation that previously triggered the warning, such as the affected app task, and review the Nextcloud and PHP logs for memory exhaustion messages.
If you also run Nextcloud background jobs through system cron, check the CLI PHP configuration separately. The web-facing warning can be cleared while CLI jobs still use a lower limit. Confirm the CLI value with php --ini and php -i for the same PHP binary used by the cron command.
When should you raise the value above 512M?
Only raise it when the warning is gone but a documented workload still reaches the PHP limit, or when an app's supported guidance calls for more. Check the actual server memory, PHP-FPM worker count, database memory, and other services first. Since PHP applies the limit per script, several busy workers can use substantial memory at the same time. Set a measured limit that fits the host's memory budget instead of using -1, which PHP documents as having no memory limit.
If the warning is gone but the server still slows down or processes are killed, inspect system memory and swap use, PHP-FPM logs, and Nextcloud logs. Consider whether a specific app or request is consuming excessive memory. A memory cache such as APCu or Redis addresses caching and performance concerns; it is not a replacement for setting the PHP memory_limit. Change one factor at a time so you can identify whether the result improved.
Quick checks by symptom
- The warning stays after editing php.ini: check whether you edited the CLI file instead of Apache/FPM's file, or whether a pool setting overrides it.
- The warning clears but a cron task still fails: check the CLI PHP binary and its separate configuration.
- The web server returns an error after restart: inspect the web server or PHP-FPM service status and logs, and restore the backup if the configuration change caused a startup failure.
- The warning clears but the host runs out of RAM: lower concurrency, add memory, or identify the process using memory before increasing the PHP limit further.
- You use a container or turnkey package: change the package's supported PHP setting rather than the host's php.ini.
Official references