Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 22nd, 2012  |  syntax: None  |  size: 0.67 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Running PHP from command line
  2. <?php
  3. $cmd = "ffmpeg inpupt.mpg output.m4v";
  4.  
  5. exec($cmd . ' 2>&1', $output, $return);
  6.  
  7. //Page continues...but not executed
  8. $update = mysql_query("UPDATE.....");
  9. ?>
  10.        
  11. <?php system( 'sh test.sh >/dev/null &' ); ?>
  12.        
  13. <!--
  14.     saving standard output to a file
  15.     very important when your process runs in background
  16.     as this is the only way the process can error/success
  17. -->
  18. <?php system( 'sh test.sh >test-out.txt &' ); ?>
  19. <!--
  20.     saving standard output and standard error to files
  21.     same as above, most programs log errors to standard error hence its better to capture both
  22. -->
  23. <?php system( 'sh test.sh >test-out.txt 2>test-err.txt &' ); ?>