Hello Monks,
I'm using archive::zip to create a zip file. My code works fine when run as a perl script but when I try to run the same code as a cgi I cannot write the output file.
I get a number 4 I/O error and $! says "permission denied". I'm using exactly the same files and folders in both cases. The only difference I can see is that the script that works is run as a local non-root user and the other is www apache, All my other cgi scripts happily write to these folders but archive::zip won't.
my $zip = Archive::Zip->new();
# add all readable files and directories below . as xyz/*
$zip->addTree( '/delme/wibble', 'customer_uploads' );
$zip->addFile( '/delme/wibble.tif', 'wibble.tif' );
$zip->addFile( '/delme/wibble.gif', 'wibble.gif' );
# and write them into a file
$zip_return_code = $zip->writeToFileNamed('/delme/final_zipfile.zip
+');
if($zip_return_code != 0){ #an error occurred doing the zip
$html_string = $html_string . "Error creating zip file . . . $zip_
+return_code $! ";
}
No doubt I'm doing something dumb.
Would someone please enlighten me?
Thanks
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.