User:James Steerpike
From MoodleDocs
Shared Hosting
Installing Moodle 5 on shared hosting using Git involves cloning the official Moodle repository directly into your web directory via cPanel’s Git Version Control. This method streamlines updates and management by pulling the stable Moodle 5 branch (MOODLE_500_STABLE) from GitHub. After cloning, a Moodle data directory is set up outside the web root, php is configured, a database and user is added and the web-based wizard completes the installation.
Set up PHP for Moodle
- Log in to cPanel and click on Select PHP Version or PHP Selector.
- Choose PHP 8.2 (or higher, up to 8.4) 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 as needed:
- 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.
Copy moodle code into the web accessible folder
- Open Git Version Control in the cPanel dashboard and clone the Moodle Repository
- Click Create to set up a new repository.
- Select Clone a Repository.
- Enter the official Moodle Git repository URL: https://github.com/moodle/moodle.git
- For the Repository Path:
- If you want your moodle to open directly in your domain, enter: public_html
- If you want your moodle to open as your domain/moodle, enter: public_html/moodle
- Once the repository is created, select "Manage
- Select Moodle_500_Stable and click "Update"
To keep your Moodle up to date, periodically go back to this version control page and select Update to keep this Moodle 5.0 up to date.
Set up a MySQL database
- Scroll to the DATABASES section and open the MySQL® Database Wizard
- Enter the Moodle database name ("moodle" is usual)and go to the Next Step.
- Enter the username (`moodleuser` is usual). Enter a strong password, confirm it and click Create User. Make sure you write the username password down.
- On the next screen, select All Privileges to give full access to your username and click Next Step to apply.
- Write down the full database name and username (they may be prefixed by your cPanel account name, e.g., `cpaneluser_moodle`) along wiith the password you created
- Open phpMyAdmin and check
- Character set: Use utf8mb4 (full UTF-8 support) to handle all Unicode characters.
- Collation: Use utf8mb4_unicode_ci for case-insensitive, language-aware sorting
- Check type of database created ie mySql, MariaDB, PostgreSQL are the most likely.
Create the moodledata folder
- Go to File Manager in cPanel
- Navigate to your home directory (one level above `public_html`).
- Click + Folder and create a folder named `moodledata` in your home directory.
- Check this folder is NOT inside public_html as it will store user files and must not be able to be accessed by the web.
Set File Permissions
- Go to File Manager in cPanel
- Right click on public_html and set permissions to 750
- Right click on moodledata and set permission to 750
Web based Moodle Installation
Go to `https://yourdomain.com`) and follow the instructions. You will need to know:
- Database type: MySQL or MariaDB (from phpMyAdmin) - Database host: `localhost` - Database name: full database name from cPanel - Database user: full username from cPanel - Database password: the password you created - Data directory: full path to the `moodledata` folder you created