Error when Restoring

Error when Restoring

by Dave Emsley -
Number of replies: 10

I'm trying to restore a Moodle 2.6 course into another Moodle 2.6 Site.  I get the message:

A required parameter (sesskey) was missing


Now this makes no sense to me and I can find no other references to it.  Can anyone explain what is going wrong.


Best Regards


Dave

Average of ratings: -
In reply to Dave Emsley

Re: Error when Restoring

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Sesskeys are a security feature that stops links like [siteurl]/user/delete.php?id=4&confirm=1 from working if they are posted, for example, in a forum (the above link is made up, but hopefully you get the idea). If the link wasn't generated by the current user's session, then the 'sesskey' won't match and it will be assumed to be a malicious link.

Which brings us to your problem. Usually, 'missing sesskey' errors are only seen if, a) you try to construct a malicious link to do something bad or b) a programmer has made a mistake.

As I don't think either or likely in this case, it is probably special case c) - there are so many form items on the page that your server has removed some from the list (this is a security feature to stop people overloading a page with form values); the removed values, in this case, include the 'sesskey'.

To fix - edit your server settings in php.ini and change the value 'max_input_vars' ( http://www.php.net/manual/en/info.configuration.php#ini.max-input-vars ) to something higher (there may be other security settings on your server that have a similar effect, but this is the usual culprit).

In reply to Davo Smith

Re: Error when Restoring

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

There is also a 4th possible reason:

d) You left the page so long (or the page took so long to load) that your session has timed out. By the time you log in again, the sesskey has changed (which is the whole point) so you get the error.

In reply to Tim Hunt

Re: Error when Restoring

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Tim, I'd considered that, but the error for that is usually 'invalid sesskey' not 'required param (sesskey) is missing'.

In reply to Davo Smith

Re: Error when Restoring

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

No. Becuase, when you session goes, you get redirected to login.php, whcih then redirects you back to where you were, but with all POST data lost, so you often get missing param errors.

In reply to Davo Smith

Re: Error when Restoring

by Dave Emsley -

Thanks for the responses guys.

I have no access to php.ini as this is a hosted site.  Is there any way I can stop it timing out whilst doing the restore?  The course is about 14Mb in size.


Cheers


Dave

In reply to Dave Emsley

Re: Error when Restoring

by Grant Ashlee -

Hi Dave,

I have run into the same problem.

A friend passed on a course to me in a zip file (backup) and then I made a new course with nothing in it but wanted to restore it with my friends course. it would cut down the work tremendously......however when I tried to restore it gave me the same message "a required parameter (sesskey) was missing". I am running off my local server and I have done some investigation and other discussions say I have to increase my file size in the php.ini file on the server......but of course I cannot find that file...

Did you ever get the problem fixed?

I really find this perplexing as I am sure this problem as come up many times but there is absolutely no literature on this subject.


Any help in this area would be much appreciated.

Thanks for your time.

Grant

In reply to Grant Ashlee

Re: Error when Restoring

by Dave Emsley -

Hi Grant,

No solution at present for me on this.


Cheers


Dave

In reply to Dave Emsley

Re: Error when Restoring

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

I had a few courses give me trouble on restore.  I ended up having to chunk them into about four parts to bring them in.   Not a great solution but after spending hours trying to fight the restore on one large course, it ended up being a quicker solution!

With some I had a question or two that had become corrupted (but that I believe threw a different error) and it took some database work to fix that.

In reply to Dave Emsley

Re: Error when Restoring

by Cam Howard -

I have run into this error message when trying to restore a course and the backup file is larger than the file size allowed by the php.ini on the server that hosts the Moodle site.

If that is the issue, you have a couple of options.

If you can edit the php.ini file, change the "post_max_size" and "upload_max_filesize" to a larger number, such as 20MB or 50MB.

If you can't edit the php.ini file on the server, try creating new backups of the course you need to restore, such as one backup with just the forums, and one backup with just the assignments, or a backup for each half of the course, or a backup without the userdata, and then do multiple restores from the multiple backup files.

If you have the option to not include any large image, presentation, or video files in the backup, that may also help. You will then have to add them to the restored course separately.

Hope this helps someone!