8.cent os7.2 安装composer后报错proc_open(): fork failed - Cannot allocate memory

2016.09.04

1.问题描述
配置阿里云服务器,Cent OS7.2系统,从composer官网下载,解压。
然后用composer安装laravel项目,报错

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

PHP Warning:  proc_open(): fork failed - Cannot allocate memory in phar:///usr/local/bin/composer.phar/vendor/symfony/console/Application.php on line 954

Warning: proc_open(): fork failed - Cannot allocate memory in phar:///usr/local/bin/composer.phar/vendor/symfony/console/Application.php on line 954
                                                     
  [ErrorException]                                   
  proc_open(): fork failed - Cannot allocate memory  
                                                     
2.解决过程


根据所提供网址访问https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors
上面显示有提供问题发生的可能原因和解决办法
This could be happening because the VPS runs out of memory and has no Swap space enabled.

free -m

total used free shared buffers cached
Mem: 2048 357 1690 0 0 237
-/+ buffers/cache: 119 1928
Swap: 0 0 0
To enable the swap you can use for example:

/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
/sbin/mkswap /var/swap.1
/sbin/swapon /var/swap.1

运行这几条命令后问题解决


3总结


根据问题描述可能是内存原因,maybe是没有给composer配置内存?

参考网址 https://getcomposer.org/doc/articles/troubleshooting.md


你可能感兴趣的:(学习笔记)