CentOS7.2 安装MySQL、PHP报错 Killed signal terminated program cc1

CentOS7.2 安装MySQL、PHP报错 Killed signal terminated program cc1,这个原因是由于内存不足导致的,可以通过增加交换分区来解决。

二维码

简介

    CentOS7.2 安装MySQL、PHP报错 Killed signal terminated program cc1,这个原因是由于内存不足导致的,可以通过增加交换分区来解决。


    对于make编译,如果是阿里云centos主机内存小于2G的,可能会在make编译到45%、63%时报错;如果是腾讯云centos主机内存为1G时,可能会在make编译到64%时报错。


===============阿里云测试结果(引用)==================
c++: Internal error: Killed (program cc1plus)
Please submit a full bug report.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
make[2]: *** [sql/CMakeFiles/sql.dir/item_geofunc.cc.o] Error 1
make[1]: *** [sql/CMakeFiles/sql.dir/all] Error 2
make: *** [all] Error 2

================腾讯云测试结果(实测)=================
g++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[2]: *** [sql/CMakeFiles/sql_gis.dir/gis/crosses.cc.o] Error 1
make[1]: *** [sql/CMakeFiles/sql_gis.dir/all] Error 2
make: *** [all] Error 2


以上均为内存不足所致,可通过设置2G交换分区来解决该问题。


解决方案:

#获取要增加的2G的SWAP文件块
dd if=/dev/zero of=/swapfile bs=1k count=2048000
#创建SWAP文件
mkswap /swapfile 
#激活SWAP文件
swapon /swapfile   
#查看SWAP信息是否正确
swapon -s  
#添加到fstab文件中让系统引导时自动启动
echo "/var/swapfile swap swap defaults 0 0" >> /etc/fstab


swapfile文件的路径在/var/下,编译完后, 如果不想要交换分区了, 可以删除。


删除交换分区:

swapoff /swapfile
rm -rf /swapfile


至此,问题解决。

点赞(66)

手机端

微信扫一扫体验

返回
顶部