i get a cpgz file when unziping a zip file !

Hi there,

i'm having a very annoying problem here. I am making the back office part of a client's website that has a zip file creation function.

the zip is created well but when unzipping, i get a very annoying .cpgz file which, when opened, gives me another zip file that also contains a cpgz file... in other words : a disaster

i have been searching through the net to find a solution or a lead but found none.

has anyone an idea as to what the problem could be ?

i'm using ubuntu jaunty 9.04 and the zip command through a php script
code is below, and the zip file attached

Cheers,


$zipRemoteFileName = "/var/www/teleskiDev/tmp/teleski" . $date . ".zip";
$zipLocalFileName = "teleski" . $date . ".zip"; 
$zipCommand = "sudo -u root zip -r $zipRemoteFileName ";

Open in new window

teleski100401213914.zip
LVL 1
terencepiresAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fabio MarzoccaFreelancerCommented:
The attached zip file is not valid.

First of all, you don't need to type "sudo -u root", as "sudo" is enough to get root grants.
Second, the correct zip syntax is:

zip -r <output_filename> <input_file/path>
0
terencepiresAuthor Commented:
hi,

sorry, i posted an incomplete code
full code is :
zip -r <output_filename> <file 1> <file 2> <file 3> <file 4> ...
0
Fabio MarzoccaFreelancerCommented:
yes, that should work. Try first from a console.
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

terencepiresAuthor Commented:
so, when unzipping from command line it works.
but :
- under windows winrar says the format is unknown or corrupt
- under mac os i get a cpgz file inside the zipped archive
0
Fabio MarzoccaFreelancerCommented:
Why you try to unzip it from winrar? It is not a rar format, but zip.

What do you need, a zip or a rar file?
0
terencepiresAuthor Commented:
zip, but winrar handles zip files as well
0
Fabio MarzoccaFreelancerCommented:
In windows I extract zip files with "Extract All..." from context menu. Don't know how to manage them with winrar. I have just tried and linux zip files are correctly extracting in windows. Don't have a Mac.

Which version of zip are you using? Latest is  3.0-1ubuntu1

dpkg -l zip
0
terencepiresAuthor Commented:
i just tried to TAR it, with same results.
the origin of the problem doesn't seem to be the command itself.
I have read something about filesystem incompatibilities, would that be possible ?
0
Fabio MarzoccaFreelancerCommented:
But if you zip/tar in linux, are you able to unzip/untar from linux itself?
0
terencepiresAuthor Commented:
well, the version i'm using is 2.32-1
0
terencepiresAuthor Commented:
But if you zip/tar in linux, are you able to unzip/untar from linux itself?

yes
0
terencepiresAuthor Commented:
i tried apt-get upgrade zip but the version i get is still the same...
0
Fabio MarzoccaFreelancerCommented:
Yes, the new version is in ubuntu 9.10
0
Fabio MarzoccaFreelancerCommented:
I see in your script "RemoteFileName". This means that you are zipping from a remote system? Not on local ubuntu 9.04?
0
terencepiresAuthor Commented:
ok, i also tried to tar it, rar it, 7zip it = same result...

the problem doesn't seem to be coming from the compression tool, but from something else on the server...
0
terencepiresAuthor Commented:
well the webserver is on an remote ubuntu system, on which the file is compressed then sent to the user
0
Fabio MarzoccaFreelancerCommented:
So, there should be something wrong on the webserver.
Do you have right permissions there?

You can watch on the server if you have errors from this command:

tar cpzf <output.tgz> <input_path>
0
terencepiresAuthor Commented:
so this didn't give me any output :
tar -cpzf arch.tgz <file 1> <file 2>

but this : tar -cpzf toto.tgz .
gave me : tar: ./toto.tgz: file changed as we read it
0
Fabio MarzoccaFreelancerCommented:
The first didn't give you any output as it successfully created the arch.tgz file. Is that file readable now?
0
terencepiresAuthor Commented:
yes, i get all the files that were in the tared directory
0
Fabio MarzoccaFreelancerCommented:
I mean: are you able to read them from windows?
0
terencepiresAuthor Commented:
no, it says the file is corrupt
0
Fabio MarzoccaFreelancerCommented:
what application are you using in windows?
0
terencepiresAuthor Commented:
winrar
0
Fabio MarzoccaFreelancerCommented:
I just did it on my side and it is working perfectly (from ubuntu --> windows).

Of course your file is NOT corrupted, otherwise ubuntu could not decompress it. Can you send me one tgz or zip file your windows is not opening? I would like to have a look.
0
terencepiresAuthor Commented:
Ok, here it is
testArch.zip
0
Fabio MarzoccaFreelancerCommented:
The file you attached is not a valid zip file. This is what I got from Linux:

"End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive."

So, it looks like your poblem is how do you build the zip file on the server, if the script has right permissions.
0
Fabio MarzoccaFreelancerCommented:
I have opened the file with an Hex Editor, and this is what I found inside:

"<br />
<b>Warning</b>:  filesize() [<a href='function.filesize'>function.filesize</a>]: stat failed for http://92.243.20.23/teleskiDev/tmp//testArch.zip in <b>/var/www/teleskiDev/ajax/iframe.php</b> on line <b>33</b><br />
<br />
<b>Warning</b>:  readfile(http://92.243.20.23/teleskiDev/tmp//testArch.zip) [<a href='function.readfile'>function.readfile</a>]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found

 in <b>/var/www/teleskiDev/ajax/iframe.php</b> on line <b>34</b><br />"

There is an error in your program!  As you can see there are several "Not found" errors.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
terencepiresAuthor Commented:
gosh !
thanks !!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Utilities

From novice to tech pro — start learning today.