File Upload and Backup problems

File Upload and Backup problems

by Stephen Henneberry -
Number of replies: 7
Currently, I am having issues with uploading files backing up my site.  I assume that the two problems are related, so I have lumped them togeter here.

For the file upload problem, when I try uploading using the Resource module,  I keep getting the following error message:

move_uploaded_file(/home/dokusha/www/www/moodle/data/11//Reading1.doc): failed to open stream: Permission denied in /home/dokusha/www/www/moodle/files/index.php on line 124

Warning: move_uploaded_file(): Unable to move '/tmp/phpd2Q1KV' to '/home/dokusha/www/www/moodle/data/11//Reading1.doc' in /home/dokusha/www/www/moodle/files/index.php on line 124

line 124 in this file reads as follows:
if (move_uploaded_file($userfile['tmp_name'], $newfile)) {

any ideas what this means???

Uploading of user images does not seem to work anymore either...

For the backup issue, in the backup emai that I receive the log looks fine exept for the last lines which read:

08:04:22    calculating users
08:04:22    calculating user files
08:04:22    calculating course files
08:04:22  Phase 2: Executing and copying:
08:04:22    checking temp structures
08:04:23 End backup course Dokusha.com: Courses - ERROR!!

I get this message for each course.


There must be one major permissions issue, but I am not sure where it is.  My classes start tomorrow, so I am a bit stressed about this at the moment...
Any ideas?
Average of ratings: -
In reply to Stephen Henneberry

Re: File Upload and Backup problems

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
It seems you don't have permissions for your web server to write to the directory (and sub-directories of)

/home/dokusha/www/www/moodle/data

There has been loads of threads and FAQ entries about this, but basically you need to allow whatever user your web server runs as to write to this directory. I cannot be more specific about this as it depends on your local setup. A lot of people just make the area writeable by everybody - I don't recommend it - but

chmod -R 777 /home/dokusha/www/www/moodle/data

BUT.... black eye

More worrying is that you have put your data area inside of your moodle web site. This is a very bad plan by itself. It means that your data is theoretically available over the web and it also makes upgrades a hassle. The data directory should be completely away from your web accessible path, for example..

/home/dousha/moodle_data

Hope this helps!
In reply to Howard Miller

Re: File Upload and Backup problems

by Stephen Henneberry -
When this problem started I changed the permissions on the data folder to 777 to check to see if it was a permissions issue. This had no effect on the error message, so I can only assume that the error lies someplace else. As to the data folder location, I have an .htaccess file in the folder to deny access and it has worked this way with all previous versions. I have had small issues with upgrading (I have had to copy over the data), so I will take your advice and move that folder.
Any other ideas as to what is causing this???
Does anybody understand why that line of PHP code is getting pointed out to me???
In reply to Stephen Henneberry

Re: File Upload and Backup problems

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Stephen,

when you says that you've "changed the permission on the data folder to 777", are you affirming that you have done it recursively (see the -R flag in Howard's post). Have you tried it with the initial zero (i.e. chmod -R 0777)?

What values do you have in your $CFG->directorypermissions variable (in config.php file)? Have you modified it?

Finally, seeing your previously post about the scheduled execution of course backups, the step where it finish (checking temp structures), seems to confirm a bad write permission, because that part of the backup only tries to create the "temp/backup" dirs under your data dir.

Ciao smile
In reply to Eloy Lafuente (stronk7)

Re: File Upload and Backup problems

by Stephen Henneberry -
Thank you for pointing out the difference there between 777 and 0777. I had initially changed the permissions with Fetch, which does not seem to have an option for the preceding 0. I have since used the File Manager on my server and changed it to 0777. Now it seems to be working fine. (What confuses me, is that my server shows the permissions in this format drwxrwxrwx, and that did not change after I updated it...???)

I am not sure if I have solved the backup issue as of yet. I have tried setting up a few scheduled backups, but I have not received any of the backup emails for them.
The backup issue is not as pressing, so I will just keep plugging at it...
In reply to Stephen Henneberry

Re: File Upload and Backup problems (me too)

by angel williams -
I'm also having problem with backup that i'm not sure what kind of a permissions issue because there is not much information--just that it is not permitted. this is the error i get when initiating cron. thanks in advance for anyhelp


Executing backup

Warning: chmod(): Operation not permitted in /hsphere/local/home/adminup/train.urbanpeace.com/backup/lib.php on line 128

Warning: chmod(): Operation not permitted in /hsphere/local/home/adminup/train.urbanpeace.com/backup/lib.php on line 147


Warning: unlink(/hsphere/local/home/adminup/moodledata/temp/backup/1080089526/using_moodle_for_students.zip): Permission denied in /hsphere/local/home/adminup/train.urbanpeace.com/backup/lib.php on line 148

End backup with ERROR
Next execution: Tuesday, 13 April 2004, 12:00 AM
In reply to angel williams

Re: File Upload and Backup problems (me too)

by W Page -
Hi Angel!

I believe your post is the second one I have seen lately with the "End backup with ERROR".

Suggest you do a search in these forums for that phrase or for the keywords "backup error" together and see if you can get some additional insight into what is happening.

WP1

In reply to Stephen Henneberry

Re: File Upload and Backup problems

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Are you using a hosting company or are you hosting the moodle site yourself?

If at all possible try and check the apache error logs just after the error occurred - this may give more information. Also, if you can, its a good move to change the ownership of the data directories (recursively) to that of the httpd user (which depends on the system you are using).

It is *highly* unlikely that this is not a permissions/ownership problem of some sort.