Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Sergey Muha -
Number of replies: 38
Hello Community.

I have task to migrate from WIN 2003/mysql 5.1 to linux/mysql 5.5 server for moodle

For win serverI have 1.9.5 version for moodle . I install pure 3.0 moodle on new linux server and try to mysqldump moodle database on new environment.

But in mysql guide I found that for new version mysql is more column in mysql SCHEMA but I dump only moodle database, not all databases.

When I restore backup from 5.1 to 5.5 mysql on linux moodle fell
maybe somebody face this kind of issue already and can share his experience with me.

Thank you anyway


Average of ratings: -
In reply to Sergey Muha

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

You cannot jump from 1.9 to 3.0.  There are several steps along the way.  Please read the upgrade instructions.

I recommend migrating the original site first (follow migration instructions) and then start the upgrade process.  You will need your moodledata as well as the database, your config.php file from the original installation and any plugins that you have added.

You will need to go to latest version of 1.9, then 2.2, then many go to 2.3 and 2.7 before the final 3.0 or 3.1 jump.


In reply to Emma Richardson

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Sergey Muha -
Thank you for reply.

The reason why I try to do this is because phisical server for 1.9.5+ fail some time and we bougth new one.

I decided to setup clean moodle system with latest version on Linux and migrate all users and some courses to new server.

Main goal is to save users accounts . If I understand rigth they all store in my moodle database and if I backup database from old server to new one  users should appear in moodle.

But when I am doing this moodle crash.

I think it is because of different version mysql server. 5.1 - old . 5.5 - new.
In reply to Sergey Muha

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

That is the least of your problems. You cannot restore a 1.9 database into a 3.0 site. They are not compatible. If all you have is the database and you do not have the Moodle data folder you are not going to get your courses back fully, if at all. You need to start with a new 1.9 and see if you can at least get part way up and running before trying to upgrade.

In reply to Emma Richardson

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Sergey Muha -

If I understood rigth

I need to setup 1.9 version, upload moodledata folder and database and look will it work for me or not?



In reply to Sergey Muha

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Ken Task -
Picture of Particularly helpful Moodlers

It really would be helpful to know which/what Linux version.

Have a 1.9.19+ Moodle running on CentOS 5 with PHP/5.5.35 and mysql  Ver 14.14 Distrib 5.5.37 just fine ... although it's not accessible to the globe any longer for obvious reasons.

First, check that you have the original mysql dump (sql) from the other server still.
That really is your only backup.

When going from MySQL 5.1 to 5.5 one *MUST* run
mysql_upgrade -u root -p
Also, might need to force the system to do that with --force

mysql_upgrade --force -u root -p

That, hopefully, will take care of the DB differences.

What you are doing is called a migration and is best done by first getting the version you have (the old 1.9.x) onto the new server and running first.   Above mysql_upgrade is one of those steps.

Your next step is to upgrade the  1.9.5+ to the highest 1.9.19+.

That provides a bunch of fixes.  There are moodle docs on how to do that.

But then there comes a decision point ...

IF one attempts to update a 1.9.highest to a 2.2.highest one will get users across **BUT** the new file system will put all files from the 1.9 into "legacy" ... no option/choice.   That's not the new file system and once a course is in Legacy there is only the option of stopping at a certain version of 2.3.x (not the highest) and then doing a workaround restore of all courses to rid the course of Legacy files.  Otherwise those courses are stuck in 'legacy' forever.

Another option is to install a fresh 2.highest and attempt to restore courses from backups of the 1.9.highest ... but, while the content will come in ... users won't ... and again ... legacy file system.

OR ... might be the least painful ... install a fresh 2.highest and rebuild the courses in native 2.   You can locally unzip the 1.9.x backups to acquire the files contained in them by 'humanly recognizable names' and upload those in courses ... that puts those files now in the new file system.

*USERS* ... export a CVS list of 1.9.highest users ... import them into the 2.

That will get users in ... but you still have the job of assigning users levels (Teacher/Student etc.) AND put them into appropriate courses, etc..

No easy button.   But one should kinda expect that ... 1.9.veryold -> 2.x.highest.

'spirit of sharing', Ken





In reply to Ken Task

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Sergey Muha -

Hi Ken

Old setup is WIN 2003 server +  5.1.56-community MySQL + Moodle 1.9.5+

I use for test environment Ubuntu 12.04.5 LTS \n  5.5.49-0ubuntu0.12.04.1 (Ubuntu) now but for real server I will use Ubuntu 14.04.4 LTS 

On WIN server I have mysqldump and dumped base  already.

mysqldump -u usermood -p moodle > onlymoodledb.sql

and now I am executing

sudo mysql -u root -p -h localhost moodle < onlymoodledb.sql on Linux VM(test)

But version moodle is 3.0

Do I need to reinstall it ?!

Also this output from WIN MYSQL

Connection id:          3915
Current database:
Current user:           root@localhost
SSL:                    Not in use
Using delimiter:        ;
Server version:         5.1.56-community MyS
Protocol version:       10
Connection:             localhost via TCP/IP
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    latin1
Conn.  characterset:    latin1
TCP port:               3306
Uptime:                 16 hours 12 min 48 s

And this from Linux MYSQL


Current user:           root@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         5.5.49-0ubuntu0.12.04.1 (Ubuntu)
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    utf8
Conn.  characterset:    utf8


In reply to Sergey Muha

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Ken Task -
Picture of Particularly helpful Moodlers

So we are migrating to a different platform as well - oh what fun!

Again ... from previous post ...

When going from MySQL 5.1 to 5.5 one *MUST* run
mysql_upgrade -u root -p
Also, might need to force the system to do that with --force

mysql_upgrade --force -u root -p

That, hopefully, will take care of the DB differences.

You do that on the Ubuntu server you have at present.

Emma has already told you and it's true ... **** cannot hyperjump from 1.9.x to 3.highest **** skipping version 2 entirely.   You must first get the 1.9.5+ running on the Ubuntu box *but* right after importing the MySQL 5.1 dump into MySQL 5.5, you *MUST* do the mysql_upgrade.

You can then work on getting the 1.9.5+ to 1.9.19+.

You can read this:

https://moodle.org/mod/forum/discuss.php?d=205367

which appears to have a certain level of true MySQL understanding.

** IF you want to avoid legacy files and some other quirks on migrating, then one could start with a fresh 3.1 - blank - no courses - no users ... different database, different code directory, different moodledata, and begin to rebuild courses in the new environment following the 1.9 site as a guide.

Don't think attempts at restoring a 1.9.x backup to a 3.1 will get you further down the road ... again ... no easy button - and no easy path for migration ... Win -> Linux is first step.   1.9.5+ -> 1.9.19+ second step.

Decision point ... continue with migration of the 1.9.19+ upwards or not ... if a go ...

1.9.19+ -> 2.2.highest

Stop at the point and check.  Everything OK?   The do a full site backup ... code, data directory and DB dump.   This becomes your fall back point IF the next upwards step you take doesn't work out.

Stopping points .... 2.2.highest to at least 2.6.highest .. at that point address quiz engine and conversion of Assignments.   If that goes well, full site backup of the 2.6 site ... fall back point ... then

2.6.highest to at least 2.9.highest.

Since you are on linux now, you might check out git:

https://docs.moodle.org/29/en/Git_for_Administrators

While that link says 2.9 don't believe that means you can hyperjump as you would like to ... git could be used for the 1.9.6+ to 1.9.19+ upgrade.

And it could be used to upgrade the 1.9.19+ to a 2.2.highest as well as any version upwards after that.


'spirit of sharing', Ken







In reply to Ken Task

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Sergey Muha -

Thank you very much Ken.

I will try  follow this steps.


In reply to Sergey Muha

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi Sergey

What you want is not a mere https://docs.moodle.org/19/en/Site_backup and then a https://docs.moodle.org/30/en/Site_restore rather TWO things:
1. https://docs.moodle.org/19/en/Moodle_migration (Windows to Linux, MySQL 5.1 to 5.5, ...)
2. https://docs.moodle.org/30/en/Upgrade (1.9 -> 3.0)

It is never a good idea to do two things at a time. Do one, say the migration. Only after testing thoroughly go in to upgrading. Note that your's is a very long jump, across 12 Moodle versions! Others have given advice on things which can go wrong. Always keep a return route free!
In reply to Visvanath Ratnaweera

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Sergey Muha -

Dear Community

I did next step. I installed fresh 1.9.5+, restored database and sucsessfuly upgrade to 1.9.19

Now I am trying to upgrade to 2.2.11 or 2.0.1 and always received next error

System

Table "upgrade_log" already exists

More information about this error

Stack trace:
  • line 469 of /lib/ddl/database_manager.php: ddl_exception thrown
  • line 93 of /lib/db/upgrade.php: call to database_manager->create_table()
  • line 1394 of /lib/upgradelib.php: call to xmldb_main_upgrade()
  • line 236 of /admin/index.php: call to upgrade_core()
I read https://moodle.org/mod/forum/discuss.php?d=149587 but didn't understand is it my case or not.

according to this https://moodle.org/mod/forum/discuss.php?d=148028&parent=668249
I did next but with no luck

Solution to upgrade:

1) Configure PHP to handle post_max_size and upload_max_filesize enough to files in moodledata
2) Configure PHP max_execution_time and max_input_time to '-1' (no timeout at all - dangerous, not recommended)
3) Configure PHP memory_limit to '-1' (PHP can use all memory it takes - dangerous, not recommended)
4) Execute upgrade from server shell as root or httpd server user (www-data, nobody, other)

Maybe somebody can help me with this issue

Thanks in advance

Attachment error_screen.jpg
In reply to Sergey Muha

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Ken Task -
Picture of Particularly helpful Moodlers

I hope you backed up the database after successful upgrade from 1.9.5+ to 1.9.19+ **and** the data directory.

The next step ... that of 1.9.19 to 2.2.highest is the most intensive.
*Massive* changes to not only the DB but also moodledata.

The error link goes no where because documentation goes back only to 2.7 (supported version).

First forum link goes back to 2010 and points to something fixed for version 2.0 of
Moodle.  If you noticed on that forum thread, the poster ran into the next
problem ... that of migrating course files from old 1.9 storage to new 2.x, 3.x
filedir and new storage system.   No response to that report.

@nd link to the other forum same kinda thing ... 2010 ... 2.0.x+ this time.
This time a reference to the DB requirements.

Evidently, none could resolve that problem then ... so there's less chance now (me thinks).   No one is gonna go back to old versions of 2.x to fix it.

Which brings us back to advice given before relating to upgrading the DB
"right after importing the MySQL 5.1 dump into MySQL 5.5, you *MUST* do the mysql_upgrade."

Did you do that step?

*IF* you have a backup of the 1.9.19+ database AND a backup the 1.9.19 moodledata
directory, the only thing I'd suggest is this ... an attempt to upgrade failed at a
point right after creating that table it's now complaining about.   So,
think I'd try to drop the table then resume the upgrade.

I'd tweak database settings upwards first ... specifically:
max_allowed_packet=500M
open_files_limit=6000

The values given *are guesses* ... better more than enough than not enough at this point, me thinks.

Those are two items I seem to recall causing issues when marching a 1.9 to a 2.x a year or so ago.   Tweak DB does require restart of MySQL service.

If it fails again, restore the backup of the moodledata directory, the 1.9.19 database and attempt the upgrade to 2.2.11 again.

At this point I'd have to say that anyone going from 1.9.x all the way to 3.x has
to have extensive knowledge of Moodle ... definitely tools for DB etc.

How much time do you have?   How much knowledge can you acquire?   Why do I ask such questions?   Not sure there is anyone in these community forums that could/would
help at this juncture.

If constrained ... i.e., you don't have time to acquire the knowledge (on the job training really), then one might have to take this approach:

Backup courses in the 1.9.19+.
Install a fresh 3.x.
Attempt to restore the 1.9.19+ backups knowing that users will not come in and any module or block that was in the 1.9.19+ course backup that doesn't exist in
Moodle 3.1 might/will cause issues ... either they won't show (understandable) or, hopefully not, Moodle will let you know it can't restore that item.

That might be a lot of courses and take a couple of days, but .... dunno what option/choice one has.

Lesson to be learned?   How about don't get so far behind version wise in Moodle. :\

'spirit of sharing', Ken

Average of ratings: Useful (1)
In reply to Ken Task

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Ken

You said:
> The error link goes no where because documentation goes back only to 2.7 (supported version).

Are you sure? There is a complete https://docs.moodle.org/22/en/, then why are those error messages missing?
In reply to Visvanath Ratnaweera

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Ken Task -
Picture of Particularly helpful Moodlers

In the interest of correctness:
The 'More information about this error' goes to:

https://docs.moodle.org/19/en/error/moodle/ddltablealreadyexists

which contains no info.

IF using the dropdown menu on link above, doesn't show any but 'supported' versions.

One has to know to change the number of version in the  URL, thusly:

https://docs.moodle.org/22/en/error/moodle/ddltablealreadyexists

which also begets nada/zip/nothing.

Drop down menu there shows a different list ... 2.2 docs -> 2.7, 2.9, 3.0 and 3.1 docs (skips 2.8).

So for this particular issue ... no information seems to be available to point the op to in efforts to help the op find a solution - which is what these forums are supposed to be about! ;)

'spirit of sharing', Ken

In reply to Sergey Muha

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Ken Task -
Picture of Particularly helpful Moodlers

There is one other option ...

Basically, install a fresh 3.1 and rebuild courses using the new interface/mods/blocks and file system.

All is not lost from the 1.9.19+ courses.   Backup those courses ... no users ... download those backups and store on local machine.    Unzip the backups.   In the un-zipped directory of what was contained in the 1.9.x backup is a files directory.   Therein, all the files that were in the 1.9 course by their humanly recognizable names.

At least one has the files used in those courses to re-upload to the new courses as they are being rebuilt.

The quizzes of the 1.9 might be exported and then imported into the 3.1.   Expect some issues there with images ... I seem to re-call that some where back many moons ago.   No biggy, just re-upload the images.

This approach has a major plus ... teachers will have to learn the new interface/mods/blocks etc. behaviors anyway.   Does give teachers time to pause and reflect if this activity or that was all that effective ... and decide upon same approach or something new/different.

Sometimes the 'path to least resistence' ... isn't ... but there are +'s to taking a slightly less than desired approach ... considering where one will end up *IF* on were successful in migrating a 1.9 site to 3.x.   One major ... none of the migrated sites courses will be using the new file system ... all of those courses are in what is called 'legacy'.   And from what I understand, a course, in legacy, is in legacy forever.   To get it out of legacy one has to do almost as much work as rebuilding a course.

'spirit of sharing', Ken



In reply to Ken Task

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Sergey Muha -
Hello all

I have tried update many times but with no luck.  I think database have big differense between versions .

We decided to migrate to linux environment and upgrade to 1.9.19 version

It works fine, but after upgrade I recieved many errors

Notice: Undefined property: stdClass::$sec in/var/www/html/moodle/lib/moodlelib.phpon line 1186

Notice: Undefined property: stdClass::$mins in/var/www/html/moodle/lib/moodlelib.phpon line 1187

There was more errors like those but I fix them adding $object= new stdClass(); before error line.

But in this error

code is

...

$ss = ($secs == 1)  ? $str->sec  : $str->secs;
    $sm = ($mins == 1)  ? $str->min  : $str->mins;

....

adding $str= new stdClass(); didn't help.

Could somebody help me

I don't have expirience with php.

Thanks in advance
Sergey
In reply to Sergey Muha

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
> We decided to migrate to linux environment

So you first migrated the Moodle 1.9.5 from the Windows environment to Linux? What is the Linux environment exactly (the distribution, its version, versions of the webserver, PHP, MySQL)? How did you do it exactly? Did you follow https://docs.moodle.org/31/en/Moodle_migration to the dot?

> and upgrade to 1.9.19 version

Same question. How exactly?

> It works fine, but after upgrade I recieved many errors

What does that mean? Was the operation successful or not?

> Notice: Undefined property: stdClass::$sec in/var/www/html/moodle/lib/moodlelib.phpon line 1186

That sounds like a major problem, mismatch in PHP versions/modules, broken config.php, ...?

> adding $str= new stdClass(); didn't help.

Luckily. Otherwise you'll end up with a monster!
sad
In reply to Visvanath Ratnaweera

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Sergey Muha -

Hello Visvanath

Ubuntu 14.04.4 LTS \n \l

Server version: Apache/2.4.7 (Ubuntu)

mysqld 5.5.49-0ubuntu0.14.04.1

PHP 5.5.9-1ubuntu4.17 (cli) (built: May 19 2016 19:05:57)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies


I installed fresh 1.9.5  version moodle and after this imported my mysql dump from win server . Then did mysql_upgrade --force

Then I install 1.9.9 by remove 1.9.5 file and copy 1.9.19 file in /var/www/html/moodle , gave permissions and continue install in browser 

Update was successful http://nonprod.minsk.edu.by/

But as i post above

this error appeared . It is seeing after login

> Notice: Undefined property: stdClass::$sec in/var/www/html/moodle/lib/moodlelib.phpon line 1186

In reply to Sergey Muha

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Ken Task -
Picture of Particularly helpful Moodlers

Check out the head of your config.php file with the head of config-dist.php.
Somewhere along the line in the 1.9.x -> series there were some lines added to the top of the config.

In a 1.9.19+  the top two lines should be:

unset($CFG);  // Ignore this line
$CFG = new stdClass();

Beginning 2.0 ->

unset($CFG);  // Ignore this line
global $CFG;  // This is necessary here for PHPUnit execution
$CFG = new stdClass();

Those introduced in vr 2 of Moodle still present in 3.x.

That line has to do with calculating minutes/seconds etc.

New installs of PHP don't set time zone ... done in php.ini
Check yours.

'spirit of sharing', Ken


In reply to Ken Task

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Sergey Muha -

Hello Ken

Thanks for reply but I did that already

<?php  /// Moodle Configuration File

unset($CFG);

$CFG = new stdClass();
$CFG->dbtype    = 'mysql';
$CFG->dbhost    = 'localhost';
$CFG->dbname    = 'moodle';
$CFG->dbuser    = 'usermood';
$CFG->dbpass    = '
$CFG->dbpersist =  false;
$CFG->prefix    = 'mdl_';

$CFG->wwwroot   = 'http://nonprod.minsk.edu.by';
$CFG->dirroot   = '/var/www/html/moodle';
$CFG->dataroot  = '/var/www/html/moodledata';
$CFG->admin     = 'admin';

$CFG->directorypermissions = 00777;  // try 02777 on a server in Safe Mode

$CFG->passwordsaltmain =

require_once("$CFG->dirroot/lib/setup.php");
// MAKE SURE WHEN YOU EDIT THIS FILE THAT THERE ARE NO SPACES, BLANK LINES,
// RETURNS, OR ANYTHING ELSE AFTER THE TWO CHARACTERS ON THE NEXT LINE.
?>

In reply to Sergey Muha

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Ken Task -
Picture of Particularly helpful Moodlers

It was a thought and I had experienced issues on a march of one site ... 1.9.19+ to a version 2.x years ago one time and that addition to the config file corrected some errors.

Do know, one should not be required to add/hack code and it's not advisable to do so.

The notice you are seeing can be seen in multiple open sourced apps ... joomla, drupal, etc.

https://www.google.com/search?q=Notice%3A+Undefined+property%3A+stdClass&ie=utf-8&oe=utf-8

Following any of the links found above and one will see many (if not all) were specific to whatever was being developed, etc..

Seem to re-call that one had to move PHP upwards as one went along in the Moodle March.   PHP 5.3.x on CentOS servers ran Moodle =<- 1.9's just great.   So wonder if the current higher version of PHP you have is providing these notifications?

So we are stuck on 1.9.19 at present?   Might have to take the approach of ignoring those "Notices" for now, move forward in Moodle version to the next step ... that of 2.2.highest.  Normally, errors about  plugins/addons themes etc would be the show stoppers.  Moodle 2.2's requirement for PHP was
5.3.2 or later.

Might have to check out the pages related to moodle version and PHP
https://docs.moodle.org/24/en/PHP
https://docs.moodle.org/25/en/PHP
https://docs.moodle.org/26/en/PHP

In other words, have your Moodle code 'catch up' to the version of PHP (5.5.9).

'spirit of sharing', Ken

In reply to Ken Task

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Sergey Muha -
Hello Ken

Thank you for answers

As  mentioned earlyer I can't move forward to 2.0. or higher version due to database error.

"
Sergey Muha
Понедельник, 27 Июнь 2016, 04:09
"

I couldn't  fix this database error and we have decided move to 1.9.19 version on new server and stop on this.

But now I always receive error
Notice: Undefined property: stdClass::$sec in/var/www/html/moodle/lib/moodlelib.phpon line 1186
...
I didn't do any changes at moodle code except
adding line
$some_object= new stdClass();
in file to fix error like this
Warning: Creating default object from empty value in /var/www/html/moodle/login/index.php on line 302
and in config.php
$CFG = new stdClass();

Maybe I can reinstall php with lower version?! and that will help me
In reply to Sergey Muha

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Ken Task -
Picture of Particularly helpful Moodlers

Well, just tried accessing the URL you provided above in a previous post ... config.php file is pointing to an IP address now (rather than FQDN ...  like the link provided here in this thread) and a 'moodle' directory which apache reports as not found.

** It also appears you have 2.9 code at /var/www/html/   check the version.php file in /var/wwwhtml/ to see.

So edit the config.php file and point the 'wwwroot' variable ... ie, the URL to the site ... to the FQDN with no trailing slash or 'moodle' subdirectory.

You might need to start over.   One cannot hyperjump from 1.9.19+ to 2.9.highest.

On a migration involving platform change it's advised to get the copy of the old site running on the new server first ... and backed up in that environment, *before* attempting any upgrade.  This means copying the code directory, the data directory, and importing an SQL to a new DB on the Ubuntu server.    Get that working first.    Then back it up as a fall back point to the next step which is upgrading to the highest 1.9.19+ before even thinking/planing the upgrade to 2.

Have access to  a 1.9.19+ site running under PHP 5.5.36 so am not sure it's a php version issue initially (yes, I know it needs upgrading but entity needs convincing).

If you begin again ... make sure that right after the sql dump import into a fresh moodle database on the new server you run the mysql_upgrade with the forced option - before doing anything else.

'spirit of sharing', Ken

In reply to Sergey Muha

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Ken Task -
Picture of Particularly helpful Moodlers

Just now ...
Site is available by url provided.
Login ... however ...
Warning: Creating default object from empty value in /var/www/html/moodle/login/index.php on line 279

So did you tell apache that document root is /var/www/html/moodle now?

Can login as guest
Am seeing ONLY a
Warning: Creating default object from empty value in /var/www/html/moodle/course/lib.php on line 2120

which is the line * below:

        if (!empty($namesarray)) {
            echo "<ul class=\"teachers\">\n<li>";
            echo implode('</li><li>', $namesarray);
*            echo "</li></ul>";
        }

Just a warning.

When using Firefox's Web tools and looking at Style editor ... the first line shows:
<br />
<b>Warning</b>:  Creating default object from empty value in <b>/var/www/html/moodle/lib/moodlelib.php</b> on line <b>8305</b><br />
/**************************************

Again a warning ... it's the standard theme.

Did the site undergo any tweaks to standard theme?

What would happen IF one were to switch to another theme?

'spirit of sharing', Ken


In reply to Ken Task

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Sergey Muha -
I realized that 1.9.5 also worked bad

Now site is down at all. In the morning I will start from beginning and post all steps and errors I will receive         

In reply to Ken Task

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Sergey Muha -
Good morning
I setup new VM

Ubuntu 14.04.4 LTS \n \l

Server version: Apache/2.4.7 (Ubuntu)

mysqld 5.5.49-0ubuntu0.14.04.1

PHP 5.5.9-1ubuntu4.17 (cli) (built: May 19 2016 19:05:57)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

then I wget new 1.9.5 from moodle.org
create new db for 1.9.5 moodle and install new empty 1.9.5 with empty DB on server.
But after I have installed 1.9.5 some page
was empty

list commands that I have used
sudo apt-get update
     sudo apt-get install apache2 mysql-client mysql-server php5 libapache2-mod-php5
     sudo apt-get install graphviz aspell php5-pspell php5-curl php5-gd php5-intl php5-mysql php5-xmlrpc php5-ldap clamav
     
created dir for moodle and moodledata,change owner
apache vert host
     <VirtualHost *:80>
        ServerAdmin webmaster@localhost
ServerName nonprod.minsk.edu.by
ServerAlias www.nonprod.minsk.edu.by
        DocumentRoot /var/www/html/moodle

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined


</VirtualHost>   
     
for db
CREATE DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
create user 'usermood'@'localhost' IDENTIFIED BY 'xxx';
     GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO usermood@localhost IDENTIFIED BY 'xxx';
In reply to Ken Task

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Sergey Muha -

I will try to import my database dump to see what will be

In reply to Ken Task

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Sergey Muha -

I also see empty page at account tab

It means that I can't setup pure 1.9.5 on my new server environments corretly... sad


In reply to Ken Task

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Sergey Muha -
I found this https://moodle.org/mod/forum/discuss.php?d=153348
and that says it's problems with php version 1.9.4 is not compatible with PHP 5.3"
I have 5.5.9 and 1.9.5 when I have updated to 1.9.9 it's fixed empty pages but appearing error
Notice: Undefined property: stdClass::
It is the dead loop
In reply to Ken Task

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Sergey Muha -

Also I can't found 1.9.5+ only 1.9.5 .  Could this difference forward to errors?

In reply to Ken Task

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Sergey Muha -

УРА

I have installed ubuntu 12.04 with php 5.3 and 1.9.5 plus my mysql dump works greate.

The issue was due to php 5.5.9 !!!

back up and

Going forward  to 1.19.19+

In reply to Sergey Muha

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Ken Task -
Picture of Particularly helpful Moodlers

Congrats!

Please see:

https://download.moodle.org/releases/legacy/

and pay attention to the versions of PHP required before 'marching' a moodle upwards.

Know that those versions are recommended minimals.

Example: first hop to 2:

Moodle 2.1.10 is what most do from 1.9.19+?

PHP 5.3.2, MySQL 5.0.25 or Postgres 8.3 or MSSQL

Moodle 2.3.11 - PHP 5.3.2, MySQL 5.1.33

Moodle 2.5.9 - PHP 5.3.3, MySQL 5.1.33

Moodle 2.8.12 - PHP 5.4.4, MariaDB 5.5.31 or MySQL 5.5.31

And to further confusion/research ... since you use Linux and the CLI, I'd consider using git to 'march' the moodle upwards.

A start at git:

https://docs.moodle.org/23/en/Git_for_Administrators

'spirit of sharing', Ken

In reply to Ken Task

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Sergey Muha -

I will try follow this steps

But befor I need to setup e mail authen for users on new platform.


I did next step

In site panel I have setup

SMTP username and password

SMTP hosts

also I mentioned that at linux I don't have sendmail (apt-get install sendmail)

and add path in php.ini in apache and cli directory

add at mysql

UPDATE mdl_config SET value='smtp.gmail.com:465' WHERE name='moodlemgiro@gmail.com';

But error still appeared


Notice: fputs(): send of 27 bytes failed with errno=32 Broken pipe in /var/www/moodle/lib/phpmailer/class.smtp.php on line 489 Notice: fputs(): send of 12 bytes failed with errno=32 Broken pipe in /var/www/moodle/lib/phpmailer/class.smtp.php on line 146 ERROR: The following From address failed:

Also I tcpduming 465 port and saw

nonprod.minsk.edu.by.58122 > lk-in-f108.1e100.net.ssmtp: Flags [S], cksum 0x4f89 (incorrect -> 0xdee5), seq 459147124, win 29200, options [mss 1460,sackOK,TS val 4294942721 ecr 0,nop,wscale 7], length 0
00:42:17.497224 IP (tos 0x0, ttl 47, id 51547, offset 0, flags [none], proto TCP (6), length 60)
    lk-in-f108.1e100.net.ssmtp > nonprod.minsk.edu.by.58122: Flags [S.], cksum 0x0af1 (correct), seq 1873551597, ack 459147125, win 42408, options [mss 1380,sackOK,TS val 854973708 ecr 4294942721,nop,wscale 7], length 0
00:42:17.497239 IP (tos 0x0, ttl 64, id 42870, offset 0, flags [DF], proto TCP (6), length 52)
    nonprod.minsk.edu.by.58122 > lk-in-f108.1e100.net.ssmtp: Flags [.], cksum 0x4f81 (incorrect -> 0xde24), seq 1, ack 1, win 229, options [nop,nop,TS val 4294942733 ecr 854973708], length 0
00:42:27.507364 IP (tos 0x0, ttl 64, id 42871, offset 0, flags [DF], proto TCP (6), length 79)
    nonprod.minsk.edu.by.58122 > lk-in-f108.1e100.net.ssmtp: Flags [P.], cksum 0x4f9c (incorrect -> 0x835f), seq 1:28, ack 1, win 229, options [nop,nop,TS val 4294945235 ecr 854973708], length 27
00:42:27.556002 IP (tos 0x0, ttl 47, id 56612, offset 0, flags [none], proto TCP (6), length 52)
    lk-in-f108.1e100.net.ssmtp > nonprod.minsk.edu.by.58122: Flags [.], cksum 0xac92 (correct), seq 1, ack 28, win 332, options [nop,nop,TS val 854983766 ecr 4294945235], length 0

I have compared this output with working mail dump and all message was correct. But there we can see incorrect and I don;t now what that means..


Could you please clarify what I had been doing wrong

Thanks in advance

In reply to Sergey Muha

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Ken Task -
Picture of Particularly helpful Moodlers

config for using gmail.com as a relay would require an
autenticated user in gmail.
Making settings via DB update queries shows your expertise
but you may have missed other fields in config of SMTP server in
the Moodle admin interface.   Suggest using Moodle UI as admin level
user to see all that needs configuration.

Also, a tcpdump is more than one needs ... how about the sendmail
logs ... if you did setup at least the sending part of Sendmail.
One can test any sending using text based alpine or pine mail or other
because it can be confgured with a user being used to authenticate, password, port, etc. ...
you do have to get pine/alpine to work first.   If that works, then
one knows what to plug into moodle.

Might have trouble with a non production server that doesn't have but
minimal DNS entries.   NO MX, DKIM, SPF etc.. which many rec. mail
servers would check.   Take a look at the full header of a message in Gmail
sometime to get an idea.

If nonprod will change to a production Moodle server think I'd do the march first and when finally arriving at destination, then address email based self registration.   Changing the FQDN will require changes to Moodle DB anyway IF doing the march on a nonprod server that isn't using the FQDN that it will use when made production.

'spirit of sharing', Ken





In reply to Ken Task

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Sergey Muha -
config for using gmail.com as a relay would require an
autenticated user in gmail.
Making settings via DB update queries shows your expertise
but you may have missed other fields in config of SMTP server in
the Moodle admin interface.   Suggest using Moodle UI as admin level
user to see all that needs configuration.
--
If I understud you clear I need to make chages olny in . Without change DB manualy,is it ???

Also, a tcpdump is more than one needs ... how about the sendmail
logs ... if you did setup at least the sending part of Sendmail.
One can test any sending using text based alpine or pine mail or other
because it can be confgured with a user being used to authenticate, password, port, etc. ...
you do have to get pine/alpine to work first.   If that works, then
one knows what to plug into moodle.

I am trying to sendmail muxa-mc@tut.by < /tmp/email.txt
but  at tcpdump I see those incorrects message as I post in previous message

---------------
If nonprod will change to a production Moodle server think I'd do the march first and when finally arriving
at destination, then address email based self registration.   Changing the FQDN will require changes to Moodle DB anyway IF doing the march on a nonprod server that isn't using the FQDN that it will use when made production.

Do you mean that I need first change FQDN(domain) and do all migrations and update tasks and after that setup email authentication at last step.


----------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------
-------------------
I have done setup sendmail like http://obedkin.ru/articles/linux/ubuntu/sendmail.html
And now all message that I have sent from console was delivered to my e mail
Jul 26 10:57:33 nonprod sendmail[14523]: u6Q7vXx3014523: to=muxa-mc@mail.ru, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30140, relay=[12
7.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (u6Q7vXHI014524 Message accepted for delivery)
Jul 26 10:57:33 nonprod sm-mta[14526]: STARTTLS=client, relay=mxs.mail.ru., version=TLSv1/SSLv3, verify=FAIL, cipher=AES256-GCM-SHA384, bits=256/256
Jul 26 10:57:35 nonprod sm-mta[14526]: u6Q7vXHI014524: to=<muxa-mc@mail.ru>, ctladdr=<root@nonprod.minsk.edu.by> (0/0), delay=00:00:02, xdelay=00:00:02, mailer=esmt
p, pri=120412, relay=mxs.mail.ru. [94.100.180.150], dsn=2.0.0, stat=Sent (OK id=1bRxF9-0006Es-IQ)
Jul 26 11:00:01 nonprod CRON[14793]: (smmsp) CMD (test -x /etc/init.d/sendmail && /usr/share/sendmail/sendmail cron-msp)
Jul 26 11:01:18 nonprod sendmail[14811]: u6Q81ItN014811: 8-bit character in mailbox address "?Subject?"
Jul 26 11:01:18 nonprod sendmail[14811]: u6Q81ItN014811: from=root, size=17, class=0, nrcpts=1, msgid=<201607260801.u6Q81ItN014811@nonprod.minsk.edu.by>, relay=root
@localhost
Jul 26 11:01:18 nonprod sm-mta[14812]: u6Q81I1b014812: from=<root@nonprod.minsk.edu.by>, size=314, class=0, nrcpts=1, msgid=<201607260801.u6Q81ItN014811@nonprod.min
sk.edu.by>, proto=ESMTP, daemon=MTA-v4, relay=localhost [127.0.0.1]
Jul 26 11:01:18 nonprod sendmail[14811]: u6Q81ItN014811: to=muxa-mc@hotmail.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30017, relay
=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (u6Q81I1b014812 Message accepted for delivery)
Jul 26 11:01:20 nonprod sm-mta[14814]: STARTTLS=client, relay=mx4.hotmail.com., version=TLSv1/SSLv3, verify=FAIL, cipher=ECDHE-RSA-AES256-SHA384, bits=256/256
Jul 26 11:01:21 nonprod sm-mta[14814]: u6Q81I1b014812: to=<muxa-mc@hotmail.com>, ctladdr=<root@nonprod.minsk.edu.by> (0/0), delay=00:00:03, xdelay=00:00:03, mailer=
esmtp, pri=120314, relay=mx4.hotmail.com. [65.55.92.152], dsn=2.0.0, stat=Sent ( <201607260801.u6Q81ItN014811@nonprod.minsk.edu.by> Queued mail for delivery)

But when I try registration and sent e mail from moodle
Notice: fputs(): send of 27 bytes failed with errno=32 Broken pipe in /var/www/moodle/lib/phpmailer/class.smtp.php on line 489 Notice: fputs(): send of 12 bytes failed with errno=32 Broken pipe in /var/www/moodle/lib/phpmailer/class.smtp.php on line 146 ERROR: The following From address failed:

In reply to Sergey Muha

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Ken Task -
Picture of Particularly helpful Moodlers

Will say this ... we are so far away from the subject line of this thread, it's funny.  I had a hard time today just finding this thread.    It might be best at this point to start a new thread about the March and issues related.

You are in the first phases of a 'Moodle March' from 1.9.x to 3.x.   Much lies ahead that will present issues.   While it's generally a good idea to take one step in the 'Moodle March' and stop to test ... fix issue .. before next step, the ability to send mail from a non-production server ISN'T one of those 'must fix before moving forward'.   Note reason: *non-production server* ... one that probably should have 'send no mail' set in config.php file of the site.

Case in point ... DNS ... full disclosure as there is no other way:

nonprod.minsk.edu.by.    86400    IN    A    195.50.1.249

MX for domain: minsk.edu.by
;; ANSWER SECTION:
minsk.edu.by.        86400    IN    MX    10 mx.yandex.ru.

;; QUESTION SECTION:
;minsk.edu.by.            IN    ANY

;; ANSWER SECTION:
minsk.edu.by.        86400    IN    TXT    "v=spf1 redirect=_spf.yandex.net"
minsk.edu.by.        86400    IN    MX    10 mx.yandex.ru.

Translation ... maybe in the config of smtp server one should be using their own mail systems.   Why? Someone in your domain is in charge AND can make exceptions to rules etc. to allow relay of mail from an address from nonprod.minsk.edu.by. to anywhere.  This is a test/nonproduction server that shouldn't be sending mall anyway!   If you did manage to test by posting to a forum all those users subscribed would get a message that surely would confuse ... and in some cases, because you can not control what mail services use, might actually get your entire domain blocked if picked up by SBL.   You've then exasperated the problem and possibily made very angry the true mail server admin for your domain ... if that's not you.

Sending test messages via command line to hotmail.com isn't a test.

Sending test messages from a text based MTA (as has been suggested to you already - pine/alpine) where one could configure the outgoing mail server/stmp server, etc. easily and then sending mail to the moodlemgiro@gmail.com you've shown will provide useful information.  Note: would be surprised if attempting to use Google will work given that nonprod.minsk.edu.by is not listed in any DNS as a valid sending mail server.

** It's strongly suggested to concentrate on the 'March' right now and ignore the EMail sending issues *UNTIL* one reaches destination Moodle version.

'spirit of sharing', Ken





In reply to Ken Task

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Sergey Muha -

Ken The main goal is to migrate moodle from WAMP to LAMP

We decided to stay at 1.9.19 because we can't count time that take futher updates.


I don't understant differens between nonprod and prod server that I have now.

Old Windows server with domain moodle.minsk.edu.by have only one A record like my new Linux.

MX record is the record for minsk.edu.by and it is pointing to different mail server
;; ANSWER SECTION:
minsk.edu.by.           9790    IN      A       178.172.163.198


I think server should't have MX because it is not a real mail server it is just a client that try to send and receive mail from account that I can configure in server->mail admin UI

Also my old server moodle.minsk.edu.by can send and receive mails without MX record

Just configure

SMTP hostssmtphosts

SMTP usernamesmtpuser

SMTP passwordsmtppass
Отобразить
and /etc/php5/apache/php.ini  change for win32.
Please correct if I am wrong

Now I have domain that will use in real . do.minsk.edu.by

do.minsk.edu.by.        21599   IN      A       195.50.1.249
Starting to setup server with new domain.

In reply to Sergey Muha

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Ken Task -
Picture of Particularly helpful Moodlers

The subject of this thread is totally misleading.

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

It started with the goal of moving/migrating a Moodle from Windows to Linux and was centered around the DB ... as per subject line.    Then morphed to doing a March to higher version of Moodle.

Now, we're saying it's just a migration from Windows to Linux and the issue is Mail.

*** start a new thread - please.

'spirit of sharing', Ken



In reply to Ken Task

Re: Backup and Restore moodle mysql database 5.1 to 5.5 mysql version

by Sergey Muha -

Thank you Ken

I will do this.