编译安装PHP 内存不足virtual memory exhausted Cannot allocate memory的解决方法 – MasterH杂货铺

编译安装PHP 内存不足virtual memory exhausted Cannot allocate memory的解决方法

物理内存不足,可以增加虚拟内存来解决

查看内存使用情况

free -m

file
可以看到当前Swap内存为0

增加虚拟内存

1、创建一个目录,路径自己定义

mkdir /opt/images/
rm -rf /opt/images/swap

file
2、创建一个4GB大小的文件

dd if=/dev/zero of=/opt/images/swap bs=1024 count=4096000

file
3、把创建的文件变成SWAP分区

mkswap /opt/images/swap

file
4、启用这个Swap文件

swapon /opt/images/swap

file
5、最后查看下这个Swap

free -m

file

参考链接

Related Posts

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注