在make命令期间在CentOS 6.5上编译PHP 5.5.9时出错

这是错误消息:

cc: internal compiler error: Killed (program cc1) Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions. make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1 

处理的最后一件事是apprentice.lo,它似乎是image processing库的一部分(也许?)。 我正在使用Ansible来configuration我的实例。 这是一款数字海洋单核512MB虚拟机。

我一直在使用vagrant / ansible在本地开发相同的configuration,它已经编译好,这是我试图提供的第一个云虚拟机。 唯一的区别是我的DO服务器的基本映像来自DO和我的本地开发者,我通过VirtualBox从股票CentOS基本服务器安装来构build我自己的Vagrant框。 我把它从DropBox中拉下来。

这个问题已经被别人经历过,并被报告为一个php bug报告

我的php ansibleangular色的错误:

 --- - name: Download php source get_url: url={{ php_source_url }} dest=/tmp register: get_url_result - name: untar the source package command: tar -xvf php-{{ php_version }}.tar.gz chdir=/tmp when: get_url_result.changed or php_reinstall - name: configure php 5.5 command: > ./configure --prefix={{ php_prefix }} --with-config-file-path={{ php_config_file_path }} --enable-fpm --enable-ftp --enable-mbstring --enable-pdo --enable-soap --enable-sockets=shared --enable-zip --with-curl --with-fpm-group={{ nginx_group }} --with-fpm-user={{ nginx_user }} --with-freetype-dir=/usr/lib64/ --with-gd --with-jpeg-dir=/usr/lib64/ --with-libdir=lib64 --with-mcrypt --with-openssl --with-pdo-mysql --with-pear --with-readline --with-tidy --with-xsl --with-zlib --without-pdo-sqlite --without-sqlite3 chdir=/tmp/php-{{ php_version }} when: get_url_result.changed or php_reinstall - name: make clean when reinstalling command: make clean chdir=/tmp/php-{{ php_version }} when: php_reinstall - name: make php command: make chdir=/tmp/php-{{ php_version }} when: get_url_result.changed or php_reinstall 

在此先感谢您的帮助。 🙂

这是由于一个OOM(内存不足)事件导致编译器进程被杀死,我可以用'一些Linux的Nerds'的帮助来确定。 为了避免这种情况,当你不能只是增加内存的机器,我用了一个交换文件。 以下是我在这里find的命令:

 dd if=/dev/zero of=/swapfile bs=1024 count=262144 mkswap /swapfile swapon /swapfile 

我没有启用它重新启动后,因为512MB已经足够我每天需要这个盒子,所以我省略了这个命令。 我重新编写了PHP源代码,并成功完成。