The PHP memory limit is below the recommended value of 512MB

I am using php-fpm, so what helped was:
modifying the .user.ini in your nextcloud install directory.
append:

upload_max_filesize=10G
post_max_size=10G
memory_limit=512M

of course you should adapt the values to fit your need.
afterwards restart your php fpm service and your web server service:
e.g.: sudo service php7.2-fpm restart && sudo service ngxin restart

13 Likes

Thanks timetrax, it works with your suggestion.

2 Likes

Follow instruction from timetrax below, it worked for me.

This did not work for me :frowning: I am on Debian Buster, it has php7.1

Correct way to do it is modify it in /etc/php/7.2/apache2/php.ini

; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 513M (original value = 128M)

2 Likes

yesterday, I saw many LDAP related errors which vanished after raising the memory_limit in the CLI version of the PHP config. Obviously the cron job had issues.

This also worked for me on Debian Stretch on a VPS at Digital Ocean, using php7.3 with sury repository. Thanks, oemb1905

Debian Buster
Nextcloud 16.0.3
Work :

  • change memoy_limit in /etc/php/7.3/fpm/php.ini for 512M
  • systemctl restart apache2
  • service php7.3-fpm restart

That’s all for me.

5 Likes

JeromeSi’s post was what fixed this for me. These PHP settings are all over the place.

Yes! Correct! If you using PHP-FPM it is need to restart both.
Just change/set the memory_limit = 512M from the /etc/php/7.3/fpm/php.ini and

  • sudo /etc/init.d/apache2 restart
  • sudo /etc/init.d/php7.3-fpm restart

Thank you! :slight_smile:

2 Likes

Hello
I have php 7.3 and the command
sudo -u www-data php7.3 -i | grep memory_limit
returns
memory_limit => -1 => -1
NO LIMIT ! but I still have the message"The PHP memory…" BUG? or did I miss something?

Guys, create a mod instead of editing all single php.ini files: Die Meldung "PHP-Speichergrenze liegt unterhalb des empfohlenen Wertes von 512MB." verschwindet nicht!

Since one can set a priority, this as well assures that any other or future drop-in config cannot override this setting. php.ini settings are always overridden by any drop-in config or mod.

For PHP 7.3 change /etc/php/7.3/fpm/php.ini
The cli php.ini made no difference.

1 Like

I do not want to increase PHP memory for all users.
Adding this line to user.ini worked fine in NC 15:
memory_limit = 512M

But now this file get’s an error while the checksum is incorrect.
And even worse, after each update this file is overwritten by the update.

So there should be an alternative way to set this option per NC installation, without loosing this setting each update and without getting a checksum failure notification.

Who knows?

1 Like

The checksum failure seems gone now. But not the overwriting of the existing file. Where do I have to put these custom settings to avoid redoing this every update for alle clouds?

In my case this did not work and from the description of warning it is true that is needed change Memory limit not post_max_size. For me worked this:

Editing the memory limit from
memory_limit = 128MB
to
memory_limit = 512MB

In my case it was non of the solutions above. For
System:

  • Ubuntu 20.04.1 LTS
  • Nextcloud 19.0.6
  • Apache2.4
  • php7.4-fpm

Using php7.4-fpm as service it was necessary to change file: /etc/php/7.4/fpm/pool.d/www.conf, and set this variable to have 756M to run php

php_admin_value[memory_limit] = 756M

And then restart service php7.4-fpm

Try downgrading php to 7.3 and recompile.

I had a similar issue and using a lower version of pho did the trick.

Thanks, it was helpful

OK. Fine.
Now on NC20 with php7.4. All instances are stable and 100% security (https://internet.nl).
I get no errors anymore about overwritten settings in the ini file.

After updates there are now every time occ commands that need to be executed. When no maintenance mode is required, the occ plugin works fine and fast. Otherwise you should use SSH login and that takes more time.