Yet another "The PHP memory limit is below the recommended value of 512 MB."

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 29.0.5): 30.0.0
Operating system and version (eg, Ubuntu 24.04): Ubuntu 20.04.6 LTS
Apache or nginx version (eg, Apache 2.4.25): 2.4.41
PHP version (eg, 8.3): 8.1

The issue you are facing:
I keep getting the error " * The PHP memory limit is below the recommended value of 512 MB.". I found several php.ini files:
/home/myserver/etc/php.ini
/home/myserver/etc/php7.4/php.ini
/home/myserver/etc/php8.1/php.ini
/etc/php/7.4/cgi/php.ini
/etc/php/7.4/cli/php.ini
/etc/php/7.4/fpm/php.ini
/etc/php/8.1/cgi/php.ini
/etc/php/8.1/cli/php.ini
/etc/php/8.1/fpm/php.ini
/etc/php/8.3/cgi/php.ini
/etc/php/8.3/cli/php.ini
/etc/php/8.3/fpm/php.ini

I have replaced in all those ini files the directive memory_limit with
memory_limit = 1024M

I have restarted php.fpm, apache2 and even rebooted my server several times, without result.
I created a phpinfo test in the home directory of my nextcloud installation. This tells me:
Loaded Configuration File /etc/php/8.1/fpm/php.ini
(which is one of the files mentioned above). Strangely enough, also my phpinfo gives me:
memory_limit 128M 128M

Unfortunately, I’m getting close to insanity, because the loaded php.ini file and all other php.ini files have been changed.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Change memory_limit of php.ini
  2. Reboot
  3. See that nothing has changed, although the mentioned ini file is correctly changed

The output of your Nextcloud log in Admin > Logging:

PASTE HERE

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

PASTE HERE

The output of your Apache/nginx/system log in /var/log/____:

PASTE HERE

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

PASTE HERE

Nextcloud comes already with a phpinfo. You only have to enable it

Why are you torturing yourself like this? Have you really not heard of the php-updater script?
Or are you already using it and just didn’t have the courage to uninstall the old versions?

You should first run it without arguments to get an overview:

php-updater

then migrate the settings from the older versions you know are configured well:

php-updater 7.4 8.3
php-updater 8.1 8.3

and then run

php-updater --switch version.

and switch everything to 8.3
and last but not least, purge all the old versions to keep your system tidy.


Much and good luck,
ernolf

1 Like

Many thanks for your suggestions, even though they’re not a solution.

Activating phpinfo in NextCloud is something I didn’t know, but it doesn’t matter that much really, it gives me the same information.

I run my NextCloud instance on a VirtualMin server. There are several websites, each running their own scripts. I just installed PHP8 for my NextCloud instance, leaving all other hosts at rest at their own PHP version.

So if you have something like this running, you should already have enough knowledge of PHP to solve such a simple problem. Using multiple PHP versions side by side in different web applications on one and the same host is part of the high school of administration. But then it’s no longer a nextcloud-related issue.

What you can do, however, is this:

Append this entry to the file /path/to/nextcloud/.user.ini

memory_limit=-1

which will remove the burned-in limitation of 128 MB.

hth.


Much and good luck,
ernolf

So if you have something like this running, you should already have enough knowledge of PHP to solve such a simple problem.

If the problem were really simple, I probably would have found a solution for it. I’m just reaching out to the community, to see if anyone else already had the same, and maybe found a solution to it. That’s what a forum is for, no?

But then it’s no longer a nextcloud-related issue.

That is indeed so, it’s a PHP config issue. But since a lot of NextCloud admins have experience with this setting, and because it’s about a NextCloud installation, I thought I might ask it here.

Append this entry to the file /path/to/nextcloud/.user.ini

memory_limit=-1

This indeed gets rid of the error, thank you very much for this solution! I do wonder however why this is not just mentioned when the error is given. The error message would better look like:

"The PHP memory limit is below the recommended value of 512MB. You can solve this by adding memory-limit=-1 in your .user.ini file.

No, it would not. It is well documented php knowledge:

As it is not the preferred method to solve this. It is just ONE possibility. It is better to clean up your PHP and configure it properly, as this change can lead to further error messages, such as integrity checks not being passed or during an update. So be prepared to revert the change before an update and then have to set it afterwards.


Much and good luck,
ernolf

Thank you once more!

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.