PHP memory limit is below the recommended value of 512MB

It’s actually an ancient story, but it hasn’t been solved cleanly for nextcloudpi 25.03. In any case, I found nothing suitable in the older threads.

There are some errors in your system configuration.
- The PHP memory limit is below the recommended value of 512MB.
- The PHP module 'imagick' is not activated, but the theming app is. In order for the favicon generation to work correctly, you need to install and activate this module.
  • Please give a reference to the file to be changed.
  • The subsequent installation of php-imagick remains unsuccessful.

Try search this forum. This question has been answered 100s of times already.

or read the docs:

https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#php-ini-configuration-notes
and
https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation

Please give me the link to it. Thanks

Please use the search function at top of this community. There are so many to choose from that I have no idea which one fits your specific case, but I will say taht with 99% certainty, one of them fits.

I can understand if the readers of my request are annoyed because they have to be asked again and again because

  • the answers in the WEB are not up-to-date or because
  • even the manual does not provide a short guide to a known problem.
    “Memory requirements for running a Nextcloud server are greatly variable, depending on the numbers of users, apps, files and volume of server activity.
    Nextcloud needs a minimum of 128MB RAM per process, and we recommend a minimum of 512MB RAM per process” (You find it here: System requirements — Nextcloud latest Administration Manual latest documentation)

Has anyone analyzed the effort with which the users and you, the supporters, are looking for a solution that would be superfluous with a small hint for the installation / after installation?
Let’s keep the ball flat. (Whether that German proverb arrives here correctly?)

Here my trials:

sudo grep -r -l “memory_limit” /etc/*
grep: /etc/motd: Datei oder Verzeichnis nicht gefunden
/etc/php/8.1/fpm/php.ini
/etc/php/8.1/fpm/conf.d/90-ncp.ini
/etc/php/8.1/cli/php.ini


only
sudo nano /etc/php/8.1/fpm/php.ini
contains “memory_limit = 128M” I changed to 512M, but without success.

and now?

Did you restart php-fpm?

Thats new to me, Please write a command to me. Thanks

from Installation on Linux — Nextcloud latest Administration Manual latest documentation

When you do changes to php.ini files, you always has to restart the php module/engine which uses the file. In this case if you use php-fpm - the one of which ini file you wrote you chnaged - you will need to restart the php-fpm service.

systemctl restart php8.1-fpm.service
Even though it is not needed, I always also restarts my webserver. I uses apache2, but it should not be needed at all.

The server has been restarted several times in the meantime.
systemctl restart php8.1-fpm-service
doesn’t help anymore.
Problem still exists.

I cannot answer you where there is memory settings not yet configured. Sorry. You might get some answers by running php_info(); somehow, which will show you which config files are in use.

You mean systemctl restart php8.1-fpm.service and not with the last dash, right?

Yes, I made a mistake.

The command (in different variants)

~$ sudo php_info(); or phpinfo()

allways produces the error

-bash: Syntaxfehler beim unerwarteten Symbol »(«

I read the site

https://www.php.net/manual/de/function.phpinfo.php

and tried everything possible. The above error remains.
Now I rub my eyes and don’t understand anything anymore.

phpinfo() needs to run in a PHP engine. As the very least you got to do:

sudo php phpinfo(); However you needs to do this at the engine running your NC, so best is to create an phpinfo.php file in your www/nextcloud folder with this content:

<?php phpinfo(); ?>

then chmod +x /path/to/nextcloud/directory/phpinfo.php

THEN go to your browser:

https:///phpinfo.php

My result from the browserinput:
https://phpinfo.php

So that you can check my input again, here are the commands:

sudo nano /var/www/nextcloud/phpinfo.php
-->   <?php phpinfo(); ?> 
sudo chmod +x /var/www/nextcloud/phpinfo.php

Sorry my bad.

What I usually do (CAUTION! THIS CAN BREAK YOUR SYSTEM IF NOT DONE RIGHT):

sudo -u www-data mv /path/to/nextcloud/index.php /path/to/nextcloud/index.php_bak
sudo -u www-data nano /path/to/nextcloud/index.php

THIS ABOVE IS THE MOST IMPORTANT STEP IN THIS ENTIRE WALKTHROUGH. THIS IS YOUR BACKUP FOR SAFELY GETTING BACK TO NORMAL!

Ex:

sudo -u www-data mv /var/www/nextcloud/index.php /var/www/nextcloud/index.php_bak
sudo -u www-data nano /var/www/nextcloud/index.php

then in “new” php file:

<?php 

phpinfo(INFO_ALL);

?>

Then go to https://your.domain.tld/

That will output something like this:

The section that shows you the ini files parsed, is the interesting one aswell as the section that shows you the memory settings.

When done, do this:

sudo -u www-data mv /path/to/nextcloud/index.php /path/to/nextcloud/index.php_bak
sudo -u www-data nano /path/to/nextcloud/index.php

ex

sudo -u www-data mv /var/www/nextcloud/index.php_bak /var/www/nextcloud/index.php

make sure that the file is correctly owned by www-data again!:

sudo chown www-data:www-data /path/to/nextcloud/index.php

ex

sudo chown www-data:www-data /var/www/nextcloud/index.php

If you are using Nextcloudpi the php memory can be changed in ncp-config or in the ncp WebUI.
I use the default values and it runs pretty well.

php-imagick is not installed with ncp because there are plenty security concerns.

1 Like

I do not know NCP so I was not aware of those settings. It is probably safer to do it that way. :slight_smile:

Bildschirmfoto vom 2023-02-11 22-27-48

That’s the page in the webUI.

1 Like