Php memory limit cannot be changed

The Basics

  • Nextcloud Server version 31.04.1
  • Operating system and version 24.04.2
  • Web server and version Apache 2.4.58 with fpm
  • PHP version 8.3
  • Is this the first time you’ve seen this error? No
  • When did this problem seem to first start? Since I upgraded from 22.04 to 24.04 two weeks ago.
  • Installation method Bare Metal

Summary of the issue you are facing:

I have changed all the files suggested in a multitude of threads.

all php.ini files in /etc/php/8.3
.user.ini in nextcloud install directory.
restarted all services, rebooted, prayed. etc. . .

No matter what I do php complains about not enough memory. I have it set to 1024 in all places. every cli php command complains about the memory being below the 512mb recommended.

Nextcloud GUI shows:

Steps to replicate it (hint: details matter!):

  1. run any php command such as sudo -u www-data php . . . . occ command:detail --options
  2. You get a php warning about setting the memory limit above 512mb

But it IS using that memory setting. However the amount of memory allocated is a bit low to be frank.

When you run the PHP CLI, you can add runtime parameters which overrides the config files like this:

sudo -u www-data php -d memory_limit=2048M /var/www/path/to/phpscript.php

And the ini file to configure for cli is in /etc/php/8.3/cli/