Shell_exec not working in the background, any other solution?

I am using php in apache on CentOS. I have to serve users so that they can delete large files by click. trying to use shell_exec. but it does not work in the background. it starts and makes the user wait.

my team:

$ D_command = "rm -rf videos / '$ Mdelete'";

shell_exec ($ D_command);

thank!

+5
source share
5 answers

and at the end of the team.

$D_command="nohup rm -rf videos/'$Mdelete' > /log/deletedfile.log 2>&1 &";
+4
source
$PID = shell_exec("nohup $Command 2> /dev/null & echo $!");

http://php.net/manual/en/function.shell-exec.php

+3
source

rm -rf videos/'$Mdelete' &

exec. , .

0

:

popen($D_command, 'r')
0

I know that this is quite an old question, but I had the same problem, and that was the only working solution after the failure of the attempt and exec, shell_exec, process_open:

$process = popen("nohup $D_command > /dev/null 2> /dev/null & echo $!", 'r');
$pid = fread($process, 32);
0
source

All Articles