近期用命令composer require phpoffice/phpspreadsheet安裝phpspreadsheet時出現內存不足問題,出現以下錯誤:php
The following exception is caused by a lack of memory or swap, or not having swap configured
用如下方法完美解決:composer
sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024 sudo /sbin/mkswap /var/swap.1 sudo /sbin/swapon /var/swap.1