Jump to content

exec command but not wait for it?


Imaulle

Recommended Posts

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');

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.