Compile and install PHP when you encounter virtual memory Exhausted:cannot allocate memory
Sometimes when you build a VPS, you need to install the host Control Panel by compiling it. For large-memory VPS, the general problem is not big, but for small memory, such as 512MB of memory VPS, there is likely to be a problem, because the compilation process is a large memory consumption action.
I recently encountered a problem such as: In the 512MB memory CentOS operating system VPS on the installation of a domestic host control Panel, the compilation and installation of PHP when the log has the following error record:
Virtual Memory Exhausted:cannot Allocate memory
Make: * * * [Ext/fileinfo/libmagic/apprentice.lo] Error 1
The first solution is to close a lot of processes first, such as httpd, FTPD, SendMail, and so on, releasing a portion of the memory, and then compiling, still get the same compilation error. Later Baidu Google a long time to find a solution to the problem, but also found on the Php.net solution, the original link is: https:? bugs.php.net/bug.php?id=48809
Workaround:
Add quotation marks to the PHP installation configuration file (excluding quotation marks) "--disable-fileinfo"
then re-compile the installation and finally compile the pass.