ballouta Posted June 20, 2008 Share Posted June 20, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/111062-zip-archive-warning/ Share on other sites More sharing options...
Stephen Posted June 20, 2008 Share Posted June 20, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/111062-zip-archive-warning/#findComment-569952 Share on other sites More sharing options...
ballouta Posted June 20, 2008 Author Share Posted June 20, 2008 the phpzip is a new built in functions (as I know) but i chmodded the folders to 777 i will see what happends thanks Quote Link to comment https://forums.phpfreaks.com/topic/111062-zip-archive-warning/#findComment-570025 Share on other sites More sharing options...
ballouta Posted June 20, 2008 Author Share Posted June 20, 2008 I set the folders permissions to 777 but the files extraced are all 0KB!!! why? please help Quote Link to comment https://forums.phpfreaks.com/topic/111062-zip-archive-warning/#findComment-570155 Share on other sites More sharing options...
ballouta Posted June 20, 2008 Author Share Posted June 20, 2008 any help please Quote Link to comment https://forums.phpfreaks.com/topic/111062-zip-archive-warning/#findComment-570275 Share on other sites More sharing options...
MadTechie Posted June 20, 2008 Share Posted June 20, 2008 Add error_reporting(E_ALL); at the start, Any errors? Quote Link to comment https://forums.phpfreaks.com/topic/111062-zip-archive-warning/#findComment-570294 Share on other sites More sharing options...
ballouta Posted June 20, 2008 Author Share Posted June 20, 2008 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! Quote Link to comment https://forums.phpfreaks.com/topic/111062-zip-archive-warning/#findComment-570339 Share on other sites More sharing options...
MadTechie Posted June 20, 2008 Share Posted June 20, 2008 You sure the zip is okay ? download it an confirm (don't try the local copy you uploaded, re-download) Quote Link to comment https://forums.phpfreaks.com/topic/111062-zip-archive-warning/#findComment-570364 Share on other sites More sharing options...
DarkWater Posted June 20, 2008 Share Posted June 20, 2008 Also, post the extractTo function for us to look. By the way, you can chmod the folders to 755 because you'll never need to execute a folder. The 3rd bit for permissions means 'execute'. Quote Link to comment https://forums.phpfreaks.com/topic/111062-zip-archive-warning/#findComment-570369 Share on other sites More sharing options...
MadTechie Posted June 20, 2008 Share Posted June 20, 2008 ZipArchive is an extension that comes with PHP see the manual here Muhahah touché It maybe an idea to check the zlib (http://www.zlib.net/) or even try reinstalling see here have you tried another zip file, compressed with the windows compressor (assuming your on windows) or even compress a file using zlib Quote Link to comment https://forums.phpfreaks.com/topic/111062-zip-archive-warning/#findComment-570377 Share on other sites More sharing options...
ballouta Posted June 20, 2008 Author Share Posted June 20, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/111062-zip-archive-warning/#findComment-570383 Share on other sites More sharing options...
MadTechie Posted June 20, 2008 Share Posted June 20, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/111062-zip-archive-warning/#findComment-570385 Share on other sites More sharing options...
ballouta Posted June 20, 2008 Author Share Posted June 20, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/111062-zip-archive-warning/#findComment-570407 Share on other sites More sharing options...
DarkWater Posted June 20, 2008 Share Posted June 20, 2008 If you read his post, you'll see that he said he'd upload it for you when he got home. Quote Link to comment https://forums.phpfreaks.com/topic/111062-zip-archive-warning/#findComment-570419 Share on other sites More sharing options...
ballouta Posted June 20, 2008 Author Share Posted June 20, 2008 yeah right, i didn't read well this time, i 'll be waiting thanks Quote Link to comment https://forums.phpfreaks.com/topic/111062-zip-archive-warning/#findComment-570456 Share on other sites More sharing options...
ballouta Posted June 20, 2008 Author Share Posted June 20, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/111062-zip-archive-warning/#findComment-570493 Share on other sites More sharing options...
ballouta Posted June 20, 2008 Author Share Posted June 20, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/111062-zip-archive-warning/#findComment-570519 Share on other sites More sharing options...
DarkWater Posted June 20, 2008 Share Posted June 20, 2008 There must be a file you didn't include or something. Quote Link to comment https://forums.phpfreaks.com/topic/111062-zip-archive-warning/#findComment-570526 Share on other sites More sharing options...
ballouta Posted June 20, 2008 Author Share Posted June 20, 2008 Since the hosting company asked me to use it, I thought it is supported and they have the needed files installed. Any help please Quote Link to comment https://forums.phpfreaks.com/topic/111062-zip-archive-warning/#findComment-570558 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.