Moodle on Plesk6: Email and File Upload Problems

Moodle on Plesk6: Email and File Upload Problems

by A. Chavan -
Number of replies: 3

I am trying to install Moodle on Plesk6 running on Redhat9. I am having problems uploading files and getting Moodle to send email.

I had previously installed Moodle -- both 1.1 and 1.2(CVS) -- on a development machine running Redhat8 (not Plesk) and everything worked fine. The production server is running Plesk6 on Redhat9. I installed both Moodle 1.1 and Moodle 1.2 (CVS) on this Plesk system and the problems I encountered (for both Moodle versions) are:

1) Email

Moodle is not able to send email.

Using "Send my details via email" I get:

----
ERROR:
Could not send you an email to confirm the password change
----

Running .../admin/cron.php I get:

----
Attendance: Performing automatic attendance logging
Processing post 5
ERROR: 
Error: mod/forum/cron.php: Could not send out mail 
for id 5 to user 1 (xxxx@xxxxxx.com) .. not trying again.
.... mailed to 0 users.
Running backups if required...
    Checking backup status...INACTIVE
Backup tasks finished
Cron script completed correctly
Execution took 0.294599 seconds
----

I see similar errors after creating new users; Moodle cannot send them email.

However, I am able to send email from the command line on the server and a custom PHP application we have developed is able to send email from that machine.

smtphosts, smtpuser, and smtppass are blank.

Any ideas on what the problem might be?

2) File Uploads

On uploading an attachment to a post on Moodle 1.1 I get:

----
ERROR: Could not find or create a directory 
(/path/to/moodledata/1/moddata)
Attachment could not be stored.
Your post was updated.
----

On uploading an attachment to a post on Moodle 1.2 I get:

----
ERROR: Could not find or create a directory 
(/path/to/moodledata/1/moddataforum)
Attachment could not be stored.
Your post was updated.
----

Uploading a file to "Site Files" generates the following error:

----
An unknown problem occurred while uploading 
the file 'xxxxxx.xxx' 
(perhaps it was too large?)
----

The file is only 8kb and the default PHP max upload settings for the server are much higher.

I have set the permissions for the moodledata directory to 777.

On Plesk, if the user uploading the files is say "ftpuser" then the moodledata directory owner is "ftpuser" and group would be "psacln" (psacln" is a group created by Plesk.) However, files uploaded using Moodle will be owned by "apache" and group "apache". Could this be causing the uploading problem? It works fine on a regular Redhat8 system though.

Any ideas how I can solve these problems? Has anyone run Moodle on Plesk6?

Average of ratings: -
In reply to A. Chavan

Re: Moodle on Plesk6: Email and File Upload Problems (safe_mode related)

by A. Chavan -
I was able to get rid of the above error messages and get email and file uploads to work by switching off safe_mode in php.ini. (See http://moodle.org/doc/?file=install.html#requirements ). Plesk systems and many ISP are likely to have safe_mode enabled. Most of the posts I found in these forums recommend disabling safe_mode (or moving to a different ISP.)

It would be nice to have Moodle under safe_mode and this has been discussed elsewhere in these forums. But for now, it seems that there is no way to get around the safe_mode issue. My next question was going to be what one can do to improve server security if safe_mode has to be switched on -- and Martin has already posted a suggestion.

Ambar Mukherjee on our team (co-author of the Shelf Moodle module) came across a post on the PHP website of a function that uses ftp to create directories (See post dated 09-Nov-2003 07:28). It uses the php function ftp_mkdir. Someone already did rewrite functions in Moodle to use ftp_mkdir. But Martin then had an idea that caused much discussion:

For now though, Moodle needs safe_mode.

In reply to A. Chavan

Re: Moodle on Plesk6: Email and File Upload Problems (safe_mode related)

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
All you really need for file safety is the PHP setting open_basedir which restricts PHP from opening files within certain approved directories.  I really can't see the point in using the full safe_mode.
In reply to A. Chavan

Re: Moodle on Plesk6: Email and File Upload Problems (safe_mode related)

by Don Quixote -
I have a similar problem with Plesk7 on FedoraLinux: Cron jobs don't work (I am testing with the emails sent after forum postings), although I have safe_mode off.

The strange thing is, that via the external URL http://pilot1.leisermathematics.com/admin/cron.php
I am able to trigger the cron task fine. The emails are sent, no error messages. Also the smtp server works fine for the server/user/pass combination I entered in moodle, since I can send mails from this acocunt via webmail.

I don't think that it's a moodle problem.. rather something with Plesk and my LAMP configuration. Any ideas?

Thanks
Andreas