Increase performance on MySQL with a SSD and modifying your my.ini or my.cnf file

Always backup your data along with the my.ini or my.cnf file

To add to the performance of a MySQL database, there are many tweaks for the my.ini or my.cnf file.  Two things that you can do is first add a SSD as a secondary drive and then move your temp file to the SSD by adding the following line just below the [mysqld] section -


You must change the letter H to the drive letter of your new SSD drive.   If you have a linux based computer, set the appropriate permissions.

Restart mysql or restart the computer.

Moodle LMS – Operation is not valid due to the current state of the object – PHP Manager

If you upgrade your Moodle LMS on Windows and receive the following error when registering the PHP version under the PHP Manager,  delete the mapping to your current version of PHP and then go back and register the PHP version.

PHP Handler


Re-register the PHP Version, this will recreate the mappings (handler)

php handler manager


Achieving 100000 hits in Moodle Performance

In order to stress test our Moodle installation on IIS7.5 with PHP 5.5.6 we used the following -

Installed Moodle, PHP, Wincache and MySQL with Microsoft web installer.  This produced the production machine.

  • added the wincache.dll to the ext folder (Downloaded the new Wincache 1.3.5 found on SourceForge)


  • Added the following to PHP.ini

The Session Save Handler puts information into Memory and saves sessions to the moodledata folder sessions folder


The PHP_Wincache section calls the wincache.dll and uses an optimal amount of cache for performance


  • Downloaded PHP 5.56 from here and registered new PHP with IIS7.5 PHP Manager


  • Added Wincache stores to Moodle (from here)
    This is a plugin to enable MUC access to the WinCache PHP extension available on Windows platforms.  This caches Application Stores and enhances performance.

Configuration after installing the Wincache Store 

Site Administration – Plugins – Caching Configuration

Wincache Store

Moodle Session Handling

Site Administration – Server – Session handling – Disable database for session information.

moodle session handling

Testing the Cache store performance on 100,000 uniques requests per operation (See the after Moodle Data move below)



FX-6100 3.3Ghz CPU (Six Core) (info)
2 Western Digital 2 TB Hard Disk (info)
8 GB of Ram DDR3
Windows Server 2008 R2 (Processor Scheduling – Background and Virtual Memory – System Managed to second Hard Disk)


Note: Since this write up, we have moved the MoodleData to a third hard disk and cloned the Windows Hard Disk to a solid state

The Tennessee College of Applied Technology – Shelbyville (Tennessee Technology Center at Shelbyville at the time) won Computerworld’s Laureate and Techtarget’s SearchCIO-Midmarket 2012 Customer Experience/Integration awards awards for their LMS system (supplemental to classroom work and hands-on).

Stats from Moodle

Moodle Stats


After the data was moved to a new drive

100000 After Moving Data


Results of Data Move (Before and After)

After Move

Speeding up Moodle LMS on Windows IIS 7.5

Speeding up Moodle LMS on Windows IIS 7.5

By default, Moodle uses its database to store information about sessions.  One of the ways you can speed up any PHP session on a Windows IIS server is to download wincache.  Wincache or Windows Cache Extension is designed to work with the PHP extension and speed up webservers.  Download the latest from SourceForge.


With Moodle, download the Wincache plugin to further optimize the Moodle file store.  Download the plugin here.

cache admin

Be sure to also download Wincache Info to see graphs and statistics.  Download the 2nd plugin here.


Because Moodle uses the SQL database to store information sessions, disabling this will significantly speed up the LMS.  In order to disable database sessions,  go to Site administration,  Server,  Session handling, and uncheck the option, Use database for session information.


Prior to doing this, check MySQL’s max allowed packet information is set to at least 4M in the my.cnf or my.ini.





Cannot find data record in database table course_modules.

The error that you may see if you are currently using Moodle may be seen after cron runs or when heavy access occurs.  The error,

!!! Can not find data record in database table course_modules. !!!

The error is related to heavy transactions and what we believe is caching corrupting the database.

To fix the error, you can run this query:

select modinfo from mdl_course where id = PutYourCourseIDHere;

Below, we use MySQL Workbench to run the query on a course id of 2

mysql workbench




There is also a Moodle plugin that rebuilds all of the site’s cache.

Unable to fetch available updates data – unexpected cURL error

When working with PHP and Moodle’s LMS, sometimes you have to dig for answers.  The error “Unable to fetch available updates data – unexpected cURL error” actually has a fix that is easy to implement.   Finding the solution was a challenge.

Moodle 2.4 updates using SSL and now you should place a certificate in the Moodledata folder.  Dawn was on this two weeks ago but the documentation was missing something.  (She can find anything on the web!)  Following up on what she had found, I found the solution here:

Here’s the answer:

“It needs the ca-bundle.crt available at – Just copy the contents into a text file and rename it to moodleorgca.crt and place this in the root of the moodledata directory.”   This is a comment found here MDL-36903 on

cURL CA Certs (referenced in the link above)