Restore breaks HTML in Moodle 1.9.5

Restore breaks HTML in Moodle 1.9.5

by Atanas Radenski -
Number of replies: 6
I am migrating from an old server (Fedora 4) onto a new server (Fedora 8), using Moodle 1.9.5 on both servers. On the new server, 'restore course' strips HTML entities, such as < and > and the result is broken HTML, which of course does not display as HTML any more. The same Moodle installation works fine in the old server. A course backed up in the new server restores fine on the old server (but not on the new one).

The OLD server works well with this configuration:

libxml2 Version 2.6.20
libxslt Version 1.1.14
libxslt compiled against libxml Version 2.6.19

The NEW server fails to work with this configuration:

libxml2 Version 2.6.30
libxslt Version 1.1.24
libxslt compiled against libxml Version 2.6.32

A similar issue is described as a libxml2 bug in this Moodle article:

http://docs.moodle.org/en/Backup_and_restore_FAQ#Restoring_a_course_results_in_broken_HTML_tags._What_can_I_do.3F

Originally, my new server had PHP 5.2.6 and libxml Version 2.6.32. In this forum folks reported curing the problem exactly with libxml 2.6.32, but it libxml 2.6.32 not work for me (http://moodle.org/mod/forum/discuss.php?d=111321). Later I had PHP upgraded to 5.2.9, which actually brought libxml to 2.6.30. HTML still breaks.

I hope I can get some help from this forum, otherwise my new server is unusable.

What can I do?

I wonder if reverting libxml2 to version that is known to work, i.e. 2.6.20, can do the job. Or upgrading to the latest versions of PHP and libxml2? Or compiling PHP against libexpat instead of libxml2; see http://docs.moodle.org/en/Backup_and_restore_FAQ#Restoring_a_course_results_in_broken_HTML_tags._What_can_I_do.3F.).

Many thanks in advance.
Average of ratings: -
In reply to Atanas Radenski

Re: Restore breaks HTML in Moodle 1.9.5

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Hi... you've really answered your own question. What the docs say about the problem is correct.

There's some discussion around the web about which combinations work and which don't, but I can tell you that the latest versions of libxml2 and PHP definitely work fine.

The worst case for you is probably compiling PHP from source - and all the dependencies that go with it. However, I'd be *really* surprised if there isn't a fix of some sort for Fedora (I'm assuming you're using the 'built in' LAMP stack).
In reply to Howard Miller

Re: Restore breaks HTML in Moodle 1.9.5

by Atanas Radenski -
Thanks... The 'restore' issue is still unresolved.

This issue appeared during migrating to a new dedicated server with the Plesk control panel. In a situation like this, I ask dedicated tech support to help. Tech support suggested replacing Fedora with CentOS, and I agreed. That was done, but the backup issue re-appeared with CentOS exactly as it did with Fedora. I do use the latest php version, 5.2.9. Tech support claims that they have also installed the latest libxml2 version in CentOS. They offer a command line check that produces this:

/usr/bin/xml2-config --version
2.7.3

However, info.php delivers an older version, 2.6.26 (http://64.150.189.232/info.php). Can this discrepancy be due to some server misconfiguration? What should I ask them to do as a next step? Your advice will be appreciated.
In reply to Atanas Radenski

Re: Restore breaks HTML in Moodle 1.9.5

by Atanas Radenski -
This issue is finally resolved.

I tried several approaches, as listed here: http://docs.moodle.org/en/Backup_and_restore_FAQ#Restoring_a_course_results_in_broken_HTML_tags._What_can_I_do.3F

- Using PHP version >= 5.2.9 did NOT help
- Using an earlier version of libxml2 such as 2.6.32 did NOT help

What worked was:
- rebuilding libxml2 from its latest release and
- recompiling the latest version of php with all dependencies


In reply to Atanas Radenski

Re: Restore breaks HTML in Moodle 1.9.5

by Nick Phillips -
"latest release" changes over time; it would have been helpful to know exactly which one you meant.

For the record, I can confirm that I have experienced this issue with libxml2 2.7.6 and that reverting to 2.6.32 resolved it.

The Moodle version being used would appear to be irrelevant.

Discussion at http://bugs.php.net/bug.php?id=45996 (found in page at link in previous post).
In reply to Atanas Radenski

Re: Restore breaks HTML in Moodle 1.9.5

by Hugo Carvalho -

Hi Atanas,

i'm experiencing similar problems to the ones you described over a year ago...

Could you please help me and describe to me the steps you've taken?
I'm kind of a noob in Linux systems.

I've managed to upgrade my libxml2 to 2.7.6 and moodle still says that the version installed is 2.6.3...

If you could help me i'd be very thankfull. i'm getting despaired...

Thanks in advance,

Hugo

In reply to Hugo Carvalho

Re: Restore breaks HTML in Moodle 1.9.5

by Karthick B -
Hi Hugo,

I am having exactly the same issue as you have.

If you found solution for this , please help me out..

Thanks in advance,

Cheers

Kartick B T