I am trying to create a tarball from a php5 script under Linux, and I don't really care for the output; the way I have so far found immediately is to simply
system("tar czf tarball.tgz directory/path &");
However I would like to background the process
Checking system() documentation it mentions having to redirect the output to file
However
system("tar czf tarball.tgz directory/path > /dev/null 2>&1");
doesn't help. The system()
function does not take a file descriptor... what am I missing?
Testing with these:
script test.php
<pre><?php
exec("bash dodate 2>&1 /dev/null &");
system("echo done at \$(date)");
?></pre>
Script ./dodate
sleep 5
date
I go to my browser and call/refresh the page; it takes indeed 5 seconds thenprints/updates the "done" message.
Thanks