Moving Moodle to a new server or data center: what the move involves
Moving an existing Moodle out of its current host, network or data center is a copy, verify and repoint job, and its effort depends on the Moodle version, the plugins installed, the size of the database and how much downtime the organization can accept. The work is mostly planning and testing rather than new configuration. The site must come through unchanged in what learners see, so the team that owns the move spends most of its time proving that the copy behaves like the original before anyone is switched over. Confirm early which Moodle version and which database engine the site runs, because both determine whether the target server stack can host the copy without an upgrade in the same window.
Three data sets must move together and stay in step: the database, the moodledata directory and the code. The database holds courses, grades, users and most settings. Moodledata holds uploaded files, backups and caches that the database points to by path. The code holds the Moodle installation and its plugins, and the config file on the source server carries the database connection and data directory paths that the target must match or deliberately change. If any one of the three is copied from a different point in time, files will be missing or links will break, so the cut-over plan should fix a single freeze point for all three.
Before any copy starts, the reader should ask the implementation team to document the source server stack, the installed plugins with their versions, the cron schedule, and every place the site address is written into the configuration or content. Those inventories set the real scope of the move. Plan a rehearsal on a copy of the site at the target, measure how long the database and moodledata copies take, and check that cron runs, email sends and sign-in works before the public address changes. The Moodle documentation on the GitHub repository and the release notes for the target version are the natural references for confirming supported stack components.
Which parts of a Moodle site move unchanged and which need rework
This table compares each component of a Moodle site with its equivalent on the new host and the migration note that applies. Read it as a checklist: components marked as moving unchanged still need verification, and the rework rows are where cutover failures usually start. The main takeaway is that the database, moodledata and code copy across, but the document root, wwwroot, cron and integration endpoints must be set for the new environment before users return.
| Component | Equivalent on the new host | Migration note |
|---|---|---|
| Database | Same engine and version, or a planned transfer to another engine | Copy the dump with the site in maintenance mode. Confirm the engine version meets the target release, such as PostgreSQL 15 for Moodle 5.1 or PostgreSQL 17 for Moodle 5.3. |
| moodledata directory | Same data, placed outside the web root on the new server | Copy with ownership and permissions intact. The web server user must read and write it, but it must not be reachable directly over HTTP. |
| Moodle code | Same release, deployed to the new server path | Match the exact version of the source site. Moving to a newer release is an upgrade, which needs the minimum starting version and PHP checks first. |
| Web server document root | Points to the /public directory in Moodle 5.1 and later | Pointing at the main folder can expose directory listings or cause errors. Set this in the new virtual host before testing. |
| wwwroot setting in config.php | New site address, set for the new host | Change it after the copy, then run the database search and replace tool. Note that the tool does not update several tables, including configuration, log, events and session tables, so review those by hand. |
| Cron | Scheduled job on the new server, running the Moodle cron entry point | Disable cron on the old server before cutover to avoid duplicate scheduled tasks. Confirm the new schedule runs and that task logs update. |
| PHP and server stack | Runtime that matches the target release requirements | Moodle 5.1 requires 64-bit PHP 8.2 or later. Moodle 5.3 requires 64-bit PHP 8.3 or later. Check extensions and cache settings on the new host. |
| Plugins | Same plugin versions, or versions certified for the target Moodle release | Check each plugin against the target release before cutover. Plugins that do not support the new version block upgrades and can break pages. |
| Authentication (for example SAML 2.0 through auth_saml2) | Same identity provider configuration, with the new site as the service provider | Update the Moodle base URL, redirect and assertion consumer endpoints in the identity provider. Confirm which certificates the provider trusts. |
| External integrations (video, file storage, Microsoft 365, LTI tools) | Endpoints and credentials reconfigured for the new site address | Some services register the callback URL and check certificates per host. Ask each vendor whether the endpoint or certificate changes and retest each integration after cutover. |
Documented tools and paths for moving a Moodle site
Moving Moodle means moving four things together: the code, the database, the moodledata directory and the configuration that points at them. Each documented tool covers part of that set and leaves the rest, so the cards below separate what each one changes from what you must still handle yourself.
Database search and replace tool
The core Database search and replace tool rewrites a old host name or path across database tables after you change wwwroot. It does not update several tables, including configuration, log, events and session tables, and it asks you to confirm you understand the risks before running. Check what it skipped, then review those values by hand. Confirm the exact steps in the release notes for your version.
Database dump and restore
Use the native dump and restore utilities of your engine, such as PostgreSQL's or MariaDB's own tools, to copy the database with a consistent snapshot taken while the site is in maintenance mode. The dump moves table data and configuration rows together, so it is the only path that keeps every table intact. Match the engine version and character set on the new server before you restore, and confirm the required version for your Moodle release.
- Minimum for Moodle 5.1
- PostgreSQL 15
Copying moodledata
The moodledata directory holds uploaded files, caches and session data that the database only references. Copy it with the web server user as owner and keep it readable and writeable by that user, but not reachable directly from the web. Confirm the path in config.php on the new server points at the copied directory, and check file ownership after the copy, since a wrong owner causes upload and cache failures that look like application bugs.
Configuration paths in config.php
The wwwroot and dataroot keys in config.php define where Moodle finds its web address and its data. Change them on the new server, and check that dirroot and the web server document root match the new layout. From Moodle 5.1, the document root must point to the /public directory, otherwise the site may show directory listings or errors. Confirm the key names against the config-dist.php file for your version.
Moodle CLI for path and cache tasks
The Moodle command-line scripts run from the code directory and handle tasks that the web interface cannot finish cleanly after a move, such as purging caches, running pending upgrade steps and checking the environment. Run the environment check before cutover so PHP extensions and database versions are confirmed. Also confirm that cron runs as the web server user on the new host, because scheduled tasks stop silently if it does not.
Moodle 5.1 notesVersion and plugin checks
Before cutover, confirm that the Moodle code version, every installed plugin and the PHP version on the new server are compatible with each other and with your database engine. Moodle 5.1 requires 64-bit PHP 8.2 or later. Plugins that do not support the target release can block the upgrade step or leave features broken. Record the plugin list from the old site and compare it against the new code before you copy anything.
How a parallel run and cutover work for a Moving Moodle move
The sequence moves a running Moodle to new infrastructure with a verified copy, a rehearsed freeze window for the final data sync, and a controlled switch of traffic, leaving the old host available until the new site is confirmed.
Inventory the current version, PHP and database
Record the running Moodle release, PHP version, database engine and version, web server, plugin list with versions, cron method, and every external integration such as SSO, LDAP, email, storage and video. Confirm which plugins have releases for the target Moodle version and whether the site can upgrade directly, since Moodle 5.1 requires the site to be on 4.2.3 or later and Moodle 5.3 requires 4.4 or later. The output is a written inventory signed off by the Moodle administrator and the integration owners. The client's team owns the business sign-off, and DeployOpen typically prepares the inventory and the compatibility review.
Build the target stack to match the release
Provision the new servers to the PHP and database versions required by the Moodle release you will run, for example 64-bit PHP 8.2 or later with PostgreSQL 15 for Moodle 5.1, or PHP 8.3 with PostgreSQL 17 for Moodle 5.3. Set the web server document root to the /public directory on releases that use it, and confirm dataroot sits outside the web root and is readable and writable by the web server user. The output is a build record that the stack meets the release's stated requirements, checked against the release notes before any data moves.
Restore a staging copy from a fresh backup
Take a full backup of the database, moodledata and code from the source, then restore them to the target stack as a staging site. Copy moodledata with its permissions and ownership intact, and confirm the code version matches the database schema. Run the upgrade and plugin checks on staging so incompatible plugins surface before cutover. The output is a staging site that loads, logs in, and completes the administration notifications page without errors.
Run search and replace and configuration checks
Set wwwroot on staging to the new address and run the Database search and replace tool to update content that stores the old URL. The tool does not update several tables, including configuration, log, events and session tables, so review those entries and set configuration values by hand in config.php or the admin settings. Check SSL proxy settings, email and cron paths, and external URLs in the authentication and LTI configuration. The output is a checked list of changed values and a staging test in which links, file downloads and embedded media resolve to the new host.
Verify cron and scheduled tasks
Configure the system cron entry on the new host to run Moodle's cron script at the interval you intend to keep, and confirm the scheduled task list shows recent run times for mail, course backups, grade and report tasks. Disable the cron on the old host during the staging phase so both sites do not send email or run tasks against shared data. The output is a task log on the target showing the scheduled tasks completing without errors on staging, and a record of which host owns cron at each stage.
Parallel run and rehearse the freeze window
Run the staging site with a sample of test accounts and a rehearsal of the final data sync, timing each step from the freeze start to the point where the new site serves users. The freeze window is the main downtime lever: put Moodle into maintenance mode, stop cron on the old host, take the final database dump and moodledata sync, restore the delta, and run the checks again. Repeat the rehearsal until the steps are predictable. The output is a written runbook with measured step timings, named owners and a rollback point, approved by the client before production cutover.
Cut over DNS and the load balancer
During the freeze window, complete the final sync, enable the new site, and switch traffic through the DNS record or load balancer pool. Keep the old host in maintenance mode rather than deleting it, so the rollback point stays usable. Confirm logins, course access, file downloads, email delivery and the scheduled tasks on the new host. The output is a cutover log showing when traffic moved, the health checks that passed, and the first monitoring results after users returned.
Decommission the old host after a retained backup
After the agreed observation period, take and store a final backup of the old host, then shut down its services and remove its database and file access. Retain the backup under the client's retention policy so it can be restored if a defect appears later. The output is a decommissioning record listing the retained backup location, the date access was removed and the person who approved it. Confirm the retention period with the client's records and compliance owners before deleting anything.
Why the database, moodledata and code must move as one set
The database, the moodledata directory and the code tree are one system, and they must be moved, copied and cut over together from the same point in time. Moodle's database stores file records that point to content held in moodledata under hash-based paths, so a database copy taken on Tuesday paired with a moodledata copy taken on Thursday will reference files that do not exist, or leave files that nothing refers to. The config.php file ties the three together: $CFG->wwwroot sets the address Moodle generates for every link, $CFG->dbhost, $CFG->dbname and the related database settings point at the database, and $CFG->dataroot points at moodledata. If any one of these still refers to the old server after the move, the symptoms vary: broken images and downloads, login loops or missing sessions, cron tasks that fail silently, and emails containing links to the old site. Before cutover, confirm the three values in the new config.php line by line against the new environment, and confirm the code release matches the database version you copied.
Moodledata needs the same care on the new server as it did on the old one. It must be readable and writable by the web server user, and it must not be reachable directly from the web, which the configuration template explains. Set ownership and permissions on the copied directory before the first page load, because a restore that runs as root often leaves files the web server cannot write, which surfaces later as failed uploads, failed backups or cache errors that look unrelated. Confirm that the web server configuration does not expose the moodledata path, and test this with a direct request to a file you know exists there. The document root is the other place where the new server can differ from the old one. From Moodle 5.1, the web server must point at the /public directory instead of the main Moodle folder, and the release notes warn that getting this wrong can show directory listings or errors. Check the release requirements for your target version before you configure the new web server, not after the first failed request.
Plan the move as a single change window, with the database dump, the moodledata sync and the code deployment taken from the same paused state of the old site. Put the old site into maintenance mode or otherwise stop user writes, take the final database dump, then synchronize moodledata and deploy code. Ask your hosting or platform team to confirm how they will lock the old site and how they will verify that moodledata has no open writes at the moment of copy. Once the new site responds, run a check of cron, the file serving path and a test upload before opening access, because these are the areas that fail when the set is split. If the copy is taken from a live site, the transfer tool in the next section will not repair a set that was never consistent to begin with.
What drives the cost and duration of a Moodle relocation
This table lists the factors that change how much work a Moodle move takes, whether each one adds effort once or every time the site is maintained, and what to ask a partner for in a quote. Read it before comparing estimates, since two quotes for the same site can differ mainly on these points.
| Driver | Why it changes effort | One-time or recurring | What to ask for in a quote |
|---|---|---|---|
| Current and target Moodle version | A move that also upgrades adds upgrade testing, plugin version checks and possibly a staged path from an older release. Target releases have different PHP and database minimums. | One-time | Whether the upgrade is included, the starting and target versions, and the upgrade steps and test passes assumed |
| Database and moodledata size | Larger databases and file stores take longer to copy, verify and restore within the downtime window, and raise transfer bandwidth needs. | One-time | Measured database size and moodledata size, the copy method, and the verification steps in the plan |
| Third-party plugins | Each plugin needs a version match, compatibility check and functional test on the new server. Unmaintained plugins may need replacing or removing. | One-time, plus ongoing if plugins are kept | A plugin inventory with versions, which plugins are tested, and who decides on replacements |
| Integrations (SSO, LDAP, external database, LTI, storage) | Each connection has its own endpoints, certificates, IP allowlists and test accounts that must be repointed and checked after cutover. | One-time for cutover, recurring for monitoring | A list of every connected system, who owns each one, and the test cases for each |
| Change of database engine or PHP version | Switching engines or PHP versions adds a database transfer step and a wider regression test, and can change server configuration. | One-time | Whether an engine change is in scope, the target engine and PHP versions, and the regression test coverage |
| Acceptable downtime | A short cutover window needs rehearsed copy, sync and rollback steps. A longer window allows simpler sequencing but may still need a final data sync. | One-time for planning, recurring if a rehearsal is repeated | The agreed downtime window, the rehearsal count and the rollback plan |
| Number of environments to test | Each environment (development, staging, production, disaster recovery) needs its own copy, configuration and test pass, and sometimes its own cron schedule. | One-time for setup, recurring while environments stay in use | How many environments are built, which are kept after go-live, and who maintains them |
| Cron, cache and data path setup | Cron tasks, the web server document root, dataroot permissions and cache settings must be reconfigured and verified on the new host. | One-time, with ongoing monitoring | The checklist used, the cron and dataroot checks performed, and the handover documentation |
What usually goes wrong in a Moodle move and how to prevent it
Most failed Moodle relocations come from a short list of recurring gaps: database rewrites that skip tables, URLs that still point at the old host, and services that were never started on the new server. Each card below names one risk, what it looks like after cutover, and the check that prevents it. Run these checks against a rehearsal copy before the production cutover.
Search and replace misses key tables
The database search and replace tool does not update several tables, including configuration, log, events and session tables. If old host names remain in those tables, settings and scheduled events can keep pointing at the old environment. Before running the tool, confirm you understand the listed risks, then run it on a restored copy and search the database for the old hostname in the tables it skips. Treat any remaining references as a manual fix with a documented owner.
Search and replace stringsWwwroot still points at the old host
If $CFG->wwwroot in config.php still names the old server, users get redirected to the old address, links in emails and course content break, and login sessions can fail across the two hosts. Set the new address in config.php before the first test login, then confirm that the site, the login page and a sample course resolve only to the new hostname. Check the reverse proxy and any load balancer rules so they forward requests to the new site and not the old one.
Document root shows directory listings
From Moodle 5.1, the web server document root must point to the new /public directory rather than the main Moodle folder. If the server still serves the main folder, the site can show directory listings or errors instead of the login page. Update the Apache or Nginx virtual host on the new server before cutover, reload the web server, and confirm that code outside /public is not reachable by URL. Ask the team that owns the web server to test this on the rehearsal host.
Plugins missing or incompatible on target
A plugin installed on the old server may not exist on the new one, or may not support the target Moodle version or PHP version. Missing or incompatible plugins can block the upgrade or leave blocks and activities showing errors for users. Build a plugin inventory from the old site, check each plugin's version support for the target release, and install the matching builds on the rehearsal server before cutover. Record any plugin you cannot replace as a decision for the business owner.
Cron stops on the new host
Cron runs scheduled tasks such as email delivery, log cleanup, course completion and the grade and enrolment syncs. If the cron job was never configured on the new server, or still runs on the old one, tasks stop quietly and notification emails no longer arrive. Create the cron entry on the new host, confirm it runs as the web server user, disable the old job before the first live day, and check the scheduled task report in the site administration area for recent successful runs.
Moodledata permissions too open or closed
The moodledata directory must be readable and writeable by the web server user but must not be reachable directly through a browser. Permissions that are too closed break uploads, caching and backups, while permissions that are too open or a web-accessible path expose uploaded files to anyone with a URL. Set ownership to the web server user, restrict other users, keep the directory outside the web root, and test both an upload and a direct URL request to a stored file, which should be refused.
Questions buyers ask before moving Moodle to a new server
What does it cost to move Moodle to a new server?
The cost depends on the scope written into the quote, not on a list price. The main components are the planning and inventory work, the staging rehearsal, the production cutover, and the checks afterward. Cost goes up with database size, the number of plugins and custom themes that must be verified, the number of integrations that point at the site (identity provider, HR feed, video, storage), and how tight the downtime window must be. Costs that recur are hosting, backups and any ongoing support retainer. Ask for a quote that lists each phase, what is excluded, and who performs the cutover. DeployOpen does not publish prices and quotes follow from the written scope.
How long does a Moodle server move take?
The window is set by the size of the database and moodledata, the speed of the network between the old and new environments, and how much testing the site needs before the switch. A rehearsal on a copy of production is the step that most often determines the timeline, because it reveals plugin incompatibilities and configuration gaps early. Ask for a schedule that separates the rehearsal from the production window, and confirm which change freeze your academic calendar requires. Avoid cutovers during enrolment, assessment or exam periods.
Can our own team move Moodle without a partner?
Yes, if you have people who can copy the database, moodledata and code consistently, change the web root and wwwroot, run cron, and verify plugins. The work is well documented in Moodle's own guidance, but the risk sits in the details: stale caches, mismatched file paths, plugins that were not built for the target PHP version, and integrations that still point to the old address. A partner is most useful when the team has not done this before, when the site has many integrations, or when the move must happen inside a short window. Be honest about your staff's capacity before deciding.
What do we need to provide for a Moodle move?
The engagement needs administrator access to the current site, shell or SSH access to the source and target servers, read access to the database and moodledata, and a test environment where the rehearsal can run. You also need a named owner for each integration, such as the identity provider, the HR or student information feed, the video service and any storage or payment tools, because each one must be checked after the move. Provide the plugin list with versions, the custom theme code, the current cron setup and the backup schedule. Agree who approves the cutover and who can roll back.
Should we upgrade Moodle at the same time as moving it?
Usually not in the same change window, because combining a host move with a version jump makes it hard to tell which change caused a problem. Check your current version first. Moodle 5.1 requires 64-bit PHP 8.2 or later and PostgreSQL 15, MySQL 8.4, MariaDB 10.11 or SQL Server 2017 or later, and sites must be on Moodle 4.2.3 or later to upgrade. Moodle 5.3 requires 64-bit PHP 8.3 or later, PostgreSQL 17, MySQL 8.4, MariaDB 11.4 or SQL Server 2019 or later, and sites must run Moodle 4.4 or later. If the new server must run newer PHP or database versions, the move and an upgrade may be unavoidable together, so plan them as separate, sequenced steps with their own rollback points.
How do we confirm the cutover worked?
Confirm it with a written checklist rather than by eye. Check that the site loads at the new wwwroot without mixed content or directory listings, that the web server document root points to the correct folder (from Moodle 5.1 onward, the /public directory), that cron runs and its last-run time updates, and that users can sign in through each identity provider. Run the Database search and replace tool with care, because it does not update several tables, including configuration, log, events and session tables, so check those values directly. Confirm that moodledata is readable and writeable by the web server user and not reachable directly from the web. Test a course backup, a quiz submission, a file upload and an outbound email, then keep the old server read-only until sign-off.
What goes wrong most often in a Moodle move?
The most common failures are a web root that still points to the old code folder, leaving the site showing errors or directory listings, and a search and replace that misses configuration or session data, so links and sessions behave oddly after the switch. Cron that was not re-created on the new host causes missed emails, grade syncs and cleanup tasks. Plugins built for an older PHP version or missing from the new code produce fatal errors. Moodledata permissions that are too open, or reachable from the web, create a security exposure that a rushed move can leave in place. A rehearsal and a written checklist catch most of these before users arrive.
How the phases of a Moodle move connect, and where failed checks send you back
The move starts with a source inventory of the Moodle code, database, moodledata and plugins, then takes a backup of the database and moodledata into a restore on staging built on the target stack. Search and replace and the configuration update come next, followed by plugin and cron checks. Any failed check loops back to staging before the parallel run, where a final delta sync precedes cutover. The old server is decommissioned only after the new site has run cleanly. Note: the search and replace tool does not update configuration, log, event or session tables, so those need explicit attention.
Phases of a Moodle move, with failed checks returning to staging.
How DeployOpen scopes and delivers a Moodle relocation
DeployOpen approaches a Moodle relocation as a fixed-scope piece of work inside infrastructure you control. We agree the source and target environments, the cutover window and the verification steps in writing before any copy begins, so the move can be reviewed and repeated.
How we scope
- We inventory the current Moodle version, PHP and database versions, plugins, moodledata size and external integrations.
- We confirm the target server stack, web server document root and data center or cloud account where the site will run.
- We agree in writing the cutover window, acceptable downtime, rollback point and who signs off each stage.
How we build
- We rebuild the target stack, copy the database, moodledata and code, and check file permissions for the web server user.
- We set the new wwwroot, run the database search and replace tool with a documented list of tables it does not update, and fix the rest by hand.
- We verify plugin compatibility, configure cron, test sign-in and email, and run a rehearsal copy before the production cutover.
How we hand over
- We deliver a runbook covering each cutover step, the rollback procedure and the post-move checks that were run.
- We document the final configuration, cron schedule, backup locations and any plugin changes made during the move.
- We walk your administrators through the new environment so they can operate it without us.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers after the relocation is complete.
- We can help you plan the next Moodle upgrade on the new server, using the version requirements that apply at that time.
- We confirm with you what monitoring and backup checks your team will own after handover.

