From: ibboard at gmail dot com Operating system: CentOS 4 PHP version: 5.3.0 PHP Bug Type: Compile Failure Bug description: "virtual memory exhausted: Cannot allocate memory" with libmagic/apprentice.c
Description: ------------ I'm trying to compile PHP 5.3 on a VPS with 256MB of memory, but I keep getting "out of memory" errors before 'make' completes. I've compiled 5.2.x on the VPS before and I've freed up over 170MB of my 256MB of memory, but still I get the following error (always the same file): virtual memory exhausted: Cannot allocate memory make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1 My host temporarily bumped my account up to 512MB of memory, but it still took all of the free memory before failing (350MB+). Disabling the extension that the file is from with "--disable-fileinfo" gets me beyond the error and continues without running out of memory (until it hits a different error in libgd, which I'm looking in to). May be similar to http://bugs.php.net/bug.php?id=48593, but crashes out with insufficient memory rather than hanging indefinitely. Reproduce code: --------------- $ wget http://uk2.php.net/get/php-5.3.0.tar.bz2/from/this/mirror $ tar -xjvf php-5.3.0.tar.bz2 $ cd php-5.3.0 $ ./configure --prefix=/usr/local/php5-fcgi --with-kerberos=/opt --with-layout=GNU --with-regex=php --with-gettext --enable-mbstring --enable-libxml --with-pcre-regex=/opt --with-imap=shared --with-imap-ssl --with-mysql=shared,/opt --with-mysqli=shared,/usr/bin/mysql_config --with-mysql-sock=/var/lib/mysql/mysql.sock --with-libxml-dir=/opt --enable-gd-native-ttf --with-gd=/opt --with-jpeg-dir=/opt --with-freetype-dir=/opt --with-mcrypt --with-zlib-dir=/opt --with-png-dir=/opt --with-config-file-scan-dir=/usr/local/etc/php.d $ make Expected result: ---------------- PHP compile to complete so that I can run "sudo make install". Actual result: -------------- [lots of compile output] ... /bin/sh /home/ibb_admin/temp/php-5.3.0/libtool --silent --preserve-dup-deps --mode=compile gcc -I/home/ibb_admin/temp/php-5.3.0/ext/fileinfo/libmagic -Iext/fileinfo/ -I/home/ibb_admin/temp/php-5.3.0/ext/fileinfo/ -DPHP_ATOM_INC -I/home/ibb_admin/temp/php-5.3.0/include -I/home/ibb_admin/temp/php-5.3.0/main -I/home/ibb_admin/temp/php-5.3.0 -I/home/ibb_admin/temp/php-5.3.0/ext/date/lib -I/home/ibb_admin/temp/php-5.3.0/ext/ereg/regex -I/usr/include/libxml2 -I/opt/include -I/opt/include/freetype2 -I/usr/include/imap -I/usr/kerberos/include -I/home/ibb_admin/temp/php-5.3.0/ext/mbstring/oniguruma -I/home/ibb_admin/temp/php-5.3.0/ext/mbstring/libmbfl -I/home/ibb_admin/temp/php-5.3.0/ext/mbstring/libmbfl/mbfl -I/opt/include/mysql -I/usr/include/mysql -I/home/ibb_admin/temp/php-5.3.0/ext/sqlite3/libsqlite -I/home/ibb_admin/temp/php-5.3.0/TSRM -I/home/ibb_admin/temp/php-5.3.0/Zend -I/usr/include -g -O2 -c /home/ibb_admin/temp/php-5.3.0/ext/fileinfo/libmagic/apprentice.c -o ext/fileinfo/libmagic/apprentice.lo virtual memory exhausted: Cannot allocate memory make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1 -- Edit bug report at http://bugs.php.net/?id=48809&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48809&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48809&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48809&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48809&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48809&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48809&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48809&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48809&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48809&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48809&r=support Expected behavior: http://bugs.php.net/fix.php?id=48809&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48809&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48809&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48809&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48809&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=48809&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48809&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48809&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48809&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48809&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48809&r=mysqlcfg