I should like to install Moodle on my Frihost-hosted site. As I have never done anything remotely like this before, I should like to know whether anyone has successfully installed Moodle (I mean on a Frihost-hosted site).
This is so:
1. I can avoid wasting my time if it's not possible.
2. If it is possible, perhaps someone who has done it can give me some useful pointers.
Thanks in advance for your help!
P.S.: I've looked up Moodle on the forums, and although there are several posts by folks wanting to install Moodle, I'm not sure that anyone has actually got Moodle working.
It should be possible, I'll try it out.
Thanks for offering to have a go.
By the way, it looks like the most recent versions of Moodle (1.6 to 1.9) cannot be installed on Frihost hosted sites, as they require MySQL version 4.1.12 or 4.1.16, and we only have 4.0.23.
Moodle 1.5.4 (which is happy with version 3.23 ) is available for download at http://sourceforge.net/project/showfiles.php?group_id=30935
P.S.: Surely someone out there has already installed Moodle and got it working?
yeah just noticed that. The latest version at least doesn't work, just like with drupal.
I don't know about you, but I managed to install Moodle 1.5.4 OK, as you can see from http://infinisa.com/moodle/.
The only problem is (and it's a big one!) that the cron job (in this case, http://infinisa.frih.net/moodle/admin/cron.php) says it does its thing:
|Server Time: Thu, 19 Jun 2008 17:12:36 -0500
Starting activity modules
Processing module function assignment_cron ...done.
Processing module function chat_cron ...done.
Processing module function forum_cron ...done.
Processing module function journal_cron ...done.
Processing module function workshop_cron ...done.
Finished activity modules
Updating languages cache
Running backups if required...
Checking backup status...OK
Getting admin info
Deleting old data
Skipping deleted courses
Michael Rothwell's Moodle
Next execution: Friday, 20 June 2008, 07:00 PM
IB Mathematics SL 2007-2009 Set 2
Next execution: Friday, 20 June 2008, 07:00 PM
Backup tasks finished.
Cron script completed correctly
Execution took 3.533399 seconds
but it fails to do the most important task, which is to send out the e-mails:
- To newly registered students (to verify their e-mails by asking for confirmation)
- To subscribed forum users (recent forum posts).
I don't know whether the problem is:
1. the Moodle configuration (it shouldn't be - I've left everything relevant with its default value, as recommended)
2. the cron job (again, it shouldn't be; I've run it manually as above with apparent success)
3. the Frihost servers are somehow blocking the PHP mail-sending function - and this one I don't know how to check.
I'd be grateful for any help on this.
Hello again rvec
I would like to keep track of the cron job execution. Does DirectAdmin keep a log of this?
If not, it occurred to me that instead of executing cron.php directly, I could execute it from within a shell script that would redirect the output to a file whose name contains the date and time. I'm not sure how to do this exactly, but I suppose the script would be something like:
|fullpath/cron.php > fullpath/filename |
but how do I add the timestamp to the file name?
you could make an extra table in the database and make the cron add a new row to it with an id and the current time.
Something was wrong with mail(). I don't know how to solve it but I'll ask an admin to take a look. In the mean time you could test it by making a new php script and trying out mail() . A sample script can be found on this page: http://www.php.net/mail .
Thanks, that was really helpful.
I'll try out your suggestions re logging cron activity to a new table and doing a simple mail() test.
Please let me know as soon as you have news about mail().
|you could make an extra table in the database and make the cron add a new row to it with an id and the current time. |
I did as you suggested (had to learn php, but it was time I did anyway!):
- I created a new MySQL table, mdl_cronlog
- I made a modified version of cron.php called cronTest.php, to which I added the following lines near the end:
|$datetime = date("Y-m-d H:i:s"); //yyyy-mm-dd hh:mm:ss
$cronlogrec = NULL;
$cronlogrec ->id = 0;
$cronlogrec ->time = time();
$cronlogrec ->datetime = $datetime;
$cronlogrec ->task = 'cronTest';
$cronlogrec ->message = 'Cron script completed correctly';
$id = insert_record('cronlog', $cronlogrec);
// Note: insert_record is a Moodle function, defined in lib/datalib.php
- When I run cronTest.php directly, it adds a record to the table just fine
- I configured the following cron job, following the suggestion on Cron jobs and PHP?
|/usr/local/bin/php -q /home/infinisa/domains/infinisa.frih.net/moodle/admin/cronTest.php |
- The cron job appears not to work, or may be it doesn't have the right permissions; in any case, nothing gets written to the table via cron.
- This has a bearing on the mail() problem, because other folk say they get sent an email when there is an error in a cron job, but I don't. How does one configure/check where such emails are being sent?
|Something was wrong with mail(). I don't know how to solve it but I'll ask an admin to take a look. In the mean time you could test it by making a new php script and trying out mail() . A sample script can be found on this page: http://www.php.net/mail .
I tried something similar to the example to send an email to myself, and it appeared to work; however I didn't receive the email. Something obviously needs fixing here. I notice the sendmail -f parameter is badly set in the php sendmail_path (from phpinfo()), but I shouldn't have thought this is serious.
As usual, I should appreciate any help.
better include the testcron file in the cron file, then you can be sure they are both run at the same time.
and I don't think you should set id, make that auto increment in phpmyadmin and just let it assign that.
|better include the testcron file in the cron file, then you can be sure they are both run at the same time. |
cronTest.php is a full copy of cron.php with a few extra lines, so I run it instead of the original.
|and I don't think you should set id, make that auto increment in phpmyadmin and just let it assign that. |
You're right, it's a waste of time setting id (but does no harm), because it is an autoincrement field:
|CREATE TABLE `mdl_cronlog` (
`id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`time` INT( 10 ) UNSIGNED NULL DEFAULT '0',
`datetime` DATETIME NULL,
`task` VARCHAR( 20 ) NULL ,
`message` VARCHAR( 100 ) NULL
) TYPE = MYISAM COMMENT = 'Logs cron jobs';
Any ideas about the apparent cron job failure & the mail() problem? Also, how do I direct error messages from cron to my email address?
At last I've solved a couple of problems:
1. I've found where error messages are being sent - they're being sent to my frih.net email address, and I can view them using the Webmail link on DirectAdmin
2. I've got the cron job to run. I checked the script's path using php $_SERVER["PATH_TRANSLATED"], and found it needed correcting.
But there are still two problems left to solve:
1. mail() still doesn't work, but at least I now get an error message
If I do:
|$to = "MyEmailAdress";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$mailsent = mail($to,$subject,$message);
I get the error message:
|This message was created automatically by mail delivery software.
A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:
------ This is a copy of the message, including all the headers. ------
Received: from apache by host.frih.net with local (Exim 4.60)
for MyEmailAddress; Mon, 23 Jun 2008 06:43:59 -0500
Subject: Test mail
Date: Mon, 23 Jun 2008 06:43:58 -0500
Hello! This is a simple email message.
As the problem may be related to the configuration settings, I am sending you (privately) the output from phpinfo()
2. Although the cron job runs the cronTest.php script, it imediately fails because of the "open_basedir restriction":
|Warning: require_once(): open_basedir restriction in effect. File(../config.php) is
not within the allowed path(s):
Of course this happens because moodle is including files from its own directory structure.
I should be grateful for any suggestion as to how to move forward on these issues.
I've finally got the cron job to work perfectly. I just had to place my script one folder level higher to avoid running foul of the open_basedir restriction (and move a folder for the same reason).
Now I just have the original problem to solve - how to get mail() to work.