Cannot access OCC

I am trying to access OCC in the nextcloud folder

sudo -u www-data php occ <

but I get an error as follows:

PHP Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 65536 bytes) in /var/www/nextcloud/3rdparty/react/promise/src/functions.php on line 139<

Does anyone have any ideas?

That seems odd. “Allowed memory size of 2097152 bytes exhausted” seems to indicate the allowed memory limit for PHP here is 2 Megabytes.

That seems way too low. Can you check your php.ini for CLI and increase that value to something more sane? (e.g. 512MB)

Hello, my /etc/php/7.0/apache2/php.ini does not seem to have any memory value for CLI:

[CLI Server]
; Whether the CLI web server uses ANSI color coding in its terminal output.
cli_server.color = On

This is the same in my /etc/php/7.0/cli/php.ini

Hi,

The regular memory_limit variable should work. Try editing the .user.ini file in the root of your Nextcloud install. For example,

upload_max_filesize=512M
post_max_size=512M
memory_limit=512M
mbstring.func_overload=0
always_populate_raw_post_data=-1
default_charset='UTF-8’
output_buffering=0

Thanks for the response, my .user.ini already has reasonable limits:

upload_max_filesize=5G
post_max_size=5G
memory_limit=2G
mbstring.func_overload=0
always_populate_raw_post_data=-1
default_charset='UTF-8’
output_buffering=0

OCC has not worked for quite some time; so I am not sure what tinkering has caused this issue.

Can you post your complet php.ini for the CLI?

Thanks Lucas, my /etc/php/7.0/cli/php.ini is here:

http://paste.ubuntu.com/23261549/

This is just 2 kB. You might want to try:
memory_limit = 2048M

I cannot believe I did not spot that! Thanks everyone for the help; Nextcloud is a great application!
OCC now works for me