General help

Zip / Unzip doesn't work :(

 
 
Picture of Adam H
Zip / Unzip doesn't work :(
 

Hello

We're running Moodle 1.99 and having some serious woes at using zip or unzip functions.

When no system path to zip/unzip is in place Moodle doesn't seem to be using the PHP zipping library and any attempt to zip/unzip results in the following error:-

unzipfileserror

Which to me looks like it can't even find the correct error to display as that is just the name of the error variable?

When I put the correct system path in the the GNU zipping utilities (E:\bin\zip.exe) exactly the same error occurs.

When debugging is switched on there are no extra error messages, and we are really at a loss why this doesnt work as it is a problem we have never come across before.

If it helps the moodle server is running on Windows Server 2008.

 
Average of ratings: -
Picture of Steve Bluck
Re: Zip / Unzip doesn't work :(
 

This post: http://moodle.org/mod/forum/discuss.php?d=93138 seems to suggest incorrect path -I'm not used to Moodle on Windows so maybe the path is not quite correct? Or the other guess is security permissions -does IIS / PHP have permission to access the folder/.exe?

 
Average of ratings: -
Picture of Adam H
Re: Zip / Unzip doesn't work :(
 

No the path is very much correct, and the appropriate permissions have been set on the exe's and the folders..

I think the error is alot more fundamental to moodle though because when the paths are left as default, exactly the same error occurs when the system should surely fall back on the PHP zipping libraries. Instead it makes no attempt to zip and immediately bombs out to the error page, but the error simply displays the name of the zip error variable and actually no error message content whatsoever..

Can anyone shed any light, as this problem is seriously driving us nuts! lol.

 
Average of ratings: -
Gmads
Re: Zip / Unzip doesn't work :(
Group Testers

Does the problem occur unzipping any file or just SCORM files?

Maybe you could enable debugging messages to see if that sheds some light on this.

 
Average of ratings: -
Picture of Adam H
Re: Zip / Unzip doesn't work :(
 

No the problem happens with any type of unzipping an archive, or even trying to backup courses using moodle...

Amy type of zip/unzip operation using moodel via a system path or defauly to PHP zipping routines bombs out instantly with absolutely no error message other than the Moodle error box wiht [unzipfileserror] written inside it :/

Systems paths to win executables are correct and appropriate permissions are set..

Again this is a Win 2008 server with latest Moodle 1.9 running... I know windows isnt the ideal platform of choice for Moodle but with my client I don't have a choice

 
Average of ratings: -
Gmads
Re: Zip / Unzip doesn't work :(
Group Testers

My first option is that Moodle should be using the moodledata/temp/ directory for all zipping operations, but maybe in your case those are being, or trying to be made, in another directory that doesn't have write permissions.

Another one: the GNU files need the the msvcrt.dll and msvcp60.dll files to be in the Windows\System folder. Do these files exist?

Long shot: maybe some other zip executables are being accessed as a result of some value in the path environment variable.

Which PHP and IIS versions are you using?

 
Average of ratings: -
Picture of Adam H
Re: Zip / Unzip doesn't work :(
 

How could I find out which temp directory Moodle is trying to perform the zipping in then if it's possibly not using moodledata/temp ??

msvcrt.dll and msvcp60.dll are both present in C:\windows\system32

We're running PHP 5.2.11 and Apache 2 instead of IIS.

 
Average of ratings: -
Picture of Gerald Thomas
Re: Zip / Unzip doesn't work :(
 

Hi, we're using the same setup with Apache 2 and found that gnuwin32/bin/zip.exe worked very well backing up within a course but would not work from the course automatic backups because of the way Apache 2 dealt with the paths with Windows.

I now use Moodle zip increased the file sizes in post etc in php.ini to 4294967296 max and memory_limit = 3096M.

This cured my zip backups stopping with very large course sizes. I'm still using Moodle 1.9.12.

You could try installing a fresh Moodle using a different database and Moodle folder name under your Apache directory to test the Moodle zip facility.smile

hope this helps

 
Average of ratings:Useful (1)
Gmads
Re: Zip / Unzip doesn't work :(
Group Testers

It's strange that neither, the internal or external, methods are working.

I'm not really sure, but maybe you could find something in the apache logs.

What about checking some of the windows logs?

 
Average of ratings: -
Picture of Stefan Nychka
Re: Zip / Unzip doesn't work :(
 

Disclaimer:  these are shots in the dark, assuming the problem hasn't yet been solved.  Other's posts seem more likely to contain a fix.

The first thing that struck me was the path:  E:\bin\zip.exe

bin on a Windows system?  It seems odd, at least to be outside a 'Program File' or 'System*' dir., although of course it's not impossible.  I have no experience on Windows Server, just standalone Windows OSs, but bin is a dir more common in my experience to Linux/Unix.  I do know you previously mentioned you were certain the path and permissions were correct, but wanted to point this out in case double-checking caught something.

You also mentioned this seems to be a fundamental problem with Moodle.  With 1.9 versions, you're sort of right.  See the Path to zip documention.  From personal experience, I did have problems with 1.9.x (x == 7, I think) on a slow machine zipping large files, and these were fixed by using the system zip (I believe the problem was because older versions of PHP have inefficient zip utilities).  Note I found this differently, via a Backup FAQ.

Again, these are very weak guesses, only added as it doesn't seem like the better suggestions solved your problem.

 
Average of ratings: -
Picture of Adam H
Re: Zip / Unzip doesn't work :(
 

Hi Guys

No sadly this problem is still unresolved (which isn't being helped by the fact I find it near enough impossible to gain proper access to the server as it's sitting behind a very clunky java based VPN web interface)

I'm not entirely sure who set the system up but E:\bin does exist, the directory appears to have been created by someone who is familiar with Linux systems and they are just popping a few random executables in there such as zip etc.

I'm going to try my best today to get a test moodle setup on this server for I can double check whether it is the system or moodle that's the problem.

 
Average of ratings: -
Gmads
Re: Zip / Unzip doesn't work :(
Group Testers

I used to work with unix, so I must confess and say that I'm one of those who like to use "bin" folders in Windows tongueout

 
Average of ratings: -
Picture of Adam H
Re: Zip / Unzip doesn't work :(
 

Ok!!!! After finally being able to get access to this server I have figured out where the problem lies...

Basically on my test moodle I kept the moodledata directory on the same server as the moodle... Currently on their site the moodle data is hosted on a different machine and is linked via \\computername\moodledata$....

On my test moodle zip and unzip work perfectly fine.. When I move and point the moodle data onto this \\computername server the zip and unzip files to work..

I've tried copying zip and unzip.exe's to the \\computername server but still get the same error message..

Any ideas how to fix this then? unfortunately there's not enough space on the Moodle server to host the moodledata folder there... Although if there's no quick easy fix i'm sure my client will be able to purchase another drive for this computer as this zip problem is kind of a priority.

Cheers for all your help anyways guys... At least I know where the issue lies now lol!

 
Average of ratings: -
Gmads
Re: Zip / Unzip doesn't work :(
Group Testers

Having access to the server changes everything as one stops working blindfolded!

That's it, zip/unzip cannot work with remote addressess.

So you copied zip & unzip to the remote machine and it didn't work. My guess is that your system needs to call those copies instead of the local ones. Mh, not sure how to go about that, though.

 
Average of ratings: -
Picture of Matteo Scaramuccia
Re: Zip / Unzip doesn't work :(
Group DevelopersGroup Particularly helpful Moodlers

Hi Adam,
UNC paths are not supported by most of the CLI commands: ask that path to be mapped as a local unit and change the dataroot path in your config.php according with it, from UNC to the assigned Drive Letter.

HTH,
Matteo

 
Average of ratings: -
Picture of Adam H
Re: Zip / Unzip doesn't work :(
 

Excellent,, that does make alot of sense, I shall get them to map the drive and give this a whirl, and post back with the results..

Cheers guys smile smile

 
Average of ratings: -
Picture of Adam H
Re: Zip / Unzip doesn't work :(
 

Hey guys

Though I'd post an update in here as this problem is now resolved,, and the solution was different to the mapping of the drives as discussed earlier (Although i'm sure mapping the drives would have worked)..

Copy and pasted from another forum:--

The problem:
We recently moved our Moodle installation onto separate Windows servers.  The MoodleData folder now resides on a separate box to the webserver.  Everything was great until we tried to use any of the ZIP features in Moodle.  Course restore, course backups, SCORM Packages etc... simply would not work.  After spending long days and late evenings trawling through the Moodle libraries and searching the forums I managed to find a fix, courtesy of Kiran Dhaman.
The Fix:
Easy once you know how.
In congif.php, make sure you put 4 backslashes in the UNC path to the MoodleData folder,
For example:
$CFG->dataroot  = '\\\\pathtoserver\moodledata';
 
Now edit lib/moodle.lib
Find this code:
function cleardoubleslashes ($path) {
    return preg_replace('/(\/|\\\){1,}/','/',$path);
}
And replace with this code:
function cleardoubleslashes ($path) {
if (substr($path, 0, 2) == "\\\\" or substr($path, 0, 2) == "//")
return $path;
else
return preg_replace('/(\/|\\\){1,}/','/',$path);


 
Average of ratings:Useful (2)