No speed difference found when running exec(scp) in the background

tirengarfio

New member
Hi,

I'm trying to copy asyncronously 10 70 MB video files.

PHP:
exec("scp -o StrictHostKeyChecking=accept-new -i /var/keys/devDevices_rsa MarTianez1.mp4 awong@10.1.1.16:/tmp/test1 2>&1 > out.log", $output, $exitCode);
    ...
    exec("scp -o StrictHostKeyChecking=accept-new -i /var/keys/devDevices_rsa MarTianez10.mp4 awong@10.1.1.16:/tmp/test10 2>&1 > out.log", $output, $exitCode);

But I cannot see any difference if I remove `2>&1 > out.log`'s from the scp commads.

PHP 8.1, Apache2, Ubuntu 22
 
Last edited:
I think it is happening because of syntax error, can you try below code, I hope it can fix the error.

exec("scp -o StrictHostKeyChecking=accept-new -i /var/keys/devDevices_rsa MarTianez1.mp4 awong@10.1.1.16:/tmp/test1 > out1.log 2> err1.log", $output1, $exitCode1);
// ...
exec("scp -o StrictHostKeyChecking=accept-new -i /var/keys/devDevices_rsa MarTianez10.mp4 awong@10.1.1.16:/tmp/test10 > out10.log 2> err10.log", $output10, $exitCode10);

Thanks
 
Back
Top