So I am creating a PHP script that uploads an image from my local environment to a remote server. I have my SSH keys set up on both ends and if I simply execute the scp command in terminal it sometimes does not ask for password and sometimes it does. Also, for some reason, it takes about 30-60 seconds to return a result of the scp command.
<?php $result = system("scp /home/pi/camImage1.jpg username@<myserver>:~/public_html/folder1/innerfolder/camImage.jpg"); echo $result; ?>
Whenever I use it on the php side, it always asks for password. Any suggestions on what the heck is going on?