Jump to content

Zip Archive Warning


ballouta

Recommended Posts

Hello

I am tryint to extract a zip archive to an exisiting directory but i got this line:

 

Warning: ZipArchive::extractTo() [function.ZipArchive-extractTo]: Permission denied ... on line 113

 

the function is:

 

$zip = new ZipArchive;

if ($zip->open("$myf") === TRUE) {

    $zip->extractTo('/stk/temp/');

    $zip->close();

    echo 'ok';

} else {

    echo 'failed';

}

 

I just checked the directory temp from my FTP. No extracted file.

Do I have to change smthg in permissions? How? i don't have any idea.

 

thanks

 

Link to comment
Share on other sites

Can you post the ZipArchive class? (more importantly I guess the extractTo function).

 

EDIT: And also try chmodding the directory to 777... when you right click the folder in FTP it should give the option to CHMOD. Just type in 777.

Link to comment
Share on other sites

i added it but nothing new:

 

$zip = new ZipArchive;

if ($zip->open("$myf") === TRUE) {

error_reporting(E_ALL);

    $zip->extractTo('/home/gsclteam/public_html/stk/temp/');

    $zip->close();

    echo 'ok, the file was extracted';

} else {

    echo 'failed';

}

 

the files extracted still each 0 KB! :(

 

Link to comment
Share on other sites

the company i am hosting at has installed the php zip module for me.

i don't know if they are problem or not, i am still waiting for a reply from them,

the original zip file is NOT damaged, and the one attached to the message is also correct

I download it and it was working correctly.

 

do u think the host server has a problem?

anyway i relay on your help rather than the hosting company.

I changd the folders permission to 755, the problem still the same

 

thanks and please keep in touch

Link to comment
Share on other sites

Try this

Download file attached, and put in the same folder and update your script to this

 

<?php
$myf = "filename.zip";
require_once dirname(__FILE__)."/dUnzip2.inc.php";
$zip = new dUnzip2($myf);
$zip->getList();
$zip->unzipAll('/home/gsclteam/public_html/stk/temp/');
?>

 

i have to make my way home now, but i hope this help

 

EDIT: wrong file.. will post correct one from home

Link to comment
Share on other sites

Hi

 

I uploaded a good zip archive file and i updated my script but I got these lines

 

Warning: require_once(/home/gsclteam/public_html/dUnzip2.inc.php) [function.require-once]: failed to open stream: No such file or directory in /home/gsclteam/public_html/check3.php on line 122

 

Fatal error: require_once() [function.require]: Failed opening required '/home/gsclteam/public_html/dUnzip2.inc.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/gsclteam/public_html/check3.php on line 122

 

I didn't understand anything. What is ./dUnzip2.inc.php?

 

 

Link to comment
Share on other sites

let us pause prvious replies in this post and begin from here please

 

those bad hosting company jusy told me that the zip php is NOT installed on my reseller server...

although they told me before that this module was installed for me, I spent all my day trying to discover this problem...

Anyway, the hosting support asked me to do the following:

 

"Please modify your codes to use pecl based zip module and pear based Archive_Zip module."

 

I know nothing about pecl based zip ...

would you provide easy help please  :(

Link to comment
Share on other sites

Hi again

 

i found a nice clear example on google:

 

<?php

$zip = zip_open("Desktop.zip");

if ($zip) {

    while ($zip_entry = zip_read($zip)) {
        echo "Name:               " . zip_entry_name($zip_entry) . "\n";
        echo "Actual Filesize:    " . zip_entry_filesize($zip_entry) . "\n";
        echo "Compressed Size:    " . zip_entry_compressedsize($zip_entry) . "\n";
        echo "Compression Method: " . zip_entry_compressionmethod($zip_entry) . "\n";

        if (zip_entry_open($zip, $zip_entry, "r")) {
            echo "File Contents:\n";
            $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
            echo "$buf\n";

            zip_entry_close($zip_entry);
        }
        echo "\n";

    }

    zip_close($zip);

}

?> 

 

where Desktop.zip is a good uploaded zip archive but I got this error!! Does this mean that this is also not installed on the server?

 

Fatal error: Call to undefined function zip_open() in /home/gsclteam/public_html/check3.php on line 139

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.