Ошибка нехватки памяти при установке приложения laravel на сервер - PullRequest
1 голос
/ 27 марта 2019

При установке приложения laravel 5.8 на Ubuntu 18 (в Digital Ocean) я получил ошибку:

Updating dependencies
: mmap() failed: [12] Cannot allocate memory
: mmap() failed: [12] Cannot allocate memory
: PHP Fatal error:  Out of memory (allocated 533733376) (tried to allocate 4096 bytes) in /usr/share/php/Composer/DependencyResolver/RuleSetGenerator.php on line 126
: Out of memory (allocated 533733376) (tried to allocate 4096 bytes) in /usr/share/php/Composer/DependencyResolver/RuleSetGenerator.php on line 126

Я проверяю память и вижу:

# free
              total        used        free      shared  buff/cache   available
Mem:        1009156      387908      147884       15716      473364      462800

Я пытаюсь прикрепить файл подкачки и поискать, я нашел решение:

# sudo swapon -a
# sudo fallocate -l 1G /`file
> 

и последняя команда зависает навсегда.

Далее я попробовал:

# sudo mkswap /swapfile
mkswap: cannot open /swapfile: No such file or directory
# sudo swapon /swapfile
swapon: cannot open /swapfile: No such file or directory



# cat /proc/partitions 
major minor  #blocks  name

 252        0   26214400 vda
 252        1   26100719 vda1
 252       14       4096 vda14
 252       15     108544 vda15
# fdisk -l || mount | grep sd
Disk /dev/vda: 25 GiB, 26843545600 bytes, 52428800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: C1F9A1FE-534C-4DAC-9299-5CC180C29DCE

Device      Start      End  Sectors  Size Type
/dev/vda1  227328 52428766 52201439 24.9G Linux filesystem
/dev/vda14   2048    10239     8192    4M BIOS boot
/dev/vda15  10240   227327   217088  106M Microsoft basic data

Partition table entries are not in disk order.

Почему ошибка и как ее исправить?

Модифицированный блок: как композитор запустить в скрипте посланника я попытался с переключением на используемый пользователь и настройки памяти следующим образом:

# which composer 
/usr/bin/composer 
su -l lardeployer
php -d memory_limit=1024M /usr/bin/composer  update
Composer could not find a composer.json file in /home/lardeployer
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section

Но последнее сообщение с ссылкой в ​​раздел «Начало работы» смутило меня ... Как это исправить?

...