jagguy Posted December 28, 2006 Share Posted December 28, 2006 I have php4.4.4 and have enabled zip on php.ini. On phpinfo() is says zip is enabled on my winxp pc.I can't get any zip programs to work as whenever i use the word zip_open I get an error. I have asked this before everywhere and no one seems to have any idea .Does zip work at all in php4.4.4 or is there a bug. Should I use php5 and zip instead? Link to comment https://forums.phpfreaks.com/topic/32121-solved-zip/ Share on other sites More sharing options...
trq Posted December 29, 2006 Share Posted December 29, 2006 What is the error your getting? Link to comment https://forums.phpfreaks.com/topic/32121-solved-zip/#findComment-149065 Share on other sites More sharing options...
jagguy Posted December 29, 2006 Author Share Posted December 29, 2006 [quote author=thorpe link=topic=120211.msg492885#msg492885 date=1167351996]What is the error your getting?[/quote]Warning: zip_open() Cannot open zip archive ./test1.zip in C:\www\php\test\zip1.php on line 5test1.zip works and was created with winzip, and is in the same directory. Also I tried in different dir and using just 'test1.zip' and as many combinations as possible. NO zip commands are recognized as it doesn't know what zip is, even though it is enabled in php.ini and phpinfo(). Link to comment https://forums.phpfreaks.com/topic/32121-solved-zip/#findComment-149115 Share on other sites More sharing options...
printf Posted December 29, 2006 Share Posted December 29, 2006 Could you please show your script.printf Link to comment https://forums.phpfreaks.com/topic/32121-solved-zip/#findComment-149117 Share on other sites More sharing options...
corbin Posted December 29, 2006 Share Posted December 29, 2006 Make sure theyre in the same directory and run[code=php:0]$file = "test1.zip";if(file_exists($file)) {if(function_exists('zip_open') {if(zip_open($file)) {echo "it opened!";}else {echo "darn, didnt open";}}else {die("problem with the zip_open function");}}else {die("the file doesnt exists");}[/code]If that returns the "darn it didnt open" thing or give you the error from earlier try an absolute path such as C:\test1.zip or C:\\test1.zip Link to comment https://forums.phpfreaks.com/topic/32121-solved-zip/#findComment-149122 Share on other sites More sharing options...
gijew Posted December 29, 2006 Share Posted December 29, 2006 You know, I had a hell of a time trying to get the zip functions working on a winxp box too. I never found a solution I was satisfied with but I did find a few things that may help you give up sooner.You need the absolute path, not a relative one.If you are attempting to zip files, well...it sucks. One of the issues I had to deal with was my path was something like C:\Apache2\htdocs\whatever\temp\tempfile1.zip and when I attempted to zip that file it worked. When I unzipped that file I got an Apache2 folder, htdocs folder, whatever folder, temp folder and tempfile1.zip inside of it. Basically what I'm getting at is you are going to spend a while trying to get it to work on a winxp box. *nix is the only way to go with this I'm sad to say. Link to comment https://forums.phpfreaks.com/topic/32121-solved-zip/#findComment-149161 Share on other sites More sharing options...
jagguy Posted December 29, 2006 Author Share Posted December 29, 2006 Ok I can get ot to read zip files now with an absolute path on winxp.I can't get it to extract the files from the zip and save on a dir after uploading.Basically the '$zip = new ZipArchive()' won't work. It can't understand what new ZipArchive() is at all or any ZipArchive object commands.<?php$zip = new ZipArchive(); //Fatal error: Cannot instantiate non-existent class: ziparchive if ($zip->open('c:/www/php/test/test2.zip') === TRUE) { $zip->extractTo('c:/www/php/test/test/'); $zip->close(); echo 'ok';} else { echo 'failed';}?> Link to comment https://forums.phpfreaks.com/topic/32121-solved-zip/#findComment-149214 Share on other sites More sharing options...
trq Posted December 29, 2006 Share Posted December 29, 2006 Have you read the requirements on the [url=http://php.net/zip]manual[/url] page? Do you meet those requirements?Sounds to me like you dont. Link to comment https://forums.phpfreaks.com/topic/32121-solved-zip/#findComment-149249 Share on other sites More sharing options...
jagguy Posted December 29, 2006 Author Share Posted December 29, 2006 When i upgraded to php5.2 then they worked. php4.4.4 doesn't allow you to use OO zip stuff obviously.I found this out by trial and error but I saw nothing about this in the instructions which i read many times. Link to comment https://forums.phpfreaks.com/topic/32121-solved-zip/#findComment-149286 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.