Forums | Mahara Community
Support
/
Export freezes
05 December 2013, 14:44
We are currently testing mahara for use in one of our new courses.
It is important for our students to be able to export their files after they have completed their course. I have attempted this on many occasions and each time I get stuck (even when tring to import one single journal with miminal content).
The whole process seems to freeze with the message "Please wait while your export is being generated. Creating zip file." I have let it run for a few hours at a time and nothing ever happens.
I have attempted this both in the html and Leap2A format. Do you have any suggestions? I have seached forums and can’t find a solution. Any advice would be much appreciated.
We are using Mahara 1.7.2 on Windows Server Standard.
Thank you.
05 December 2013, 17:43
Hi Sarah,
1. Do you see any messages in your PHP error logs? I don't know where these would be on a Windows server. In Ubuntu, by default the PHP errors get printed to the Apache error log at /var/log/apache2/error.log
2. The export page calls an ajax script to perform the export processing, and updates the message onscreen when it hears back. So, probably the ajax script is erroring out, which you should see in the PHP error logs.
3. Since you're using a Windows server, I'd guess the problem is the $cfg->pathtozip setting. Mahara uses the command-line zip utility to create the zip file when you do an export. The default setting, /usr/bin/zip, probably doesn't work on a standard Windows installation. What you'll need to do is add $cfg->pathtozip = 'something'; to your config.php file. (For importing you'll also want to add a $cfg->pathtounzip). Unfortunately, knowing nothing about Windows web servers, I can't advise you on the proper value. I did find this old forum thread where someone talked about running Mahara in WAMP on Windows, so perhaps it will have some helpful advice: https://mahara.org/interaction/forum/topic.php?id=2324
Cheers,
Aaron
12 December 2013, 13:30
Hi Aaron,
Our college has similar issue too. Ours is working on Linux hosting server with cPanel.
Nothing shows in error log from cPanel.
There is also an error_log sitting in mahara folder, but there is no information about the exporting error.
Is there some other place I can look at?
Thanks
Lizzy
12 December 2013, 16:40
Hi Lizzy,
Try adding this to your config.php file. It will tell Mahara to log errors to an "error.log" file under your $cfg->dataroot directory.
$cfg->log_dbg_targets = LOG_TARGET_FILE;
$cfg->log_info_targets = LOG_TARGET_FILE;
$cfg->log_warn_targets = LOG_TARGET_FILE;
$cfg->log_environ_targets = LOG_TARGET_FILE;
Since you're on a cPanel based site, it's quite likely that your problem is also due to not having the correct "path to zip" setting. If that is the problem, you'll need to check with your hosting provider whether they provide a "zip" and "unzip" executable, and what the path to them is. Most shared hosting providers make this available because many web applications use it.
Cheers,
Aaron
24 January 2014, 14:36
Hi Aaron,
Thanks for your reply.
I've contacted with my hosting provider. This is the reply from my hosting provider.
The server handles zip but you may not be able to use it due to security purposes. We have zip through PHP but Mahara may need to use exec or shell_exec for command line zip which is disabled.
This is the information from the error log
[05-Dec-2013 11:29:44 Australia/Brisbane] [WAR] 47 (export/leap/lib.php:183) Undefined variable: returnvar
[05-Dec-2013 11:29:44 Australia/Brisbane] Call stack (most recent first):
[05-Dec-2013 11:29:44 Australia/Brisbane] * log_message("Undefined variable: returnvar", 8, true, true, "/home/accredit/public_html/mahara/export/leap/lib....", 183) at /home/accredit/public_html/mahara/lib/errors.php:446
[05-Dec-2013 11:29:44 Australia/Brisbane] * error(8, "Undefined variable: returnvar", "/home/accredit/public_html/mahara/export/leap/lib....", 183, array(size 8)) at /home/accredit/public_html/mahara/export/leap/lib.php:183
[05-Dec-2013 11:29:44 Australia/Brisbane] * PluginExportLeap->export() at /home/accredit/public_html/mahara/export/download.php:105
[05-Dec-2013 11:29:44 Australia/Brisbane]
[05-Dec-2013 11:29:44 Australia/Brisbane] [WAR] 47 (export/leap/lib.php:183) exec() has been disabled for security reasons
[05-Dec-2013 11:29:44 Australia/Brisbane] Call stack (most recent first):
[05-Dec-2013 11:29:44 Australia/Brisbane] * log_message("exec() has been disabled for security reasons", 8, true, true, "/home/accredit/public_html/mahara/export/leap/lib....", 183) at /home/accredit/public_html/mahara/lib/errors.php:446
[05-Dec-2013 11:29:44 Australia/Brisbane] * error(2, "exec() has been disabled for security reasons", "/home/accredit/public_html/mahara/export/leap/lib....", 183, array(size 8)) at Unknown:0
[05-Dec-2013 11:29:44 Australia/Brisbane] * exec("/usr/bin/zip -r '/home/accredit/public_html/mahara...", array(size 0), null) at /home/accredit/public_html/mahara/export/leap/lib.php:183
[05-Dec-2013 11:29:44 Australia/Brisbane] * PluginExportLeap->export() at /home/accredit/public_html/mahara/export/download.php:105
[05-Dec-2013 11:29:44 Australia/Brisbane]
From the error log, looks like Mahara is using exec.
However, my hosting provider disable exec for security reasons.
Is there another way to get this work?
Thanks
Lizzy
27 January 2014, 11:58
Hi Lizzy,
Unfortunately, no, there's no way around this problem, other than to rewrite parts of Mahara to use the PHP zip library instead of the command-line zip. (If you know PHP, it would probably not be too difficult a task.)
Cheers,
Aaron
28 January 2014, 11:23
Thanks Aaron.
Do you happen to know which program is doing this job in Mahara?
Thanks again.
Lizzy
28 January 2014, 16:40
Export is handled by the leap2a export plugin and the HTML export plugin, under /export/leap and /export/html respectively.
If you search the code for "pathtozip" and "pathtounzip", you can find all the places where we use the command-line zip & unzip executables. You'd probably want to replace them with the PHP ZipArchive class: http://nz1.php.net/manual/en/class.ziparchive.php
Cheers,
Aaron
29 January 2014, 13:11
Hi Aaron,
Thank you very much for giving me such a clear direction.
Lizzy