Posts

installing moosh to make your life easier

If your site is crashed you need to edit moodle on the command line. Enter Moosh, the moodle shell. To install moosh, do this: sudo apt-add-repository ppa:zabuch/ppa sudo apt-get update sudo apt-get install moosh Then, if you want to use moosh, you can use more or less any command shown in the web interface using a syntax of moosh -n the-command the-parameters for example cd /var/www/moodle/ moosh -n plugin-uninstall someplugin  or moosh -n cache-clear note the "cd" part - it won't work unless you do that, as it uses the config file in that directory to login. The -n part means do not ask me about my user id. Normally moodle operates as apache (www-data). Using -n lets you run it as root. Otherwise you have to do something which is in my view, worse, namely enable bash shell for apache. That opens you up to hackers, in my view, as apache is facing the web and accepts uploads on many apps such as wordpress, so it's feasible for someone to hack your server entirely if y...

Removing a troublesome plugin

Sometimes you can't login and remove a plugin because your instance crashes before the login completes. Just go to  https://yourwebsite.com/moodle/admin/plugins.php and then uninstall or disable the plugin. This URL should let you login as admin and remove plugins even if the rest of the site doesnt work (with yourwebsite.com replaced by your web address)

Duplicating moodle to create a new instance

The following are steps to DUPLICATE an existing Moodle on Ubuntu 20.x using PHP 7.4 to make a  NEW instance . First you have to create a new database for the new moodle instance. Let's assume your new moodle instance is going to be called "copytwo" If you are moving an instance from one server to another you will have to edit the SQL to replace the hostname. I suggest VIM or VI. Their details are mentioned in step 5. You will need to make a backup copy of the SQL, then edit the SQL, and replace the old hostname with the new hostname. 1. Set up a second MySQL database After this, set up mysql. Login as  root  on mysql. It will require you to use your root moodle password. If you can't remember what you set it to, instructions on resetting it are below in step 2 . mysql -u root -p 1.1 First, create the database: create database copytwo; When creating the moodle database, you need to set the  owner -  the user who will have  write  permissions. Obv...

Installing Moodle on Ubuntu 20.x

The following are steps to install Moodle on Ubuntu 20.x using PHP 7.4. Your versions may differ. Please note that the instructions on Moodle's page ( https://docs.moodle.org/400/en/Step-by-step_Installation_Guide_for_Ubuntu#Step_2:_Install_Apache.2FMySQL.2FPHP ) are NOT correct. There are some substantial errors on that page. They do not tell you to remove php8.1 They tell you to reset the root password using a method that is confusing and causes problems. Their steps for SSL do not work. Rather follow these instructions. 1. Install PHP and set up apache Note that Moodle at present (2022) only likes php7.4 or older, so if the server system is preinstalled, you need to remove the existing php if it is the wrong version. First find out the version: php -v If it returns version higher than 7.4, e.g. version 8.1, you have to remove it. At present, Moodle does NOT like php 8. sudo apt remove php8.1 Now tell it about the older php version repository: sudo add-apt-repository ppa:ondrej...