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

Chiming in as I am repeatedly having an out of memory issue as well. I have tried the sudo snap set nextcloud php.memory-limit=512M and the restart command repeatedly and the issue persists.

If I view the php.ini file, it is still showing the memory limit at 128MB, and the file says that it is read-only if I try to change it to 512MB and save.

Is there another configuration file that I can modify somewhere?

This definitely seems to be related to something with photos and thumbnails as my nextcloud runs fine until I open a folder full of photos. Then the out of memory error occurs and I have to reboot.

FYI I am using Digital Ocean Ubuntu 18 with 1GB RAM. Used the snap package to install Nextcloud.

I’m at my wit’s end here. I cannot make this thing work and I’m about give up on the entire thing. I am not proficient at all and therefore I cannot run this without using snap. I just don’t have the knowledge to configure and maintain everything without using a snap.

Really need some help to make this change from 128 to 512 and get it to actually save!

thanks Gary

Wanted to add that I was successful in changing to 512. Gary’s instructions did end up working. However, I don’t think it solved my issue.

I believe something with memory and the iPhone app was the problem.

I’ve changed all the php.ini files below, and yet still having this below 512 MB memory recommendations:

/etc/php/7.2/apache/php.ini
/etc/php/7.2/phpdbg/php.ini
/etc/php/7.2/fpm/php.ini
/etc/php/7.2/cli/php.ini
/etc/php/7.2/apache2/php.ini
/etc/php/7.2/cgi/php.ini

1 Like

@Vincent_Tham Same here. On the latest 16

what i ended up doing after upgrading to 16 was modify the php via webmin and increased it from 128 to 1GB
That solved my issue

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