How to Fix PHP Configure “CC Internal error Killed (program cc1)” Error

For most case, you’ll typically install php from the repository of your corresponding Linux distribution.

For example, on CentOS or Red Hat, you will do: yum install php

However under certain circumstance, you might end-up installing PHP from source code.

On a high-level to install PHP from source, you’ll do the following:

  • ./configure
  • make
  • make install

On my system, when I tried to do ./configure, I got the following error message:

# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-libdir=lib64
cc: Internal error: Killed (program cc1)
make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1

Here is the last few lines before ./configure got killed

# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-libdir=lib64
/bin/sh /usr/save/php-5.5.10/libtool --silent --preserve-dup-deps --mode=compile /usr/save/php-5.5.10/meta_ccld -I/usr/save/php-5.5.10/ext/fileinfo/libmagic -Iext/fileinfo/ -I/usr/save/php-5.5.10/ext/fileinfo/ -DPHP_ATOM_INC -I/usr/save/php-5.5.10/include -I/usr/save/php-5.5.10/main -I/usr/save/php-5.5.10 -I/usr/save/php-5.5.10/ext/date/lib -I/usr/save/php-5.5.10/ext/ereg/regex -I/usr/include/libxml2 -I/usr/save/php-5.5.10/ext/sqlite3/libsqlite -I/usr/save/php-5.5.10/TSRM -I/usr/save/php-5.5.10/Zend  -D_REENTRANT -DTHREAD=1  -I/usr/include -g -O2 -fvisibility=hidden -pthread -DZTS  -c /usr/save/php-5.5.10/ext/fileinfo/libmagic/apprentice.c -o ext/fileinfo/libmagic/apprentice.lo
cc: Internal error: Killed (program cc1)
Please submit a full bug report.
See <> for instructions.
make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1

For me this error message happened during “ext/fileinfo/libmagic/apprentice.lo” step.

I was trying to do this on an Amazon AWS micro instance, which had only around 600MB of RAM.

Looks like compiling PHP from source (at least the ./configure step) requires more memory than 600MB.

Since this ./configure was pretty much taking most of the memory, kernel decided to kill this running process.

By reading the PHP documentation, I couldn’t figure out exactly how much minimum memory is required for this to work properly. But, I’ve tried on a 1GB RAM, and didn’t see this problem.

So, you got two solutions:

  1. Increase your RAM. May be to 1 GB.
  2. Disable the “fileinfo”.

Most likely, you’ll might opt to go for the 2nd option. i.e to Disable fileinfo during ./configure. Pass –disable-fileinfo as shown below.

Once I passed the –disable-fileinfo, as shown below, I didn’t get that error anymore, and I was able to ./configure, make and make install successfully.

./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-libdir=lib64 --disable-fileinfo