Koozali.org: home of the SME Server
Other Languages => Français => Topic started by: Dominique on December 19, 2012, 04:09:44 PM
-
Sous wamp j'ai utilisé la classe ZipArchive en modifiant le php.ini (decommenter le php_zip). Une fois la page php créé chargé sur le sme server la classe n'est pas trouvée. Comment valider la classe sous le server sme pour pouvoir zipper des fichiers ou existe t'il d'autre classe zip utilisable ?
Merci de votre aide.
-
I found a script online and modified it to test ZipArchive on my SME servers.
On SME 8, the script works without any server changes.
On SME 7.6, the script will not run.
To test:
1) Create <ibay>
2) cd /home/e-smith/files/ibays/<ibay>/html
3) create folder "ziptest"
4) put some files in "ziptest"
5) create /home/e-smith/files/ibays/<ibay>/html/ztest.php (content shown below)
6) browse to http://<mysmeserver>/<ibay>/ztest.php
7) Test the results using "unzip -l /home/e-smith/files/ibays/<ibay>/html/my-archive.zip"
Contents of "ztest.php":<?php
// Adding files to a .zip file, no zip file exists it creates a new ZIP file
// increase script timeout value
ini_set('max_execution_time', 5000);
// create object
$zip = new ZipArchive();
// open archive
if ($zip->open('my-archive.zip', ZIPARCHIVE::CREATE) !== TRUE) {
die ("Could not open archive");
}
// initialize an iterator
// pass it the directory to be processed
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator("ziptest/"));
// iterate over the directory
// add each file found to the archive
foreach ($iterator as $key=>$value) {
$zip->addFile(realpath($key), $key) or die ("ERROR: Could not add file: $key");
}
// close and save archive
$zip->close();
echo "Archive created successfully.";
?>
Avec de la chance ça vous donnera ce qu'il vous faut...
-
Thanks mmccarn for your answer.
Unfortunately, the SME server is not at the last version.
Following your answer it's the reason why it doesn't work.
I found a trick to use instead the linux Zip embeded on the sme server.
On php file I use the command "shell_exec('zip ...." with options which are available with the man list.
It works well for my use.
I wish you a Merry Christmas.
Regards