在美国vps上编译vps遇到一个报错:Cannot allocate memory
一、编译php时遇到virtual memory exhausted: Cannot allocate memory解决方法如下:
0 1 2 |
./configure --enable-opcache --prefix=/byrd/server/php-5.5.11 --with-mysql=/usr/local/mysql/ --with-iconv-dir=/usr/local/libiconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=www --with-fpm-group=www --enable-ftp 增加这个参数:--disable-fileinfo |
二、在执行free -m的是时候提示Cannot allocate memory:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
[root@Byrd byrd]# free -m total used free shared buffers cached Mem: 512 108 403 0 0 28 -/+ buffers/cache: 79 432 Swap: 0 0 0 [root@Byrd ~]# mkdir /opt/images/ [root@Byrd ~]# rm -rf /opt/images/swap [root@Byrd ~]# dd if=/dev/zero of=/opt/images/swap bs=1024 count=2048000 2048000+0 records in 2048000+0 records out 2097152000 bytes (2.1 GB) copied, 82.7509 s, 25.3 MB/s [root@Byrd ~]# mkswap /opt/images/swap mkswap: /opt/images/swap: warning: don't erase bootbits sectors on whole disk. Use -f to force. Setting up swapspace version 1, size = 2047996 KiB no label, UUID=59daeabb-d0c5-46b6-bf52-465e6b05eb0b [root@hz mnt]# swapon /opt/images/swap [root@hz mnt]# free -m total used free shared buffers cached Mem: 488 481 7 0 6 417 -/+ buffers/cache: 57 431 Swap: 999 0 999 内存太小,增加内存可以解决。 |
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!