I am trying to output mysql columns to txt-file using php script, the query works fine on mysql but fails on php. When clicked on the button the function returns Internal Server error.
function RsyncFTPAction() {
$sql = "SELECT CONCAT("sshpass -p ""Password"" rsync -avvtzh -e ""ssh -o StrictHostKeyChecking=no"" --log-file=""/home/toor/rsync2.log""", login,"@", ftp_addr, " :", camera_name,"/", "/",'home',"/",login, "/", camera_name)
FROM inteliviz.cameras order by id INTO OUTFILE '/tmp/wptitles2.csv' LINES TERMINATED BY '\r\n'";
$result = $conn->Execute($sql);
if(!$result) {
print $conn -> ErrorMsg(); ;
exit;
}
}