Posts

What to do if you crashed your database

Please see this page for detailed instructions.  https://johnsmysqlblog.blogspot.com/2021/04/what-to-do-if-you-crashed-your-database.html

could not find course/ could not find top level course/ could not find course category

Could not find course category If you get this error (could not find course category) this basically means the course/s that exist don't have categories in the category table. Look at the mdl_course table in mysql. Column 2 is the course category. Every course listed (per row) must have a category identified in the table mdl_course_categories . For example, if you have this as your data (1, 0 , 0, "course name", " course name ", "", "summary" , 0, "site", 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", "", 1606214720, 1606215795, 0, 0, 0, 1606215383); You see the course category is zero . But there is a course category number one in the mdl_course_categories  table: |  1 | Miscellaneous | NULL     | NULL        |                 0 |      0 |     10000 |           0 |       1 |          1 |   1606214720 | ...

Making a new moodle instance

Once you have installed Moodle and have it working, you might need to make new instances for new organisations. That is, you might not want to share your first instance (copy) with other organisations, but you might get asked to nonetheless do so. The easiest way around this is to make a copy of a working copy of Moodle.  I find Moodle is a bit easy to destabilise/break with plugins or changes, hence, it is also best just to take a backup copy anyway. By default, Moodle consists of three main parts. The app, the database, and the varying/variable data or caches. Caches and variable data are usually in /var/www/moodledata The app itself is usually in /var/www/html/moodle The database is usually in mysql or similar. Once you have it installed and working, I'd suggest immediately making a backup copy to use for creating instances later on. I'd suggest doing it straight away because it is quite quick to climb up to 1 GB or larger which takes ages to process. To make the backup, o...

choosing a php version

Moodle is fussy about which version of php it wants. Let's say it wants php7.1 specifically. Type the following commands: sudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt-get install php7.1 sudo apt-get install php7.1-cli php7.1-common php7.1-json php7.1-opcache php7.1-mysql php7.1-mbstring php7.1-mcrypt php7.1-zip php7.1-fpm sudo a2dismod php7.2 sudo a2enmod php7.1 sudo service apache2 restart

php file size upload limits too low

By default, php allows 2-8 MB file size uploads. These days, you need probably 1-2 GB in case someone wants to upload a video. [edit] /etc/php/php.ini find other versions: find /etc/php -name "php.ini*" -name edit those as well Search for these entries and change them as shown: post_max_size = 2000M upload_max_filesize = 2000M

reset user password in moodle

Open mysql:  mysql -u root -p choose your database: use moodle; [whatever the moodle instance is called] Now change the password: update mdl_user set password=MD5('password') where username='admin';  exit;

"unknown category" - error and white screen of death error

 If moodle gives you an error called 'unknown category' and / or goes blank, this is the fix: cd /var/www/html/moodle pico config.php look for the line that mentions a theme: $CFG->theme='boost'; put a hash mark in front of it, like so: # $CFG->theme='boost'; this line in the config file basically forces moodle to use the default theme. discussion is here:  https://moodle.org/mod/forum/discuss.php?d=393412