Large course backups fail in Moodle 2

Have you ever encountered this error message whilst backing up a course on Moodle?

Coding error detected, it must be fixed by a programmer: backup_helper::store_backup_file() expects valid $filepath parameter

Or do your automated course backups fail and the error log simply says “Error”.
Then the chances are that your course backup is greater than 2GB.

Having spent several long days trying to solve this, I have finally figured out what the cause of the problem is.

Moodle 2 uses the native ZIP libraries found in PHP to backup a course and zip it up as an archive. The problem here is that this is platform dependent. And large course backups will fail on 32-Bit platforms.

This is due to integers and how they are stored. The technical explanation is that 32-bit platforms can hold a maximum value of two billion, and 64-bit platforms have a max value of 9E18.
PHP does not support unsigned integers and if an integer is greater than the max size supported then it is interpreted as a float instead.

What this means in simple terms is that it runs out of room to store the integer and the backup simply quits.

So does having a full 64-bit Web Server setup fix the problem?

Well, the answer is yes and no.

64-bit Linux platforms work fine, 64-Bit Windows environments do not.
So even if you have a 64-bit Windows Server, running 64-Bit Apache, PHP and MySQL, the maximum integer value that PHP can store is still a 32-bit value.

Why is this you may ask?
It’s because the underlying c-code, long is still 32-bit! Linux uses a 64-bit long and Windows doesn’t.

So how can we work around this?
Simple, run your Moodle installation on a 64-bit Linux System.
However, this isn’t always possible and a lot of organisations, colleges and Universities may have invested heavily in Windows platforms. The organization where I currently work has and we do not wish to switch exclusively to Linux servers.

So we are in the process of installing a single Linux server that will run the system cron and perform the automated backups and copy the backup file back onto the Windows servers.

This is not ideal we know, however, backups are crucial and courses only get bigger. So an additional virtual backup box bolted onto the existing setup is justified in this case.

A better solution in the long term would be for Moodle 2 to support external ZIP clients again, like it used to in Moodle 1. There has been some work done on this with a third party plugin but as it is only Linux based then it doesn’t help. If we were running Linux then we wouldn’t need it!

I hope this article helps other Moodle users in a similar situation and I hope my wasted hours spent on a fix provides you the time to deploy a 64-bit Linux setup.

Site Wide User Grade Report

In FE and HE Colleges and Universities students are often enrolled onto various modules (Moodle Courses) that make up the degree or qualification.

Assignments are therefore scattered across multiple Moodle courses and there is no way for a tutor to see ALL the grades a particular student has received all in one place.  Currently the tutor needs to go into each assignment to view the grades, or the view the gradebook for each course.

To get around this and to streamline the admin process I have written a report called Student Marks/Grades.  It’s basically an admin report that allows a user to search against the student IDNUMBER field and return all the grades, comments and feedback associated with each Moodle Assignment.

The report is an admin report that uses the view:reports capability.  It works with both standard Moodle grades and scales.
The code can definitely be improved and needs updating for Moodle 2.3+ but for now it works well.

The report is now currently in beta use at Leeds College of Music and is slowly becoming more bespoke as requests are added.


Moodle and Turnitin Integration

Having just finished Turnitin Integration with Moodle here at Leeds I though I’d share my experience with a blog post.  And the good news is, it’s easy.  Very Easy.
As long as you follow the setup instructions it can be done within 30 minutes.

Before you start, you must ensure you have your Turnitin Admin login details to hand.
A lot of work has been done by the development team at Turnitin, as well as work done by the Moodle Community, and this clearly shows.

I kept some notes and simplified the installation process here:

  1. Visit and login with your admin credentials.
  2. On the next screen, make a note of your account ID (you’ll need this later)
  3. Now click the button in the integrations column under your account.
  4. You will now see a list of plugins, select “Moodle Direct”
  5. In the configuration page enter a shared key (just make something up, preferably secure – make a note of it as you will need it later)
  6. Leave the IP Address set at
  7. In the Error Callback URL enter “”
  8. Fill in your contact details and create a dummy test account, I used “test” as the user name and “test” as the password.
  9. Hit Save

Now that this is done you should see the option to download the module for Moodle.

Click Download and then save the file ready to extract and upload to your Moodle server.

Installing the Moodle Plugin

  1. Extract the zip file you downloaded above, upload the folder into the /mod folder on Moodle
  2. Login as admin on Moodle and install the plugin
  3. Now on the settings page enter your Account ID you made a note of earlier
  4. Now enter your shared key that you setup in the previous stage
  5. Enter the API URL as “”
  6. The rest of the settings are up to you and your organisation, and refer to standard TurnitIn preferences.
  7. You shouldn’t need to enter any proxy settings.  Leave this blank if you are unsure.
  8. Click “Save Changes” and you are good to go.

The Turnitin Assignment Type is found under “Add and Activity from within your Moodle course.

Summary and Overview:

This really is an impressive module.  The integration is seamless, students do not need to login to Turnitin and the grades are passed directly to the Moodle gradebook.  There is a slight delay when processing the assignment, as to be expected. And users have to click the refresh submissions button to check to see whether it’s been processed or not.

But these are not faults with the system, nor TurnitIn.  The task is a heavy process and you don’t want to leave open calls to your server whilst it does this.  So a slight wait and few refresh clicks is more than reasonable.



My Timetable (MIS Integration) from MyMoodle

Following on from our student attendance integration we have also integrated the student timetable. The data comes from an XML feed and is rendered in PHP within a Moodle page.

The timetable is dynamic and always up-to-date and students access it from the link in the MyMoodle page from the MyProfile block or direct form the drop-down menu within the theme itself.

Student Timetable integration

Student Timetable integration

My Attendance Record (MIS) Integration

In order to further enhance the value of Moodle at Leeds City College we have integrated the student attendance record into a Moodle page.  Students can see see their attendance register from the MyMoodle Page.

The page was created by taking an XML feed from the college MIS system and rendered in PHP.


My Attendance Register

My Attendance Register