Well now the program will produce the new directory. Owned/Group by www-data.
I don't know now whether to create a new THREAD but I think this is connected to the original topic. Please correct me if I should create a new THREAD.
The next phase is copying the files from the Camera's SD Card. this is done by:
Code: Select all
$cmd= "rsync -avz ".$src." ".$transDir; // From Photo Source to Transfer Directory
shell_exec($cmd); // Store Photos in Transfer Directory on Desktop
This works correctly(shell_exec($cmd) works) and the photos are transfered TO /home/rick/Desktop/2017Jul10-12:34_TransFile_102CANON/102CANON. Owned/Group by www-data.
Next all Image files are renamed in directory /102CANON with the Creation Date of the Image.
Example : From IMG_8581.JPG To 2017Jun01-13:01_IMG_8581.JPG. Owned/Group by www-data.
The significance of this to me is that the files are manipulated (moved by shell_exec( using rsync ))while being Owned/Group by www-data.
The next step, Copying the renamed images to two different Directories on my hard drive, has a problem.
The two echo shell_exec($cmd) calls to rsync will not copy the files.
Nothing is echoed.
If I
run this program in a terminal it all works: A directory is created on Desktop, the photo files are transfered to this directory, the files in this directory are renamed, and then the renamed files are transfered to two other directories on the hard drive.
I am wondering
when running this program in the browser if the rsync command is messed up by improper permissions. I note that when the program is run in a terminal the end result directories are Owned by $user with proper permissions.
Sorry this is such a long explanation, but I am going batty trying to figure this out !!
Code: Select all
if($copyPhoto) {
storeTransFolderContents($transDir, $user);
}
Code: Select all
// storeTransFolderContents() ... Send Photos To /VB-share/00-Process - /Pictures/00-Process ================
function storeTransFolderContents($renameDir, $user) {
$cmd= "rsync -az --stats ".$renameDir." /home/".$user."/Pictures/00-Process";
echo shell_exec($cmd); // returns ""
$cmd2= "rsync -az --stats ".$renameDir." /home/".$user."/VB-share/00-Process";
echo shell_exec($cmd2); // returns ""
//$cmd= "rsync -az --stats --dry-run ". $renameDir." /home/".$user."/Pictures/00-Process";
//$cmd2= "rsync -az --stats --dry-run ". $renameDir." /home/".$user."/VB-share/00-Process";
} // end function ========================