I
I
Ivan Sergeev2017-05-08 18:35:22
linux
Ivan Sergeev, 2017-05-08 18:35:22

Why is the archive not being created?

On the hosting, a copy of the files and site database is created using the system () commands;
Code snippet:

$cmd = "cd ".$this->getProjectDir()."/folders && tar rvf public_html.tar ".$dir['public_html'];
system($cmd, $ret);
$cmd = "cd ".$this->getProjectDir()." && find . -type f -exec tar rvf ".$this->archive.".tar '{}' \;";
system($cmd, $ret);
$cmd = "cd ".$this->getProjectDir()." && gzip ".$this->archive.".tar";
system($cmd, $ret);

Everything goes fine, but the archive turns out to be "broken" - when unzipping, an error occurs
2017-05-08-1494256895.tar.gz: Unexpected end of archive
The script itself works completely, possible limits on execution time and memory are increased.
What could be the reason for this failure?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex Teterin, 2017-05-09
@errogaht

try to make an archive in the terminal without PHP - will it be the same?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question