sudo -u www-data php -i
phpinfo()
PHP Version => 8.0.3
System => Linux delucloud 5.4.0-72-generic #80-Ubuntu SMP Mon Apr 12 17:35:00 UTC 2021 x86_64
Build Date => Mar 5 2021 07:54:13
Build System => Linux
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /etc/php/8.0/cli
Loaded Configuration File => /etc/php/8.0/cli/php.ini
The sed command you posted simply replaces any numeric value, following the expression memory_limit, in any php.ini file on your system, to a value of 512. So far, so good…
My guess is that you are using PHP-FPM and therefore there are two php.ini files on your system. One is in /etc/php/version.number/cli/ and the other one in /etc/php/version.number/fpm/
In one of those files, probably the one in /etc/php/.../cli/, the value was perviously set to -1 (for unlimited) which then was changed to an invalid value of -512 by the sed command.
I would recommand to manually edit this file, using a text editor of your choice and then either set the value back to -1 or to 512M.
THX
edited both files there was:
memory_limit = 512M
Changed to
memory_limit = -1
reboot
Wanted to add missing indices, but still this:
root@nextcloud ~# sudo -u www-data php /var/nextcloud/occ db:add-missing-indices
PHP Warning: Invalid "memory_limit" setting. Invalid quantity "-512": value is out of range, using overflow result for backwards compatibility in Unknown on li ne 0
PHP Warning: Failed to set memory limit to 512 bytes (Current memory usage is 2 097152 bytes) in Unknown on line 0
Could not open input file: /var/nextcloud/occ
root@nextcloud ~#
Is there still another config file in use??
In system at PHP, I have:
Version: 7.4.33
Memory limit: -1 B
Max execution time: 3600
Upload max size: 2 MB
[quote="Witzker, post:8, topic:113143"]
`Invalid "memory_limit" setting. Invalid quantity "-512": value is out of range
Maybe the value -512 is set somewhere else: user.ini, .htaccess? Or maybe you have multiple PHP versions installed and edited the files of the wrong version…? Also make sure that the memory_limit line is only included once in each file. Other than that, I’m not sure what else could cause this error.
Btw. It’s not good practice to use -1, I use 2048M, which is probably still overkill. I would recommend using 512M on a server with 2GB of RAM or less, 1024M on servers with 4GB of RAM, 2048M on a server with 8GB of RAM.
You had -1 as a memory setting. Now with your sed command, you changed it to -512, as you only swapped the number after the equal sign, hence not removing the minus.
If the narrowed down search does not find all, then at some occasions there is custom ini files under /usr/
Then use the above command, but on / only. Be aware that it will produce many “error”, and it can be hard to find the needle in the haystack, but it will work.