Hello! I am trying to import a JSON file backup into InvoiceNinja but I am getting a 500 error during the upload. It appears from the logs that the php memory limit for the app is being hit:
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /app/code/app/Services/ImportService.php on line 284
How can I edit the PHP memory limit for Invoice Ninja in the Cloudron App?
you can adjust the upper memory limit via the Cloudron dashboard. In the advanced tab of the app configure dialog you have a slider to do so.
@nebulon Thank you. I have done that but I am still running it issues. I have set over 2GBs to the app in the advanced tab but it appears that PHP is still limited to 128MB. I need a way to up that memory...
Typically, I would do that in the .htaccess file but it appears those are read-only on Cloudron...? How else can I up the PHP memory limit?
php_value memory_limit 2048M
Sorry for the late reply. Indeed the php memory limit is fixed for the app.
Currently the only way to temporarily change that, is to use the cloudron cli tool and reconfigure the app with
cloudron configure --app <id/domain> --debugthen open a remote terminal into the app with
cloudron exec --app <id/domain>and change the value in the
php.ini. Then manually start the app from that remote terminal with
/app/code/start.shand perform the import. Once done reconfigure the app again to be in production state with
cloudron configure --app <id/domain> --no-debug
Arguably this is far from convenient and likely error prone, not sure how we could solve such burst memory requirements more elegantly.
@nebulon Running into this same issue on NextCloud... the install is limiting the PHP memory limit to 128mb.. NextCloud recommends at least 512mb. There REALLY needs to be a way to adjust this limit for the app.
murgero last edited by
@nebulon You could have the configuration step make the memory limit 50-75% what the current memory is but then max it at some point (say we max it at 128MB):
Setup 1: App memory set to 256MB, php memory limit would be 128MB.
Setup 2: App memory set to 512MB, php memory limit would be 128MB.
Setup 3: App memory set to 128MB, php memory limit would be 64MB.
So on and so on.
That is a good idea and the ratio should probably depend on the app. I mention this, since Nextcloud has a similar issue to be solved.
An app package version which follows your proposal of 50% memory limit setting for PHP was just published. Does it work for you as expected now?