Download instant fail ,php error ,allowed memory exhausted

Hey Gents

my NEXTCLOULD suddenly be unable to download any file larger than 100KB ,looked through the logs it said

[PHP] ERROR: Allowed memory size of 536870912 bytes exhausted (tried to allocate 277755556 bytes) at /var/www/html/lib/private/legacy/OC_Image.php#589

my system info

ESXI 7.0. VM debian 11, 4GB RAM

Server configuration detail

Operating system: Linux 5.10.0-12-amd64 #1 SMP Debian 5.10.103-1 (2022-03-07) x86_64

Webserver: nginx/1.21.5 (fpm-fcgi)

Database: mysql 10.6.5

PHP version: 8.0.14

Modules loaded: Core, date, libxml, openssl, pcre, sqlite3, zlib, ctype, curl, dom, fileinfo, filter, ftp, hash, iconv, json, mbstring, SPL, PDO, pdo_sqlite, session, posix, readline, Reflection, standard, SimpleXML, Phar, tokenizer, xml, xmlreader, xmlwriter, mysqlnd, cgi-fcgi, apcu, bcmath, exif, gd, gmp, imagick, intl, ldap, memcached, pcntl, pdo_mysql, pdo_pgsql, redis, sodium, zip, Zend OPcache

Nextcloud version: 23.0.0 - 23.0.0.10

maybe I ran out of RAM ,but how can I allocate more to the system?

I have no clue where is the php.ini in the container

it worked well in past week, dont know what goes wrong

pls advise

I found this and there is a link to this.

thanks mate
I tried both issues method ,but it wont work

I think I solved the instant fail issues as I unmont the data volume and I forget about it

after I mount it back ,the previous file is there and they are available again

but when I trying to muaually scan files bt the comment scan:file ,the allowed memory exhausted came out again