Imaulle Posted May 8, 2012 Share Posted May 8, 2012 is there a way to excute the system() command here but not wait for it and just let it go in the background? And something that wont boggle down the system too much? Thanks! $this->db->insert('jukebox', $data); echo '1'; system('ffmpeg -i ' . $id . '.mp3 -acodec libvorbis -aq 60 ' . $id . '.ogg'); Quote Link to comment https://forums.phpfreaks.com/topic/262273-exec-command-but-not-wait-for-it/ Share on other sites More sharing options...
.josh Posted May 8, 2012 Share Posted May 8, 2012 php does not have multi-threading capabilities. closest it has is forking which isn't exactly the same thing. One alternative is to write a separate script that does nothing but the system command and have the arguments pulled from a flatfile or something, and this script here just update the flatfile with the command to run. And then set the other script that's actually running to be on a cron job every minute or so and look for the command in the flatfile, run it and then delete the line from the flatfile (so that next time it is run it won't run the system command). IOW basically a queuing system for the system command. Quote Link to comment https://forums.phpfreaks.com/topic/262273-exec-command-but-not-wait-for-it/#findComment-1344101 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.