Skip to content
4.6

Gebruik van de PHP zip functie zonder exec

Omdat het niet mogelijk is op onze servers om de functie exec uit te voeren hierbij een voorbeeld hoe je binnen PHP gebruik kunt maken van zipfiles zonder dat je via exec de unzip en zip functie van het OS aan hoeft te spreken. Sla deze code op als testzip.php in bijvoorbeeld de public_html directorie.

<?
echo 'Test aanmaken zipfile';

$zip = new ZipArchive();
$filename = "./test.zip";

if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) {
exit("Het lukt niet om <$filename> te openen, heb je wel schrijfrechten ?\n");
}

$zip->addFile("./testzip.php","/testzip.php");
echo "Aantal bestanden in de zipfile: " . $zip->numFiles . "\n";
echo "De status:" . $zip->status . "\n";
$zip->close();
?>

Was this article helpful?

← Back to Hosting algemeen

One moment…

Set up your domains

For each domain, arrange the nameservers, the link to your hosting and who becomes the owner.

Loading your domains…