How to fix PHP configure “CC Internal error Killed (program cc1)” error?

blogdaren 2018-04-18 抢沙发 238人次

    For most case, you will typically install PHP from the repository of your corresponding Linux distribution. 

    For example, on CentOS or Red Hat, you will do command: 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 will do the following:

make install

    On my system, when I tried to do "configure" for compiling PHP from source code, I got the following error message:

# ./configure --prefix=/home/lijiaqi/binary
cc: Internal error: Killed (program cc1)
make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1

    Here is the last few lines before "configure" got killed:

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.

    It 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, we got two solutions:

    1. Increase our RAM.May be to 1 GB

    2. Disable the "fileinfo". ./configure --disable-fileinfo

    Most likely, you will might opt to go for the 2nd option. i.e to Disable fileinfo during "configure", Just 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 --prefix=/home/lijiaqi/binary --disable-fileinfo

版权声明:除非注明,本文由( blogdaren )原创,转载请保留文章出处。

本文链接:How to fix PHP configure “CC Internal error Killed (program cc1)” error?