Thanks, jj_0 and deepo.
I've tried both of your suggestions.
When I try jj_0's suggestion, a funny thing happens. Nothing gets saved in "/tmp/scp.log". There is no such file.
So, I created an empty file, with the same name. It remains empty after running the PHP program.
Your suggestion was a good one. It makes me think that the command isn't being executed, at all, for some reason.
When I tried deepo's suggestion, for Samba, I get a similar response, in that things don't go far enough to provide any sort of error message from the "error_get_last()" function. Instead, I get the "HTTP Error 500" error message, from the browser, itself. It says that the page isn't working.
The good news is that I seem to have found a workaround, that doesn't involve using PHP or Samba, in order to transfer this file.
PHP can already move a file to a local directory. So, I've decided to write another program, that runs, outside of PHP, to transfer that file, on its own. It's a bit of a relay program that simply looks for the file that PHP provides, locally. Once that file shows up, in a local directory, I use my other program to perform an external file transfer across the network. Because it's outside of PHP, I can write this relay program in whichever programming language that I choose. Transferring files, over a network, works, in other programming languages. So, I've just done it in one of those other languages.
In any case, I want to thank all of you for your willingness to help. I greatly appreciate the time and attention that you've, all, been willing to give.
I've tried both of your suggestions.
If you change the exec line to:Are there any error messages in /tmp/scp.log?Code:
exec("sshpass -p 'raspberry' scp /var/www/html/files/worker1/testfile.txt pi@192.168.10.3:/home/pi/Base/work/worktable >/tmp/scp.log 2>&1");
When I try jj_0's suggestion, a funny thing happens. Nothing gets saved in "/tmp/scp.log". There is no such file.
So, I created an empty file, with the same name. It remains empty after running the PHP program.
Your suggestion was a good one. It makes me think that the command isn't being executed, at all, for some reason.
When I tried deepo's suggestion, for Samba, I get a similar response, in that things don't go far enough to provide any sort of error message from the "error_get_last()" function. Instead, I get the "HTTP Error 500" error message, from the browser, itself. It says that the page isn't working.
The good news is that I seem to have found a workaround, that doesn't involve using PHP or Samba, in order to transfer this file.
PHP can already move a file to a local directory. So, I've decided to write another program, that runs, outside of PHP, to transfer that file, on its own. It's a bit of a relay program that simply looks for the file that PHP provides, locally. Once that file shows up, in a local directory, I use my other program to perform an external file transfer across the network. Because it's outside of PHP, I can write this relay program in whichever programming language that I choose. Transferring files, over a network, works, in other programming languages. So, I've just done it in one of those other languages.
In any case, I want to thank all of you for your willingness to help. I greatly appreciate the time and attention that you've, all, been willing to give.
Statistics: Posted by evansste — Thu Jul 17, 2025 8:16 am