Challenge: PHP memory limit

That’s true! I’m using mod_php and moreover I have already checked /etc/php/8.0/apache2/php.ini and limit_memory = 1G is set there as well.

I think it should work, but I still get this error message and I’m getting desperate.

Did you reload/restart apache so the new configuration value is acutally applied?

Yes, I have done that.

Can you check if PHP 8 is really used?
https://<url>/settings/admin/serverinfo

Was Nextcloud manually installed or did you use snap or something?
Is there another memory_limit entry somewhere in that or another file which overwrites your entry?
Any typo in the php.ini?
Run grep -R "memory_limit" /etc/php/8.0/* to see if there are any other memory_limit defined.

Other than that, I don’t have an idea right now.

root@...:/etc/php/8.0/apache2# grep -R "memory_limit" /etc/php/8.0/*
/etc/php/8.0/apache2/php.ini:**memory_limit** = 1G
/etc/php/8.0/cli/php.ini:**memory_limit** = 1G
root@...:/etc/php/8.0/apache2#

I installed Ubuntu via 1click and then installed the Lamp stack via the MacOS terminal. Is that helpful?

EDIT: I’ve checked it via your URL and its version: 8.0.19
What is very strange is that the maximum size for uploading is 2 MB although I have already changed this.

Sorry the url was misformed in my inital post: https://<url>/settings/admin/serverinfo. Just go to your admin settings and to system. Have look if it actually shows PHP 8.0 (and not PHP 7.4 or something).

Just noticed you already opened a thread about this: Fehler: Die PHP-Speichergrenze liegt unterhalb des empfohlenen Wertes von 512MB
Please keep it in one thread, it just makes it harder for every one to help you.

I’ve checked it via your URL and its version: 8.0.19
What is very strange is that the maximum size for uploading is 2 MB although I have already changed this.

Yes, I tried it in my mother tongue first but didn’t get much feedback and noticed that there is not much going on in the sub forum.

Is it possible, that you can change those values in your hetzner account?
https://docs.hetzner.com/de/konsoleh/account-management/configuration/php-configuration/#php-einstellungen

There is a console in the Hetzner account that you can use as an alternative to your own terminal but I don’t think that changes anything?

Not sure, I’m not familiar with Hetzner.
Another way would be to set your values in a .htaccess file.

That’s an excellent point, I’ve read about that before. But I can’t find the file - can you help me with it?

There most likely is already one in the nextcloud directory (it’s hidden, use ls -ahl for example).

But still, if the php.ini files are the correct ones, the value gets overridden somewhere. So maybe check what’s set in the hetzner account, just to compare if the currently used values match.

root@...:/var/www/files# ls -ahl
total 176K
drwxr-xr-x 14 www-data www-data 4.0K Jun  7 20:22 .
drwxr-xr-x  5 root     root     4.0K Jun  6 15:38 ..
drwxr-xr-x 43 www-data www-data 4.0K May 19 12:09 3rdparty
drwxr-xr-x 56 www-data www-data 4.0K Jun  7 13:05 apps
-rwxr-xr-x  1 www-data www-data  19K May 19 12:04 AUTHORS
drwxr-xr-x  2 www-data www-data 4.0K Jun  7 20:23 config
-rwxr-xr-x  1 www-data www-data 3.9K May 19 12:04 console.php
-rwxr-xr-x  1 www-data www-data  34K May 19 12:04 COPYING
drwxr-xr-x 22 www-data www-data 4.0K May 19 12:09 core
-rwxr-xr-x  1 www-data www-data 6.2K May 19 12:04 cron.php
drwxr-xr-x  2 www-data www-data  12K May 19 12:04 dist
-rwxr-xr-x  1 www-data www-data 3.3K Jun  6 13:22 .htaccess
-rwxr-xr-x  1 www-data www-data  156 May 19 12:04 index.html
-rwxr-xr-x  1 www-data www-data 3.4K May 19 12:04 index.php
drwxr-xr-x  6 www-data www-data 4.0K May 19 12:04 lib
-rwxr-xr-x  1 www-data www-data  283 May 19 12:04 occ
drwxr-xr-x  2 www-data www-data 4.0K May 19 12:04 ocm-provider
drwxr-xr-x  2 www-data www-data 4.0K May 19 12:04 ocs
drwxr-xr-x  2 www-data www-data 4.0K May 19 12:04 ocs-provider
-rwxr-xr-x  1 www-data www-data 3.1K May 19 12:04 public.php
-rwxr-xr-x  1 www-data www-data 5.3K May 19 12:04 remote.php
drwxr-xr-x  4 www-data www-data 4.0K May 19 12:04 resources
-rwxr-xr-x  1 www-data www-data   26 May 19 12:04 robots.txt
-rwxr-xr-x  1 www-data www-data 2.4K May 19 12:04 status.php
drwxr-xr-x  3 www-data www-data 4.0K May 19 12:04 themes
drwxr-xr-x  2 www-data www-data 4.0K May 19 12:06 updater
-rwxr-xr-x  1 www-data www-data  101 May 19 12:04 .user.ini
-rwxr-xr-x  1 www-data www-data  382 May 19 12:09 version.php
root@...:/var/www/files# 

Thank you! I didn’t know that yet and now I have found it and learned something. What should I do now?

But the terminal in Hetzner is only an alternative to the MacOS terminal (or whichever one you use normally.) It’s not a terminal. And apart from that there is no option to change anything in php.

You need to add something like php_value memory_limit 1G to the .htaccess file

2 Likes

I just added php_value memory_limit 1G to the .htaccess file and the warning finally disappeared! Thanks a lot!!

Glad it works. Remember to also adjust the upload size.

You wouldn’t happen to know how I can get rid of the Strict-Transport-Security warning?
Or should I create a new thread for something like this?

Can you give me the command for the upload size as well?

This can also be done in .htaccess.
Problem is that your values in .htaccess can be overridden in a future update (Feature request: do not overwrite custom .htaccess content · Issue #22473 · nextcloud/server · GitHub).

How does your apache config look like? Are the values overwritten there?

HSTS: https://docs.nextcloud.com/server/latest/admin_manual/installation/harden_server.html#enable-http-strict-transport-security

Didn’t change anything in the Apache config after the installation and just checked if I find something with memory_limit, but this is not the case.

Ok. I suggest you try to solve the HSTS Problem according to the documentation linked above. If you have any question, start a new thread and add your apache site config and anything that might be helpful.

1 Like