WorldDrknss Posted October 8, 2007 Share Posted October 8, 2007 I am trying to get a shell_exec command to run in the background. So far I have tried: $ret = shell_exec($ffmpegcmd1." >NUL 2>&1"); $ret = shell_exec($ffmpegcmd1." >NUL 2>&1 &"); $ret = shell_exec($ffmpegcmd1." >NUL"); without any luck. Quote Link to comment https://forums.phpfreaks.com/topic/72288-shell_exec-background-process-windows/ Share on other sites More sharing options...
WorldDrknss Posted October 8, 2007 Author Share Posted October 8, 2007 :bump: Quote Link to comment https://forums.phpfreaks.com/topic/72288-shell_exec-background-process-windows/#findComment-364898 Share on other sites More sharing options...
lessthanthree Posted October 8, 2007 Share Posted October 8, 2007 What are you trying to do? What does $ffmpegcmd1 contain? What are you doing with $ret? Any Errors? Does your PHP ini allow shell exec? Quote Link to comment https://forums.phpfreaks.com/topic/72288-shell_exec-background-process-windows/#findComment-364915 Share on other sites More sharing options...
WorldDrknss Posted October 8, 2007 Author Share Posted October 8, 2007 shell_exec does work since it is converting the videos and thumbnails. I do not receive any errors, but what I am trying to do is get the process to run in the background so that it will not hang up PHP. function convertmedia($filename){ $inputdir = "../../media/vgallery/originals"; $outputdir = "../../media/vgallery/flv"; $samplerate = "22050"; $bitrate = "32"; $size = "400x300"; $ext = substr($filename, strrpos($filename, '.') + 0); $strext = str_replace($ext, "", $filename); $outfile = time()."_".$strext.".flv"; $ffmpegcmd1 = "ffmpeg -i ".$inputdir."/".$filename." -acodec mp3 -ar ".$samplerate." -ab ".$bitrate." -f flv -s ".$size." ".$outputdir."/".$outfile; error_reporting(E_ALL); $ret = shell_exec($ffmpegcmd1); echo $ffmpegcmd1."<br />"; return $outfile; } Quote Link to comment https://forums.phpfreaks.com/topic/72288-shell_exec-background-process-windows/#findComment-364924 Share on other sites More sharing options...
WorldDrknss Posted October 9, 2007 Author Share Posted October 9, 2007 bump Quote Link to comment https://forums.phpfreaks.com/topic/72288-shell_exec-background-process-windows/#findComment-365736 Share on other sites More sharing options...
MadTechie Posted October 9, 2007 Share Posted October 9, 2007 try a background task ie $ret = shell_exec('start /B "converting" "'.$ffmpegcmd1.'"'); Quote Link to comment https://forums.phpfreaks.com/topic/72288-shell_exec-background-process-windows/#findComment-365749 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.