Created
January 13, 2024 09:27
-
-
Save erdum/ca8c6617639f80bd9bd60da6547bb786 to your computer and use it in GitHub Desktop.
Extract tar file with PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$tarFile = __DIR__ . '/file.tar'; | |
$extractTo = __DIR__ . '/'; | |
exec("tar -xf $tarFile -C $extractTo", $output, $returnCode); | |
if ($returnCode === 0) { | |
echo 'Extraction successful!'; | |
} else { | |
echo 'Extraction failed!'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment