ubuntu - ubuntu服务器上的Laravel内存不足错误

标签 ubuntu laravel-5 out-of-memory

我在 Digital Ocean 下的 Ubuntu 主机(我在几周前创建它)中有内存错误:

root@ubuntu-boxBooking-Dev:/var/www/html/box-booking# lsb_release -d; uname -r; uname -i
Description:    Ubuntu 16.04.4 LTS
4.4.0-130-generic
x86_64

root@ubuntu-boxBooking-Dev:/var/www/html/box-booking# free -m
              total        used        free      shared  buff/cache   available
Mem:            992         325         562          35         104         518
Swap:             0           0           0

我安装了 laravel 5.5 应用程序。我从 git 中提取了更改,并且必须安装干预/图像:
# composer require intervention/image 

Using version ^2.4 for intervention/image
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)

mmap() failed: [12] Cannot allocate memory

mmap() failed: [12] Cannot allocate memory
PHP Fatal error:  Out of memory (allocated 586162176) (tried to allocate 20480 bytes) in /usr/share/php/Composer/DependencyResolver/Rule.php on line 66

Fatal error: Out of memory (allocated 586162176) (tried to allocate 20480 bytes) in /usr/share/php/Composer/DependencyResolver/Rule.php on line 66
root@ubuntu-boxBooking-Dev:/var/www/html/box-booking# 
root@ubuntu-boxBooking-Dev:/var/www/html/box-booking# lsb_release -d; uname -r; uname -i

我也试过:
# composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Removing doctrine/dbal (v2.6.3)
The following exception is caused by a lack of memory and not having swap configured
Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details

我懂了
没有配置交换
上面的错误描述和上面的免费命令中的 0 值。是问题吗?如何解决?

还在 Digital Ocean 下安装 Ubuntu 主机我没有注意到任何交换选项......

aslo 可以重启系统解决问题吗?
通常我会重新启动在 root 下运行的 ubuntu(我在笔记本电脑上使用 kubuntu 18):
reboot

这是我必须在我的情况下运行的还是其他更可取的命令?

谢谢!

最佳答案

添加交换似乎是目前唯一的解决方法。引用:https://github.com/composer/composer/issues/1898

过程:

df -h 
sudo dd if=/dev/zero of=/swapfile bs=1M count=1024
sudo mkswap /swapfile
sudo chmod 600 /swapfile
sudo swapon /swapfile
echo 'echo "/swapfile  none  swap  defaults  0  0" >> /etc/fstab' | sudo sh

free -m

关于ubuntu - ubuntu服务器上的Laravel内存不足错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51568160/

相关文章:

laravel - 我应该将 manifest.json 放在 Laravel 5.3 项目中的哪里?

java - 具有固定池大小和许多任务的 ThreadPoolExecutor

Java 单元测试 : how to measure memory footprint for method call

ubuntu - 如何在社区版上安装/激活 odoo 企业版

ruby-on-rails - Ubuntu 11.04 上的 Rails 3.1 通过 RVM - 未初始化的常量 Psych::Syck

mysql - ubuntu冲突端口上的XAMPP mysql和mysql服务器

php - Laravel/Eloquent - 如何同时运行多个原始 SQL 语句?

javascript - Laravel 5.0 : How to save multiple inputs of rows in the same column of database?

memory - 你能在 Kubernetes 上的 .NET Core 中触发 OOM 异常的自动内存转储吗?

linux -/dev/ttyACM 插入后前 15 秒忙