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

Hello guys,

good evening to all.

I just did a fresh install of the server and whenever going to Settings > Overview I keep getting the following error: "The PHP memory limit is below the recommended value of 512MB."

ive modified the file at /etc/php/7.2/cli/php.ini to show memory_limit = 1G and I still get that error message
I’ve modified the .htaccess and .user.ini to reflect 1G and whenever restarting apache/server I still get that error message

Also, the maximum_upload_size won’t change from 2 MB even after being specified to be 1G

sudo -u www-data php7.2 -i | grep memory_limit
memory_limit => 1G => 1G

sudo -u www-data php7.2 -i | grep upload_max_filesize
upload_max_filesize => 1G => 1G

y’all have any advise?

Nextcloud

Version: 14.0.4.2
Apps installed: 32
Apps updates available: 0

PHP

Version: 7.2.10
Memory Limit: 128 MB
Max Execution Time: 3600
Upload max size: 2 MB

3 Likes

Hi, did you restart your services after changing these values?
The folder structure and setup of PHP is slightly different on my system, so I can’t fully compare, but I believe I read in the forum somewhere that /etc/php/7.2/cli/php.ini is not the correct config file for web services. This file should be for Command Line Interface usage of PHP only, as far as I know.

Isn’t there another directory under /etc/php/7.2/ which contains a php.ini file?
On an Ubuntu test machine I see : /etc/php/7.2/fpm/php.ini
By default, it seems to have 128MB set as memory_limit. So it would match your value shown in the NC GUI.

2 Likes

so i had to do a search for the other possible php.ini you mentioned and found it under /etc/php/7.2/apache2/php.ini and increased the memory_limit to 512M, restarted apache2 and now the error message is gone. thanks for that input.

now, i tried updating the lines for upload_max_filesize and after reloading the service and the website it went from 2MB to 8MB even when both files are setup to 1G.

Any ideas?

Aren’t 8 MB enough?
Just kidding :stuck_out_tongue:

You could check the .htaccess and most importantly the .user.ini (both in your NC directory).
The 8 MB are very strange though. The NC defaults are 512 MB, so the mentioned files should already be configured to 512 MB at least. Maybe there are some other PHP settings which restrict the value to 8 MB?

Nonetheless, try to increase the values in .htaccess and .user.ini first and let’s so how that goes.

.htaccess and .user.ini both show 1G

this is what the monitoring tab shows:

PHP

Version: 7.2.10
Memory Limit: 512 MB
Max Execution Time: 3600
Upload max size: 1 GB

but if i go to the Basic Settings page it still shows the upload size as 8 MB.

ive restarted the apache server multiple times.

found the line it was still showing Max Upload Size in the basic settings.
it was related to post_max_size=8M i changed it to 1G and now its showing accordingly.

this setting i modified it on the /etc/php/7.2/cli/php.ini and on /etc/php/7.2/apache/php.ini
did a systemctl restart apache2 and voila!! it got changed to 1G :slight_smile:

ill do another fresh install and see if this comes up again, but this time, i know how to fix it… :slight_smile:

4 Likes

Hello, I have a related question.

I’m using a Nextcloud instance with a very low workload, essentially one user with up to three clients connected to it. My hosting provider only allows to set the PHP memory limit to 384 MB, not higher. Therefore my Nextcloud install is complaining in the settings/overview menu. So far everything seems to work fine.

What are the everyday limitations of using Nextcloud with a memory limit of 384 MB?

After a little bit of research I understand that image processing could lead to errors. Are there any other more basic functions that won’t work with 384 MB of memory?

I’m asking because I’m not sure if I should swith providers or not.

I think this question is worth its own topic.

I’m running into this exact situation but with a snap install. I cannot find my php configs anywhere and would like to up my current allocation of 128mb. Suggestions?

1 Like

Same problem here. It doesn’t seem to be easy to customize a snap bundled application. Any suggestions?

Same issue with my snap installation. At the Overview section of Settings I get the following message.

  • The PHP memory limit is below the recommended value of 512MB.
  • The “Strict-Transport-Security” HTTP header is not set to at least “15552000” seconds. For enhanced security, it is recommended to enable HSTS as described in the [security tips]

I changed the memory_limit var at the php.ini file under /etc/php/7.0/apache2/ to 512MB, but the problem remains. Also memory_limit is -1 at the php.ini file located at /etc/php/7.0/cli/ (changed it to 512MB, but message remains the same).
So I searched in the snap package where I found that at the php.ini located at /snap/nextcloud/current/config/php/ there is memory_limit = ${PHP_MEMORY_LIMIT}

What is the proper way to resolve this issue?

  • Server OS: ubuntu 16.04
  • NextCloud Snap version: 14.0.5snap2

I resolved my issue with the PHP memory limit with my snap installation by using the this command:

$ sudo snap set nextcloud php.memory-limit=512M

More information can be found here: https://github.com/nextcloud/nextcloud-snap

You can restart the snap by using this command: sudo systemctl restart snap.nextcloud.apache

Hope this helps.

Gary

1 Like

Thanks @gary!!! :D:D:D This is it! The memory_limit problem is now resolved.

1 Like

Awesome. Glad to help.

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