How to fix Nextcloud updater PHP Fatal error:  Allowed memory size of ... bytes exhausted

Problem:

While trying to update Nextcloud using the command line (e.g. SSH) using a command like

example.sh
php updater/updater.phar

you see an error message containing PHP Fatal error:  Allowed memory size of ... bytes exhausted such as this one:

example.txt
[✔] Check for expected files
[✔] Check for write permissions
[✔] Create backup
[✔] Downloading
[ ] Verify integrity ...PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 155061456 bytes) in phar:///owncloud.mydomain.com/updater/updater.phar/lib/Updater.php on line 637

Solution

First, try to adjust the memory limit in your webhosting panel or php.ini. If this is not possible - such as for my hoster, which has different settings for the FastCGI PHP as opposed to the command line (CLI) PHP, you can manually set the memory limit using

example.txt
php -d memory_limit=512M updater/updater.phar

 


Check out similar posts by category: Networking, Nextcloud, PHP