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
https://forums.phpfreaks.com/topic/262273-exec-command-but-not-wait-for-it/
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.