porting Linux Moodle to Windows Moodle

porting Linux Moodle to Windows Moodle

by Steve Peters -
Number of replies: 10
Howdy kids,

We've got a client with an unusual request. They would like to hire us to help them build out a Moodle with some customizations on a linux server. The guts of that Moodle will then have to also work on a windows server.

We don't have a windows server, and we're not interested in getting one. The windows admin is claiming that once we've got it working the way we like it on linux that porting it to winderz will be as simple as sending them a copy of the database and PHP.

We're not sure exactly what we'll need to customize, it may just be some minor ajax-y things that would be elements of the pages. And a nice theme. The windows admin is telling us that if we confine any custom work to the module layer it should "just work" in windows.

Windows has always been the last place where anything "just works". Can we believe the claims of this admin? Does a Moodle setup port easilly from moodle server to moodle server?

Does developing on Linux and having it run on Windows sound like a reasonable thing to take on? Any obvious ways to avoid problems?

- Steve
Average of ratings: -
In reply to Steve Peters

Re: porting Linux Moodle to Windows Moodle

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Steve - Of course there are no absolutes, but I would say generally speaking you should be able to port without issue. Moodle is pretty platform independent so if the PHP works on Linux it should work on Windows as well. I would be surprised if you ran into issues but if you have specific concerns about particular PHP functions or sections of Moodle code just write back and we'll take a look. Peace - Anthony
In reply to Steve Peters

Re: porting Linux Moodle to Windows Moodle

by Julian Ridden -
I have to make a couple of assumptions before I start this post.

1. That the moodle is running on a mySQL DB
2. the php modules that moodle requires are on the new server
3. That the contrib code installed (if any) work fine on the existing server.

With those assumptions met, I can say the I personally have moved Moodle both across servers, domains and OS's without issues.

A couple of catches you should watch for
a: you will need to edit the Moodle's config PHP to point to the new windows based paths.
b: You will need to reset permissions of your moodledata directories once copied over
c: if the address is changing then you will need to do a find/replace within the database to change the URL. In many places this is recorded in tables. (forums and labels for instance). I did this by exporting from one server into a csv file, opening it in a simple notepad app and doing a find/replace before running the import onto the new server.
Average of ratings: Useful (1)
In reply to Julian Ridden

Re: porting Linux Moodle to Windows Moodle

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Julian - Good tips. The only thing I would add is that for point c, you should be able to use /admin/replace.php to change the URL throughout the database. Peace - Anthony
Average of ratings: Useful (1)
In reply to Anthony Borrow

Re: porting Linux Moodle to Windows Moodle

by Julian Ridden -
AHAAAAAaaaaa. very useful. And here I thought I knew everything about Moodle. :D

Filing that little tip in the memory banks.
In reply to Julian Ridden

Re: porting Linux Moodle to Windows Moodle

by HJWUCGA INC. -
I don't have any facts to back this up but I think it should be less of a hassle as I find Windows "easier" and "looser" or not as strict as Linux =)
In reply to HJWUCGA INC.

Re: porting Linux Moodle to Windows Moodle

by Julian Ridden -
While this may be true, Windows is also less secure and a significant resource hog.

But arguments over server OS's can go on forever. Best thing is to choose a server OS that you can effectively run and support. And if Windows is best for you, then it probably is your best option
In reply to Julian Ridden

Re: porting Linux Moodle to Windows Moodle

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
I agree with Julian that you have to choose which system you and your tech. folks are comfortable maintaining. We were able to let Moodle be the lone Linux box in part because I installed a GUI that allows those not as familiar with Linux to be able to poke around without having to learn the Linux command line and because I was there to take care of things. Another option would be to see if you could find an older computer (and wish to spend the time) you could use the older computer as a test server and try to put Linux on that and see how it goes. It is not so much of working with the system when it is working as much as what happens when things are not working. If you or your tech. folks are more likely to be able to get things up and running again with Windows then eventhough you have decreased performance on the server that will likely be the way to go. Peace - Anthony
In reply to Julian Ridden

Re: porting Linux Moodle to Windows Moodle

by Myles Carrick -
Julian's on the money with this recommendation: if your client has experienced Windows admins on hand, then one suspects this is a deal-breaker.

Having said that... if they're not experienced, this forum (and the Installation Problems one) are testament to the fact that many network administrators don't have the requisite background knowledge to build, configure, maintain and tune a webserver 'in the wild'.

Some observations /considerations:

1. Keep in mind that there are myriad different Windows server configurations as well (e.g. IIS 6 vs 7; PHP as ISAPI vs the new IIS7 FastCGI implementation; IIS vs Apache, etc).

2. A further thing to be aware of is that Moodle has all sorts of goodies that "just work" on Linux but are either not possible or less simple to configure on Windows. These include system/command-line utilities such as du, zip/unzip and aspell (visit Server > System Paths from the Admin block of your Moodle) as well as the use of ClamAV for virus checking of uploaded files (Security > Anti-Virus from your admin block). Other things to think about here are the support for things like PHP accelerators, etc.

3. A further, more-subtle consideration is that the majority of large Moodle installations run on Linux (of one flavour or another). This means that there is a great wealth of knowledge in the community and on these forums that can be leveraged to your advantage.

All the best with your new project; do let us know if we can help further,

Myles C.

In reply to Myles Carrick

Re: porting Linux Moodle to Windows Moodle

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
It tends to be easier to move code from Linux to Windows than it is to move from Windows to Linux. This is because Windows is slacker on file security and Windows does not worry about file and directory name case sensitivity.

In reply to Myles Carrick

Re: porting Linux Moodle to Windows Moodle

by Ken Wilson -
To add to Myles' post, win32 versions of command-line utilities such as du, zip/unzip and aspell are available if needed from here. Try to keep the directory name where the files are installed simple, e.g. gnuwin32 (avoiding the 8.3 directory notation problems wink). A few notes:

1. To get du to work correctly, follow these steps:

- Edit moodle/lib/moodlelib.php
- Search for the function get_directory_size.
- Replace this line:

$command = trim($CFG->pathtodu).' -sk --apparent-size '.escapeshellarg($rootdir);

with this line:

$command = trim($CFG->pathtodu).' -sk '.escapeshellarg($rootdir);

- In IIS Manager, set the NTFS permissions to allow the IUSR_machinename user execute permissions on the directory where du is located.

2. Aspell can also be installed in the same manner by downloading the windows binary installer from http://aspell.net/win32/. Follow the installer prompts and install in a non-8.3 directory, e.g. c:\dos\aspell. Add the path to the Moodle admin pages as Myles suggests.

3. It is also possible to install the GNUWin32 versions of zip and unzip but note there is this discussion about zip/unzip working in backups.

4. I've never tried using ClamAV with Moodle, but the windows version is available here (http://www.clamwin.com/).

Hope this helps!

Ken