I am trying to start a tshark process capturing on the interface wlan0 for 5 minutes. As read in other threads I tried to direct output to a file like this:
$log = "sniff-".date("Y-m-d-H-i-s").".txt";
system("sudo tshark -i wlan0 -a duration:300 > /var/www/log".$log);
I was expecting the webserver to start the tshark process and move on. In the error log of the apache I can see the normal output of tshark:
Running as user "root" and group "root". This could be dangerous
Capturing on wlan0
6 packets captured
What do I have to change for tshark to output into this log file and not interrupt the php script? Does a & suffice and if yes, where do I have to put it?
Solution:
system("sudo tshark -i wlan0 -a duration:300 > /var/www/log".$log." &");