Home > Backend Development > PHP Tutorial > 编译安装php时碰到virtual memory exhausted: Cannot allocate memory

编译安装php时碰到virtual memory exhausted: Cannot allocate memory

WBOY
Release: 2016-06-13 12:31:22
Original
1020 people have browsed it

编译安装php时遇到virtual memory exhausted: Cannot allocate memory

有时候用vps建站时需要通过编译的方式来安装主机控制面板。对于大内存的VPS来说一般问题不大,但是对于小内存,比如512MB内存的VPS来说,很有可能会出现问题,因为编译过程是一个内存消耗较大的动作。
本人近期就遇到一个这样的问题:在512MB内存centos操作系统的VPS上编译安装某国内主机控制面板,在编译安装php时日志中有如下错误记录:
virtual memory exhausted: Cannot allocate memory
make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1

开始时的解决方法是先将很多的进程关闭,比如httpd、ftpd、sendmail等等,释放出了一部分内存后,再进行编译,仍然得到同样的编译错误。后来百度谷歌了很久才找到解决问题的方法,而且是在php.net上找到的解决方法,原文链接是:https:? //bugs.php.net/bug.php?id=48809

解决方法:

将php安装配置文件中加了引号中的配置(不包括引号)“--disable-fileinfo”

然后重新进行编译安装,终于编译通过。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template