Moodle Shared Host Install Report Back and Bug Fixes

Moodle Shared Host Install Report Back and Bug Fixes

by Rudy Preston -
Number of replies: 12
Hello,

I recently Installed Moodle 1.9 for the first time for a client of mine. I am a web designer and programmer. The client has had past experience using and updating blogs such as wordpress. No real coding experience.

Firstly, we decided to use Dreamhost for our hosting needs.
Dreamhost is a great host to install moodle if you only plan on having a few active classes. They could handle about 500 students, depending on the intensity of the forums. Plus Unlimited Bandwidth and Unlimited Server Space and a free domain name.

Their server was configured nearly perfectly for moodle's needs from the get go.
All the server settings were "pass" on the install settings check.

We linked to the database with no problem, dreamhost's control panel made it a snap to create the mySQL db and even choose the address for the db server.

After installation, I noticed in the "notifications" section that we were getting the following error:

"Enabling the PHP setting display_errors is not recommended on production sites because some error messages may reveal sensitive information about your server."

Well that was troublesome for my client, so we had to customize our php installation
since you cannot control "display_errors" from the .htaccess file.

Turns out Dreamhost allows you to run your own version of php via a php.ini file, but it takes a tiny bit of work to create the sandbox for it:
Instructions on how to install your own version can be found here and they should be work for other hosts too:
http://wiki.dreamhost.com/Custom_PHP.ini

I followed the instructions in the wiki and it went smoothly.
I set the display_errors setting to Off and no more notification smile

Next, since Dreamhost will automatically sign you up and configure for gmail and google apps we needed to be able to configure gmail to connect to gmail. The version of phpMailer moodle uses does not support SSL connections or port 465, so a hack is needed. Luckily the moodle community rocks and there is a tutorial on this:

http://docs.moodle.org/en/Email_setup_gmail

It Worked!

We then set the template to Chameleon (amazing css editor!!!) and did a browser compatibility check: IE6, IE7, FF2, FF3, Safari 3, Opera 9, and Chrome.

All exactly the same except IE7. For some reason we were being waved a yellow flag warning about a security issue. I searched the moodle forum and found a thread that solved it. It was late and I forgot to document the forum item that fixed it, but I thank the amazing person who figured this out. what follows is the patch to make it go away:


**********************************************************************
* PATCH 01 IMPORTANCE: CRITICAL TO PROPER FUNCTIONING *
**********************************************************************

*****FIX HTML ERROR CAUSING IE7 TO SHOW MSXML 5.0 POPUP *******

summary:
Internet Explorer 7 was showing user a warning flag, saying
their own xml parsing software MSXML 5.0 was unsafe to use.
No other browser showed this flag, since no other browser
uses Micro$oft's junk anywayz. This warning was being caused
by some HTML tags in the index being improperly ordered.
Found fix in the moodle fourm.

description:
Following the instructions in the forum, I reordered the
improperly ordered tags, this may get fixed in future builds.

Total Files Changed: 01

----
| 01 | MOODLE INSTALL ROOT/theme/index.php
----

CODE SNIP (LINES 100 - 109):

BEFORE PATCH
>>In the two echo lines the tag "data" is declared before "type"
>>Microsoft IE7 throws a waring to user that says "danger"
**************************************************************

// no point showing this if user is using screen reader
if (!$USER->screenreader) {
echo "\t\t<td align=\"center\">\n";
if ($screenshotpath) {
$screenshot = "\t\t\t\t<li><a href=\"$theme/screenshot.jpg\">$strscreenshot</a></li>\n";
echo "\t\t\t<object data=\"$screenshotpath\" type=\"text/html\" height=\"200\" width=\"400\">$theme</object>\n\t\t</td>\n";
} else {
echo "\t\t\t<object data=\"preview.php?preview=$theme\" type=\"text/html\" height=\"200\" width=\"400\">$theme</object>\n\t\t</td>\n";
}
}

*************************************************************

>> We simply move "type" before "data" and the error vanishes


AFTER
*************************************************************
COPY BETWEEN THE `%@%COPY%@%` BUT NOT THE `%@%COPY%@%` *
*************************************************************

`%@%COPY%@%`


/*
PATCH 01 == See the README_BEFORE_UPGRADE.txt file
*/

// no point showing this if user is using screen reader
if (!$USER->screenreader) {
echo "\t\t<td align=\"center\">\n";
if ($screenshotpath) {
$screenshot = "\t\t\t\t<li><a href=\"$theme/screenshot.jpg\">$strscreenshot</a></li>\n";
echo "\t\t\t<object type=\"text/html\" data=\"$screenshotpath\" height=\"200\" width=\"400\">$theme</object>\n\t\t</td>\n";
} else {
echo "\t\t\t<object type=\"text/html\" data=\"preview.php?preview=$theme\" height=\"200\" width=\"400\">$theme</object>\n\t\t</td>\n";
}
}

/*
END PATCH 01 == See the README_BEFORE_UPGRADE.txt file
*/


`%@%COPY%@%`


**************************************************************
END PATCH 01*
**************




We are totally golden and everything else is purring now.
Two tiny hacks (gmail and IE7 warning) and moodle is production ready.

From the dreamhost panel we set the moodle cron to run and the log reported "all systems go".

My client then installed a few classes and had a few "wishes" for moodle.

Wish 1: I want to hide all classes that a student is not enrolled in.

Moodle Forum says: Easy as pie!
I found a forum Item that explained the whole process of "showing classes in hidden categories". But there was still the problem of the search classes form and the "view all classes" button. I could not find a fix in the forum so I wrote one:

**************************************************************
* PATCH 02 IMPORTANCE: CRITICAL TO PROPER FUNCTIONING FOR CLIENT *
**************************************************************

*****Hide Search for a Course Box (Student View)**************

summary:
In order to keep students from seeing classes they
were not enrolled in, we had to hide a table containing
a search input and a "view all courses" button.

description:
I have added an "id" tag (course_search_table) to the
library file that generates this particular table.
I then styled the "id" in the CSS.

Total Files Changed: 02

----
| 01 | MOODLE INSTALL ROOT/course/lib.php
----

CODE SNIP (LINES 2135 - 2151):

BEFORE
**************************************************************

if (count_records("course") > (count($courses) + 1) ) { // Some courses not being displayed
echo "<table width=\"100%\"><tr><td align=\"center\">";
print_course_search("", false, "short");
echo "</td><td align=\"center\">";
print_single_button("$CFG->wwwroot/course/index.php", NULL, get_string("fulllistofcourses"), "get");
echo "</td></tr></table>\n";
}

*************************************************************


AFTER (IF YOU ARE RE_PATCHING REPLACE ABOVE CODE WITH THIS)
*************************************************************
COPY BETWEEN THE `%@%COPY%@%` BUT NOT THE `%@%COPY%@%` *
*************************************************************

`%@%COPY%@%`


/*
PATCH 02 == See the README_BEFORE_UPGRADE.txt file
*/
if (count_records("course") > (count($courses) + 1) ) { // Some courses not being displayed
echo "<table id=\"course_search_table\" width=\"100%\"><tr><td align=\"center\">";
print_course_search("", false, "short");
echo "</td><td align=\"center\">";
print_single_button("$CFG->wwwroot/course/index.php", NULL, get_string("fulllistofcourses"), "get");
echo "</td></tr></table>\n";
}
/*
END PATCH 02 == See the README_BEFORE_UPGRADE.txt file
*/


`%@%COPY%@%`

**************************************************************


----
| 02 | MOODLE INSTALL ROOT/theme/chameleon/user_styles.css
----

CODE SNIP (LINES 601-603):

>This was written via the Chameleon template SHIFT+CLICK feature
>If you change themes -- this would need to be added to it's CSS
>file user_styles.css
**************************************************************


#course_search_table {
display: none;
}


**************************************************************
END PATCH 01 *
**************


Now were talking! Moodle rocks!

The last thing that ended up being a small annoyance was not being able to give a specific title to the Heading of the "Topic Outline" view.
It would only say "Topic Outline" and we wanted it to be dynamic for each class.
My patch is below, but it could be added to, by making a place to input a title, but this works too:

***************************************************************
* PATCH 03 IMPORTANCE: NICE TO HAVE *
***************************************************************

*****CHANGED TOPIC OUTLINE HEADING TO DYNAMICALLY *************
***** CHANGE TO "Welcome to the [Class Name Here]" *************

summary:
The heading of the main content in a course topic outline view
(our default course view) was always "Topic Outline" on all pages.
There is no way to set this to something else that is dynamic,
or make it disappear, so we changed the source to be dynamic.

description:
Replaced "Topic Outline" with "Welcome to the [Class Name Here]"

Total Files Changed: 02

----
| 01 | MOODLE INSTALL ROOT/course/format/topics/format.php
----

CODE SNIP (LINES 94):

BEFORE
This says "print me a heading that says the definition of
'topicoutline'"
**************************************************************


print_heading_block(get_string('topicoutline'), 'outline');


*************************************************************

>> We want to have a variable that has a modular piece of text
at the beginning, defined in the language file, and then the
course name. "['topichead'][Class Name Here]"


AFTER
*************************************************************
COPY BETWEEN THE `%@%COPY%@%` BUT NOT THE `%@%COPY%@%` *
*************************************************************

`%@%COPY%@%`


/*
PATCH 03 == See the README_BEFORE_UPGRADE.txt file
*/
print_heading_block(get_string('topichead').$COURSE->fullname, 'outline');
/*
END PATCH 03 == See the README_BEFORE_UPGRADE.txt file
*/


`%@%COPY%@%`


*************************************************************


>> Now we have to define ['topichead'] in our language file

----
| 02 | MOODLE INSTALL ROOT/lang/en_utf8/moodle.php
----

>> We have added this at line 1513 to remain alphabetical
>> Ths defines ['topichead'] as "Welcome to the "
>> Note that we have our end quote after a space because we have
dynamically set it to put the class name next

CODE SNIP (IF YOU ARE RE_PATCHING ADD CODE BELOW AT 1513)
*************************************************************
COPY BETWEEN THE `%@%COPY%@%` BUT NOT THE `%@%COPY%@%` *
*************************************************************

`%@%COPY%@%`


/*
PATCH 03 == See the README_BEFORE_UPGRADE.txt file
*/
$string['topichead'] = 'Welcome to the ';
/*
END PATCH 03 == See the README_BEFORE_UPGRADE.txt file
*/


`%@%COPY%@%`


**************************************************************
END PATCH 03 *
*****************


A little more styling with the chameleon magical SHIFT + CLICK
CSS Editor and we have a beautifully custom moodle install.

Thanks Moodle for the rocking school and forums, and thanks Dreamhost for having the most awesome shared server hosting plans and tech support/community that matches the forums found here at moodle.

Open Source Forever!

You are welcome to contact me if my patches spring a leak!
They worked for me but I can't guarantee anyone elses setup!
smile
Average of ratings: Useful (1)
In reply to Rudy Preston

The DreamHost experience

by Marc Grober -
You could also have checked here:
http://wiki.dreamhost.com/Moodle
and you may want to add to this page .....

However, you will likely run into some issues with mail. DH has a mail limit as well as a SPAM policy that could shut down your Moodle at an inconvenient time...... attempts to have DH offer options to address these issues have produced the typical DH response.....

Additionally, you may see some performance issues if you are using a shared host...... DH will not even bother addressing situations where you may see an hour or two of connection loss.

Some examples:
a) recently one of our Moodles appeared to "hang" for 45 minutes and intriguingly enough actions taken at the start of that period showed as committed in mysql 45 minutes later..... DH did not respond until a day later and then simply indicated:
We don't log every single issue that happens on our servers, nor do we investigate small issues like this, after they've passed. If they happen again, please let us know.

Of course, this is typical so no resolution is ever forthcoming until something easts a drive.

All DH users should subscribe to DH status feed (http://www.dreamhoststatus.com/) and a review of the comments posted there will provide substantial insight into DH.

DH also has a habit of giving users bad info (though some of their techs are great) and these forums are full of folks who have gotten a bit of a runaround.... sometimes this is because tech are passing bad guesses on, sometimes because the tech simply doesn;t fully understand what he or she is talking about. Some examples here are issues over cron locking and cron invocation.

There have also been issues with their one-click script from time to time, though they typically address such matters very quickly.

Speaking of one-clicks (which I have to say are so superior to other panel shortcuts that DH deserves a tremendous round of applaus with respect to these, which allow not only simple install but update on a regular basis) you should know that at present DH cannot support Moodle 2 unless you install and build your own php. DH presently offer php 5.2.3 and Moodle 2 will require php 5.2.4. You could do a custom build of 5.2.3 but as I read the tracker, you will likely then end up with having to do lots of patches so it probably is not worth it.

For some time I have been trying to get DH to add Moodle suggested extensions to the DH shared php build or have a separate shared php build for DH moodle users made available. There are suggestions listed you can vote for that include xmlrpc, sockets, and zip, all of which have received substantial votes, but none of which DH ever implemented. These are issues in that you cannot do chatd or moodle networking under Moodle 1.9 or Moodle 2 development. Moodle 1.9 usage can be addressed via a custom build of php (DH share php 5.2.3 is built without xmlrpc and sockets and Moodle does not support PEAR xmlrpc.)

I also asked DH if users should expect to have to shut down their Moodles once Moodle 2 arrived since DH had failed/refused to ever indicate that they would address these issues. I finally received a note last week from a tech

I've just sent a notice over to our one-click guru and he assures me that everything should be fine, and they're prepared for the upgrade!

which suggests that DH will be able to address the requirements of Moodle 2, but when I followed up and asked whether DH will upgrade to php 5.2.8 and if so when, I received a note indicating that no info was available about php updates........

Also potentially problematic is the google app reseller connection for DH.... selection of any google options implements the option for all subdomains, and access your google domain can be confusing when it comes to username and password..... I would certainly like to see you add to the dreamhost wiki with respect to the gmail configuration as well as whether and if so to what degree use of such options can bypass the DH mail limits (I don't think it will effect this at all, but it would be nice to address the question comprehensively.

Other items you should be aware of:

An attempt to delete a db via the DH GUI and then recreate it will fail becuase DH does not delete dbs when you attempt this until days later. I typically just drop tables from a db and then rebuild.

CVS installs go rather smoothly and I have had no problem with webworks or wwmqt

WHile I recommend asciimathml and dragmath, current math filters work out of the box without any issues. On the other hand, it is trivial to build your own version of mimetex or mathtex on DH. I have not done a STACK install but don;t see any issues

Use of PEAR is supported pretty well. Unfortunately Moodle does not support use of PEAR xmlrpc . The DH PEAR docs can be confusing for a newbe, but any sysadmin will have it up and running in no time. This could be important depending on how DH addresses the extensions for Moodle 2 as PECL uses PEAR. Along these lines it is critical that DH users vote for and urge DH to include xmlrpc or provide support docs for extending php with PECL extensions...




 
                                    
In reply to Marc Grober

Re: The DreamHost experience

by Vijay Reddy -
Hi Marc,

I have recently installed Moodle 1.9.4 (1 click install on DH).

I added a PDF file and an Excel file for an activity.
When I click on these files to view, I get an error: "No Input file specified".

Some insights:
when I place my cursor on the PDF file, I see the following URL at the bottom of the browser page:
http://www.mydomain.org/sssm1/mod/resource/view.php?id=5

When I click on that clink, it brings up a new browser window with the following info:

To open this document, click on this link: APA_Style

The URL for the link reads like this:
http://www.mydomain.org/sssm1/file.php/2/apastyle.pdf

Can you please help me with setting up my Moodle install properly on DH? (like adding / editing the PHP.INI file)?

Best Regards,
VR
In reply to Vijay Reddy

Re: The DreamHost experience

by Marc Grober -
Well, you have listed a number of different issues.....

First off, look in the DH wiki for Moodle help and there you will find info on managing php.ini in DHland - 1.9.4 is a new moodle for DH so while they are pretty good with their scripting, there could be an issue I have yet to see.....

#2 there are teo different ways to open pdfs usingf acrobat, as a plugin or as a helper app, and two different ways for moodle to open it, in the same window or a new window, so the option you get is one of four you can select.

trois.... If you link from a resource, the material referenced has to be there...... the resource URL is a link to the db entry that references your file. But your file must be somewhere that the resource can find it..... in your case, you should be able to look in ssssm1_moodledata or something along those lines and see your file in /2/.....

IV. I have posted info to the forums on using tunnelier with DH... this might be helpful for you as to pursue this further we need to know what you mean by "added" and what the context is for when you get "No input file specified"

a handful. I will actually try to spend some time looking at 1.9.4 on DH this week, but until I get there, please make sure the files you want to reference can be seen from the File icon in the course, and if not, upload them from there and check to make sure you can access them from Files. If the files are there and you still get the same error I have some ideas but will wait to hear from you.
In reply to Marc Grober

Re: The DreamHost experience

by Vijay Reddy -
Hi Marc,

Thanks a lot for your prompt response!

Here are the responses for your questions. I hope this will give your more information for you to help me with my problem.

1. When I click on "Files" menu for the course, I can see all the files I have uploaded.
2. I clicked on the PDF file (apastyle.pdf) from the Files page; it opnes a new window (because I chose the option of "open in a new window" while uploading the file).
3. It still gives the same error "No input file specified".
4. I am using FireFox v3.0.6 browser on Windows Vista Home Premium OS
5. I am able to open PDF files directly in my browser from other sources on the internet; I am able to open a PDF file from a Moodle Course on a different host.

Please help me with my problems:

In reply to Vijay Reddy

Re: The DreamHost experience

by Richard Enison -
VR,

3. You haven't said you that you have looked at the links I posted about this error msg. Are you interested in fixing it or not?

RLE
In reply to Richard Enison

Re: The DreamHost experience

by Vijay Reddy -
Hi Richard,

Thank you for the info.

I looked at those links... I am certainly interested in addressing my problems...

I am new to Linux / Unix / PHP. It looks I may need some help in this area smile

Let me try one more time and come back to you..

VR


In reply to Vijay Reddy

Re: The DreamHost experience

by Marc Grober -
I you have followed the DH wiki instructions regarding php.ini and everything is working except for the inability to find pdf files, I am a bit stumped, but if you want to give me access (send private e-mail) I will try to sniff about and see what's up. If, on the other hand, you can't access anything in moodledata, then that points to an htaccess issue, which could involve php.ini, depending on what you have done vis-a-vis the custom php.ini instructions. Have you looked in your DH error logs to see if there are complaints about accessing those files?

And..... while there is no mandate that you use the solution I suggested (tunnelier), did you set up clients to take advantage of ssh command line access and sftp so you can examine your infrastructure?
In reply to Marc Grober

Re: The DreamHost experience

by Francisco De La Cruz -
Hi Marc,
I'm about to make a decision as to a web hosting for a moodle installation in my organization. I already installed on an old linux server I have, but I haven't setup email on that one. You said, "However, you will likely run into some issues with mail. DH has a mail limit as well as a SPAM policy that could shut down your Moodle at an inconvenient time...... attempts to have DH offer options to address these issues have produced the typical DH response"
How is email used by moodle and its users?
Is this something to consider when choosing my web hosting? Is this enough to keep looking? How did you manage?

Thanks, Francisco
In reply to Francisco De La Cruz

Re: The DreamHost experience

by Francisco De La Cruz -
WebFaction, another WH I'm considering just replied to my question about bulk email saying, "We do not have an hourly cap for outgoing mail. We ask that you do not send
more than 500 messages per day on average over the course of a single month."
Is that better than what DreamHost allows?
In reply to Francisco De La Cruz

Re: The DreamHost experience

by Marc Grober -
Mail issues has been a bear for some.... I don't have a lot of users posting in the forums so that keeps me below the limit.... Not very satisfactory for anything that is going to go into major production.... and DH has not been helpful at all about possible solutions....

However, DH now has a deal set up with google mail and I don;t know whether this would allow you rto bypass the DH limits on outgoing mail or not.... and I have been swamped of late and have not had an opportunity to investigate.....

You might want to ask DH as a prospective customer whether outgoing mail from Moodle if you use the gmail feature is counted against the outgoing bulk mail limit...... I would guess that as oong as mail went through DH's outgoing mail server you would be dinged, but if you configured moodle to use google's outgoing mail server that would resolve the limitation and make DH much more inviting.....