모든 zpanel 백업을 Amazon S3 계정에 업로드하는 스크립트 작업을하고 있습니다. zpanel 백업을 사용하지 않고 CronJob을 사용하여 만든 백업을 만들고 업로드하면 작동합니다.이동 Zpanel 기본 백업 디렉토리 또는 Opendir 백업 디렉토리
zpanel 백업을 업로드 할 수없는 이유는 php opendir 기능을 사용하여 "백업"디렉토리에 접근하는 방법을 알 수 없기 때문입니다.
나는 백업 폴더의 절대 경로를 알고있다. 이 보인다 그리고이 절대 경로는 내가 사용했습니다 opendir()
작동하지 않습니다 : opendir('var/zpanel/hostdata/my_username/backups/')
그리고 그것은 작동하지 않습니다. 이제 상대 경로를 사용하려면 거기에 도달 할 수 없습니다.
그렇다면 zPanel Backups 디렉토리를 public_html 폴더의 어딘가에 옮길 수있는 방법이 있습니까? 또는 백업 폴더에 연결할 수있는 웹 URL? Ajaxplorer는 거기에 도달 할 수 있습니다, 왜 못합니까?
아무도 없으면 zPanel (모든 DB + 모든 항목이 public_html 폴더 안에 있음)과 같은 백업을 만드는 방법을 누군가에게 가르쳐 주시면 대단히 감사하겠습니다.
코드는 사전에이 같은
require_once('S3.php');
// Enter your amazon s3 creadentials
$s3 = new S3('xxxxx', 'xxxxx');
if ($handle = opendir('var/zpanel/hostdata/my_username/backups/')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
//echo "okay";
echo $file; exit;
if ($s3->putObjectFile("backups/$file", "my_basket", "$file", S3::ACL_PUBLIC_READ)) {
echo "<strong>We successfully uploaded your file.<br /></strong>";
//this will delete the file from your server after upload
//if (file_exists($baseurl . '/' . $file)) { unlink ($baseurl . '/' . $file); }
}else{
echo "<strong>Something went wrong while uploading your file... sorry.</strong>";
}
}else{
echo "No file found here ".$root;
}
}
closedir($handle);
}
덕분에 많이 보인다!