Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Location
    Toronto, ON, Canada
    Posts
    1,443

    [PHP] Unable to allocate memory .. apache or php problem ?

    I have a PHP script which is using exec() to call flvtool2 to insert meta data into a flv file. However, I am running into a problem where the ruby is having trouble allocating memory


    ERROR: failed to allocate memory
    ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flv/tag.rb:51:in `read'
    ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flv/tag.rb:51:in `initialize'
    ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flv/stream.rb:449:in `new'
    ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flv/stream.rb:449:in `read_tags'
    ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flv/stream.rb:58:in `initialize'
    ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:272:in `new'
    ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:272:in `open_stream'
    ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:238:in `process_files'
    ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:225:in `each'
    ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:225:in `process_files'
    ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:44:in `execute!'
    ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2.rb:168:in `execute!'
    ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2.rb:228
    ERROR: /usr/local/bin/flvtool2:2:in `require'
    ERROR: /usr/local/bin/flvtool2:2

    I have tried setting the memory_limit = 1024M but it is no help. But when I tried to run the script via shell, it is able to finish the job.

    PHP Code:
                $flvtool "/usr/local/bin/flvtool2 b.flv -DU > log.txt";
                echo 
    exec("$flvtool"); 
    So Is there anything I'm missing or a php value I should set before running flvtool2? The video file is around 270MB. Smaller file doesn't seem to have such problem.
    VimHost█ Providing Web Hosting since 2003: 13 Years of Dedication to our customers ~ Premium Hosting in Canada
    Email Hosting | RTMP Hosting | FFMPEG Hosting

  2. #2
    Join Date
    Feb 2008
    Location
    Houston, Texas, USA
    Posts
    2,955
    Perhaps the size of memory apache is consuming + the size of php is larger than free memory available. If that's not the case, add these in your /etc/init.d/httpd and restart apache (or whichever startup script you're using for httpd):

    Code:
    ulimit -m unlimited
    If that works, replace unlimited with a reasonable value instead.

    Regards
    UNIXy - Fully Managed Servers and Clusters - Established in 2006
    [ cPanel Varnish Nginx Plugin ] - Enhance LiteSpeed and Apache Performance
    www.unixy.net - Los Angeles | Houston | Atlanta | Rotterdam
    Love to help pro bono (time permitting). joe > unixy.net

  3. #3
    Join Date
    Feb 2004
    Location
    Toronto, ON, Canada
    Posts
    1,443
    Found the problem. It's the RLimitMem in the apache conf that is killing it. Thanks for the suggestion tho.
    VimHost█ Providing Web Hosting since 2003: 13 Years of Dedication to our customers ~ Premium Hosting in Canada
    Email Hosting | RTMP Hosting | FFMPEG Hosting

Similar Threads

  1. iconv: unable to allocate buffer for input: Cannot allocate memory
    By Ba$im in forum Hosting Security and Technology
    Replies: 12
    Last Post: 07-01-2009, 02:56 AM
  2. Cannot allocate memory
    By hbhb in forum Hosting Security and Technology
    Replies: 19
    Last Post: 03-22-2007, 01:01 AM
  3. Cannot allocate memory
    By Ks Jeppe in forum Hosting Security and Technology
    Replies: 10
    Last Post: 03-13-2006, 04:26 PM
  4. "unable to allocate memory for temp"
    By killer15669 in forum Programming Discussion
    Replies: 1
    Last Post: 05-02-2005, 01:03 PM
  5. FATAL: emalloc(): Unable to allocate 570958915 bytes
    By sprintserve in forum Hosting Security and Technology
    Replies: 4
    Last Post: 05-19-2004, 10:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •