When compiling and installing php, virtualmemoryexhausted: Cannotallocatememory sometimes needs to be compiled to install the host control panel when using vps to build a website. For VPS with large memory, it is generally not a problem, but for small memory, such as VPS with MB memory, it is very likely that there will be problems, because virtual memory exhausted is encountered during php compilation and installation: cannot allocate memory
Sometimes, you need to compile the host control panel to build a website using vps. For VPS with large memory, it is generally not a problem, but for small memory, such as VPS with MB memory, it is very likely that the compilation process is a large memory consumption action.
I recently encountered such a problem: compile and install a domestic host control panel on the VPS of the centos 512MB memory. the following error records are displayed in the logs when compiling and installing php:
Virtual memory exhausted: Cannot allocate memory
Make: *** [ext/fileinfo/libmagic/apprentice. lo] Error 1
At the beginning, the solution is to first shut down many processes, such as httpd, ftpd, and sendmail, and release some of the memory before compilation, and still get the same compilation error. Later, Baidu Google found a solution to the problem after a long time, and found a solution on php.net. The original article link is: https :? // Bugs.php.net/bug.php? Id = 48809
Solution:
Add the configuration (excluding the quotation marks) "-- disable-fileinfo" in the php installation configuration file"
Then re-compile and install it, and finally compile it.