Moodle is a great tool for managing online courses. I started to use Moodle to manage all the courses I teach since Fall 2012. However, it is a complex system and not necessary very easy to use. Below are some tips I learned after spending countless hours.


1) Table does not display properly.

Moodle allows easy editing. However, after copy a table from Microsoft word to Moodle, it does not display properly. What I hope to show is something like this.


Instead, it shows something like the following.


The reason for this problem is some CSS file in the system level has suppress the expression of border for table cells. One way to fix this is to fix this at the system level. However, this may cause some other things to not work correctly. After reading the following post:, there is one work around. You can insert

style="border-color: black; border-style: solid; border-width: 1px;" 
to every td cell in your table in the HTML source. 
To do that, you click on the “HTML” icon from the editor in Moodle (see figure below), 
and manually add the above text to every td cell in the table.  I know this is tedious, but it at least works.  

2) Database does not show the “Add entries” tab for the students

Database is a nice tool for students to share resources with each other, and I intend to use it for submitting the brainstorming assignment. However, initially, I can’t make it work.

After setting up the database, the student can only see the following.



The problem is that when setting up the database, I also checked the enable checkbox for read only, see figure below. I thought both available for update and ready only can be additive, but the read only checkbox will actually override the feature of adding entries. This is a poorly designed option. Since both features are mutually exclusive, it’s better to use a drop down menu so that the user can only select one of them.  



Anyway, after many google searches, I finally find narrow down to the cause of this problem and fixed it 
(by unchecking the read only “enable” checkbox. 
The correct way to use a database can be found from the following page.

It involves the following steps:

To add a database activity:

  1. Click the "Turn editing on" button at the top right of the course homepage.
  2. Select Databases from the "Add an activity" dropdown menu.
  3. On the Adding a new database page give your new database a name and a description.
  4. Select the general options (see below) and the common module settings.
  5. Click the "Save and display" button at the bottom of the page.
  6. Define the fields or use a preset.
  7. Define the templates.
  8. Add one or two same entries then edit the templates as appropriate.

3) New forum does not send emails to subscribers

The third major problem I faced is that the news forum does not send emails to its subscribers.

First I thought it was the SMTP server was not set. Note that you can set the SMTP settings in moodle by following the instructions below:

Email settings
SMTP hosts

SMTP stands for Simple Mail Transfer Protocol. The SMTP host is an email relay that will take the email from Moodle and send it to users. You will need to set this only if your server does not allow mail relay. Otherwise, PHP will send out the mail using its built-in mail server. All the email sent by forums and other modules will be sent through this host.

Most SMTP hosts make use of the default port 25 to for listening email traffic. However, occasionally a non-default port is used. In such cases, entering an SMTP host followed by a colon (i.e. 🙂 and the port number should work. For example, if my SMTP host is and it listens on port 587 or 465 (most common) instead of port 25 I would enter the SMTP host as Currently, the parameter check is too strict to allow this via the Moodle UI; however, MDL-15923 has been created and resolved to address this. Until then, it can be set via phpMyAdmin using a query statement like:

UPDATE mdl_config SET value='' WHERE name='smtphosts';

However, after I check out the SMTP server information from Bluehost, and updated it with the updated information, it still doesn’t work.

After checking the moodle doc, which says the following @

Why are email copies of forum posts not being sent?

The most likely reason is that the cron is not set up. Please refer to the cron instructions.


  • Try the default settings in Settings > Site administration > Plugins > Message outputs > Email. This generally works.
  • Make sure that ‘Allow user to select character set’ in Settings > Site administration > Plugins > Message outputs > Email is set to No.

I realized that it might the cron job is not handled correctly.

It turns out this is the problem. First, I followed the instruction below to check for the cron command.

Method 1: The command line (cli) cron

If you have a choice, this is normally the best way to run Moodle cron.

PHP is also capable of running programs directly from the command line. Your system needs to be set up to do this; specifically you need the ‘CLI’ version of PHP to be installed. Most systems with PHP installed will have this by default. If you have the PHP CLI version installed then this is the recommended method of invoking cron. The correct command will be something like…

/usr/bin/php /path/to/moodle/admin/cli/cron.php
It turns out that the problem has two parts: 
  1. my PHP version is set to be 5.2.7, but to run the cron jobs, it requires php version 5.3.2.
  2. the cron command needs to be call periodically so that all the emails can be sent out.
To do this, I first set the PHP version to be 5.3 on bluehost. 
I then added the following cron job to my bluehost account using the service below.
The command I use is: 


/usr/php/53/usr/bin/php ~/

This means I will run a cron job every 15 minutes using php 5.3.2. Note: you need to replace [] with your moodle directory’s path.

This finally solves the problem.

4) Increase the upload limit

Your php installation putting limits on upload file size. The default will restrict you to a max 2 MB upload file size. You need to set the following two configuration options: you can change the following parameters in your php.ini file.

  1. upload_max_filesize – The maximum size of an uploaded file.
  2. memory_limit – This sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts for eating up all available memory on a server. Note that to have no memory limit, set this directive to -1.
  3. post_max_size – Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. If memory limit is enabled by your configure script, memory_limit also affects file uploading. Generally speaking, memory_limit should be larger than post_max_size.

    There are two methods two fix this problem.

5) Adding google analytics code to Moodle

After creating the course, you definitely want to know how the course is used. Google analytics is a great tool for this purpose. To add google analytics to Moodle, follow the following steps.

a) create a google analytics account (if you don’t already have one)

b) set up a profile for your course website

c) copy and paste the google analytics code to Site Administration > Appearance > Additional HTML

“These settings allow you to specify HTML that you want added to every page. You can set HTML that will be added within the HEAD tag for the page, immediately after the BODY tag has been opened, or immediately before the body tag is closed. Doing this allows you add custom headers or footers on every page, or add support for services like Google Analytics very easily and independent of your chosen theme.” (from

6) Check for whether or not your server is down

Check if the server is only down for you:

Check if there is a problem with Bluehost:

7) Performance problems

Below are the simple steps you can do to optimize your performance. More complex steps can be found in the link above.

  1. You can run a repair on all your databases. In the cPanel, click on the MySQL Databases icon and in the Repair section, choose a database to repair. You can safely run a Check and Repair routine on all of your databases.
  2. You can try to optimize all of your databases. In the cPanel, click the PHP MyAdmin icon. On the next screen, choose a database name from the left side column. When the tables appear on the main screen, scroll to the bottom and click the link "Select All". Next, use the drop-down menu, and on the bottom, choose the "Optimize" option. You can do this optimize routine to all of the tables in all of your databases.

Performing these two simple steps will not harm your important data as these steps above are non-intrusive maintenance routines. As such, they may not fix the core issue as well. For instance, if you have severe data corruption, it can cause your queries to time out before they fully execute. Data corruption can be difficult to detect, and repair. Database corruption can occur if a database operation did not completely succeed. Partial data is a form of corruption which can break Referential Integrity, causing your web application to fail also. In short, the free Repair or Optimization routines that I just mentioned may not be sufficient to fix severe database corruption.

Written by Shengdong Zhao

Shen is an Associate Professor in the Computer Science Department, National University of Singapore (NUS). He is the founding director of the NUS-HCI Lab, specializing in research and innovation in the area of human computer interaction.