User talk:James Steerpike
Overview
Shared hosting is a good choice for providing internet access for a small number of students on a self managed Moodle site at a moderate cost. Using cPanel is a relatively easy way to install Moodle. There are several ways of installing Moodle on shared hosting. This method sets up the php before using the command line to obtain Moodle, set up the moodledata folder, and set permissions.and the web-based wizard is used to start the Moodle install. A cron job to periodically clean up unwanted files completes the installation.
- A hosting and domain package with a SSL Certificate, (Check by going to https://yourdomain (Change yourdomain to your own site name) You should see a landing page.
- These cPanel Tools ( PHP Selector, phpMyAdmin, Database Wizard or Manage Databases, Terminal and File Manager)
Note on cPanel, there is a search box to allow you to find tools.
Check compatibility of your hosting service with Moodle
- Go to PHP Selector. Moodle 4.5 requires php 8.1.0
- Go to phpMyAdmin and find Database type and version. Moodle 4.5 requires a minimum of MySql 8.1, MariaDB 10.6.7, or PostgreSQL 13.
If your hosting service does not meet these requirements, this installation will fail There is no supported Moodle version lower than Moodle 4.5 to install as an alternative. You can:.
- Ask your provider for an upgrade
- Find another provider
Set up PHP for Moodle
- Log in to cPanel and click on PHP Selector.
- Choose PHP 8.1 from the available versions.
- Enable required PHP extensions by checking these at minimum: `sodium`, `curl`, `openssl`, `mbstring`, `xml`, `intl`, `json`, and `fileinfo`.
- Adjust PHP settings in the Options tab:
- Set memory_limit to at least 128M. -
- Ensure max_input_vars is 5000 or higher.
- Confirm file_uploads is On.
- Save or apply the changes.
Use the terminal to get Moodle code and create a moodledata folder
- Go to Terminal in cPanel and paste these commands one after another, pushing enter after each line.
- mkdir moodledata
- chmod 755 moodledata
- cd public_html
- wget https://download.moodle.org/download.php/direct/stable405/moodle-4.5.1.tgz
- tar -xvzf moodle-4.5.1.tgz
- chmod 755 moodlle
If Terminal in cPanel is not available, an alternative method is as follows:
- Make a directory in your home directory called moodledata
- Set permissions on moodledata to 755
- Download MOODLE_405_STABLE tar version from https://download.moodle.org/ to your home computer, then upload to public_html on shared hosting
- Extract the uploaded file into public_html
- Set permissions on public_html/ moodle to 755
Either method will give you:
- A folder called moodledata is in your home directory (one level above public_html) and file permissions are set as 755.
- A folder called moodle containing subfolders and php files in your public_html folder with file permissions are set as 755
Web based Moodle Installation
Go to `https://yourdomain/moodle`) and follow the instructions.
- First screen - Choose your language.
- Second screen - Confirm paths
- Web Address: https://yourdomain/moodle (Replace yourdomain with your actual domain name)
- Moodle Directory: /home/cpanelname/public_html/moodle (Replace cpanelname with your actual cPanelname, find it on File Manager if you are not sure)
- Data Directory : /home/cpanelname/moodledata
- Third screen - Choose database driver (a choice of MySql, MariaDB and others)
- Go to the cPanel phpMyAdmin tool to find your database type.
- On the cPanel phpMyAdmin Set your character set and collation.
- Character set: Use utf8mb4 (full UTF-8 support) to handle all Unicode characters.
- Collation: Use utf8mb4_unicode_ci for case-insensitive, language-aware sorting
- Fourth screen -Database settings
- Database settings: localhost
- Database name
- Now we have to set up the database in cPanel Database Wizard.
- cPanel Database Wizard Step 1: Create A Database - call your new database moodle in the Database Wizard.
- Copy the database name ( including the cpanel prefix) from cPanel to your web based installations screen)
- Database user
- cPanel Database Wizard - next to create a user called moodluser
- Copy the user name ( including the cpanel prefix) from cPanel to your web based installations screen)
- Database password
- Copy the password from cPanel to your web based installations screen)
- cPanel Database Wizard Step 3: Add user to the database
- Important - check All Privileges to allow your new user access to the database
- Continue to the Check page - if there are any php problems, resolve them in PHP Selector.
- If all green, continue with the installation.
Set up the Schedule Using a Cron job
- Go to Cron Jobs under Advanced in cPanel
- Open Add New Cron Job'
- Under cron settings, set as frequently as possible (On many shared cPanel hosts, the minimum allowed cron frequency is every 5 minutes, every minute is not permitted under many hosting plans)
- Check the example of the cron job given eg /usr/local/bin/php /home/your_domain/public_html/path/to/cron/script
- Replace path/to/cron/script with moodle/admin/cli/cron.php and paste into the command line