moodledata location affects Moodle performance

I’ve been working with Moodle for several years now, primarily as part of the SLOODLE project. However, one thing that has always been a source of frustration is how slow Moodle often seems on my local Windows Vista PC in work (sadly, I don’t have the option of upgrading to Win7). As it turns out, the performance problem was entirely caused by where I had placed my “moodledata” folder, and there is any easy solution.

The advice that is always given is to keep the “moodledata” folder away from your webserver folder. This is to ensure that nobody can access the data directly — it can only be accessed via Moodle. On my public server, I pay close attention to this, as everybody should, because it’s an important security point (albeit not possible on all webservers). However, for my test installations on my local machine, I have a tendency to keep the data folder alongside the main Moodle folder, for ease of access when necessary. Nobody can access it from outside my PC, and there’s no sensitive data, so securing the installation isn’t important.

As it turns out, that’s actually the cause of my performance problem. It seems that Moodle automatically checks to see if the data folder is web-accessible. This is a great feature for ensuring admins have secure installations, but something about this check seems to go very slow on Windows Vista, and it sometimes seems to break installation/upgrade of Moodle and its modules.

I’ve never had the same problem on Win XP or 7, despite using the same webserver configuration. As such, I suspect it’s somehow related to the Vista file permissions system or User Access Control, which have caused a number of problems for other software. Even setting the moodledata folder to be fully accessible by all users didn’t solve the problem.

The solution

Put simply, what’s the solution? Just make sure your moodledata folder is not directly web-accessible. For example, if you keep your Moodle folder here:

  • c:wampwwwmoodledata

Then you should keep your moodledata folder here:

  • c:wampmoodledata

The exact paths will vary from one webserver configuration to the next (I use WampServer, which I find very effective). The principle is this: if “www” is your webserver folder, then put moodledata above it. That should resolve the performance issue, seemingly because Moodle will no longer be able to test its web-accessibility.

2 comments on “moodledata location affects Moodle performance

  1. Nice explanation Peter.
    I have some doubt on following , if you can give me some advice on the same it will be helpful.
    Thanks in advance.

    If i want to move my moodle website on another server , and i have copied my moodledata folder along with it while moving.

    Now after configuring it on new server , if i clear cache from new sites moodle admin , can it will affect the old site css and images ?

    • Hi Pragnesh. If you reconfigured everything properly for the new server, then it should not affect the old server at all. It’s important to make sure you update the configuration properly though (don’t leave any old URLs or database details in there).

Leave a Reply

Your email address will not be published. Required fields are marked *