InMotion Hosting Support Center

Upgrade from Moodle 2.5 to Moodle 2.6 in testing environment

Category: Moodle

2013-11-20 6:17 am EST

Hits: 2,377
I have Moodle 2.5 installed on my server, with courses filled with videos, ltis, quizzes questionbanks and students progressing.

Seeing 2.6 is the most stable version right now with more features. I wanted to inquire whats the best way to move the whole website to a new location having all better functionalities.

Right now, because i purchased the SSL certificate after populating my course, my SSL is only on Login page, as for other the videos doesnt seem to work and other problem i face, so i want a clean move to a new location which will be secured over all.

My host: I am using inmotion VPS, but using it just like a shared hosting. So some guidance here would be great. I can use phpmyadmin to move the databse.

So hence, what kind of Database format should i make, and what to edit inside the db. As i am using Cpanel mostly, what would be the subsituite of the step below,

(b) The second method is to backup the Moodle database first, then use the search and replace feature of your text editor (or use a unix tool like sed) to replace the old URL with the new one in the mysql backup file. Here is an example sed command:
#sed -e 's/' oldmysqldump.sql > newmysqldump.sql
NOTE: This second method will not replace text in blocks because they are stored base64 encoded in the database, so any links in blocks will not be fixed. Therefore you should consider using the replace tool after you migrate if you use this second method.
TIP: You may want to check the mysqldump file to see how the old server was referenced.
After changing the URL, restore the mysql database

Furthermore in the first step, does the replace.php completely move the website? As i was thinking to CLONE it. Which will not loose the data or progress of the student until i completely move to a new webpage.

Because i tried earlier the following steps:

I installed a fresh Moodle, and tried changing the database to the earlier database. But it gave me import error after i completely deleted the database of Moodle 2.6 and changed it to the one i had it on my old location, but didnt work well in that case.

Bottomline: Right now my portal is at i want to clone it fully to while both work fine. Until we check, test and migrate completely.

You must login before you can ask a follow up question.

You must login before you can submit an answer.



11,186 Points
2013-11-20 9:23 am EST
From taking a look over Moodle's documentation on their upgrade process to 2.6, it does appear to be fairly straightforward. Here is what you would need to do:

  1. Make a backup of your database

  2. Create a new database that Moodle will use

  3. Download the newest version of Moodle from their website and uload the files contained in the zip file to the directory that you want Moodle to be located in.

  4. Edit your config.php in the new Moodle directory to reflect your new database name/user/password.

  5. Import your database that you previously dumped into the new database that you just created.

  6. Edit that new database via PHPMyAdmin to replace any instances of the old URL to the new URL. To do so, you can simply use the search function to search for any instances where the domain exists.

  7. Complete the upgrade process by going to Administration > Site administration > Notifications within your Moodle dashboard. Moodle should detect your new version and begin upgrading your database.

For additional reference, you may also view the Moodle 2.6 upgrade process within their official documentation.

You must login before you can post a comment about this answer.

And do I have to move a folder from old directory to the new one? As where would be the media files be? The attached videos and pictures. .

Furthermore J, does the host add support to upgrade/move moodle? By submitting a ticket?
55 Points
2013-11-20 10:37 am EST
Hello saadsaleem,

I don't think you'd have to move your /moodledata directory if you're talking about doing this on the same server, in place, but just a different directory. But for best practice it might be something to keep in mind.

You can see from the Moodle docs that the moodledata directory is used for "folders called cache, filedir, lang, temp, trashdir and possibly also sessions and upgradelogs and repositories."

So if you have both your live and cloned install using the same /moodledata directory to cut down on redundant disk-space being used for storing the same images and media during your testing phase, and then you upgrade the cloned install, it might possibly do something with those other folders or interfere with the sessions between the two sites.

You were on the right path as this is simply a Moodle migration, but you'd just be keeping both live until your done with your testing, and then move it back to replace the original.

To take an old Moodle site at and clone it to to then upgrade and test, you can follow these steps:

  1. Create /public_html/test directory
    Download the latest version of Moodle to the /public_html/test directory
    Extract the Moodle files, then move the /public_html/test/moodle directory it creates to /public_html/vlp

  2. Create a new database

    Fill in your new database information into the /public_html/vlp/config-dist.php file, then re-name this to /config.php. You could also copy your /public_html/config.php file to /public_html/vlp/config.php then modify it to use the new database, but according to the Moodle docs, 2.6 has more/different options available so it's a good idea to use that template.

  3. Change $CFG->wwwroot in your /public_html/vlp/config.php file to reflect /public_html/vlp
    Your $CFG->dataroot in your /public_html/vlp/config.php file should reflect /moodledata2
    If you had any custom plugins, be sure to copy your /public_html/theme/mytheme and /public_html/mod/mymod to /public_html/vlp/theme/mytheme and /public_html/vlp/mod/mymod respectively

  4. Copy your /moodledata directory to something like /moodledata2 on the same level, and make sure it retains the same permissions as the original

  5. Place Moodle in Maintenance mode so no further database changes are made

  6. Backup your database

  7. Either manually open up your databasename.sql file and search for instances of and replace them with or you could login to your server via SSH and run the sed command on your database dump:

    sed -e '' databasename.sql > databasename-NEW.sql

  8. Import your modified database in phpMyAdmin to the newly created database
    You could also try to navigate to or in older versions to use the Moodle replace method.
    Or you could use phpMyAdmin's Search function to find instances of and then just modify them to be

  9. To finish the upgrade go to Administration > Site administration > Notifications. Moodle should detect if your core files or database is out of date and upgrade it.

    You should also go to Administration > Site administration > Development > Purge all caches after you finish the upgrade

Hopefully that information leads you down the right road, we don't currently offer a service where we handle the upgrade/move of Moodle. But if you've got any further questions at all, we'd be glad to help!

- Jacob
9,968 Points
2013-11-20 1:56 pm EST
Like this Question?

Related Articles

Support Center Login

Our Login page has moved, Click the button below to be taken to the login page.

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!