Dear fellow Moodlers,
I'm getting a load of error messages when I'm trying to backup my new site. I guess it's a matter of some permission problem somewhere. Any ideas?
yours,
Lin
# Creating temporary structures
Warning: mkdir() [function.mkdir]: Permission denied in /var/www/moodle/lib/moodlelib.php on line 6779
# Deleting old data
# Creating XML file
* Writing header
Warning: fopen(/var/www/moodledata/temp/backup/1189408008/moodle.xml) [function.fopen]: failed to open stream: No such file or directory in /var/www/moodle/backup/backuplib.php on line 353
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 355
* Writing general info
* Writing course data
o Course info
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 603
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 605
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 612
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 617
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 618
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 619
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 620
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 623
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 624
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 625
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 626
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 627
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 628
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 629
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 630
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 631
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 632
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 633
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 634
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 635
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 636
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 637
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 639
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 640
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 641
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 642
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 643
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 644
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 645
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 646
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 647
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 648
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 649
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 650
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 651
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 657
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 659
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 660
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 661
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 662
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 663
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 664
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 665
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 2276
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 2301
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 2307
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 2337
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/moodle/backup/backuplib.php on line 672
An error occurred while backing up course start
Hi. I don't really know much about Moodle, per se, but I do know a lot about PHP and server administration. So, some pointers and questions:
The permissions and ownership of /var/www/moodledata/temp/backup/ should be set to allow the "user" who runs the webserver (assuming Apache) to be able to write to this directory.
You will need to know more about the Unix commands:
Please post back later when you get stuck or if you have another question. Seeya...
- The first error, "Warning: mkdir() [function.mkdir]: Permission denied in /var/www/moodle/lib/moodlelib.php on line 6779" is really the only problem. The rest of the errors will almost certainly go away if you can fix this permission problem.
- The permissions that need to be fixed are on the parent directory of the directory in which a file is being created. (See further description, following these bullets)
- It is not really a Good Idea(TM) to put your moodledata/ directory in /var/www. It should go directly in /var (i.e. "/var/moodledata")
- Why? Because putting moodledata/ in /var/www/ makes it directly accessible to anyone with a web browser, unless you are very careful to monitor the permissions and settings of your web server.
The permissions and ownership of /var/www/moodledata/temp/backup/ should be set to allow the "user" who runs the webserver (assuming Apache) to be able to write to this directory.
You will need to know more about the Unix commands:
- ls -l
- chmod
- chown
Please post back later when you get stuck or if you have another question. Seeya...
I am getting this same error when attempting to change the parent of a Question directory. I have tried changing the moodledata folder permissions to Nobody with Read and Write permissions, but that did not work. Where should the permissions be applied? Can I move the data via the database itself?
Warning: mkdir() [function.mkdir]: No such file or directory in /var/www/CentralYorkMoodle/moodle/lib/moodlelib.php on line 8006
Warning: copy(/var/www/CentralYorkMoodle/moodledata/1/Sounds/0/01-03.mp3) [function.copy]: failed to open stream: No such file or directory in /var/www/CentralYorkMoodle/moodle/question/contextmove.php on line 120
Warning: mkdir() [function.mkdir]: No such file or directory in /var/www/CentralYorkMoodle/moodle/lib/moodlelib.php on line 8006
Warning: copy(/var/www/CentralYorkMoodle/moodledata/1/Sounds/0/01-03.mp3) [function.copy]: failed to open stream: No such file or directory in /var/www/CentralYorkMoodle/moodle/question/contextmove.php on line 120
I resolved this issue by;
1 - To find the code I turned Debugging on and set it to "Normal: Show errors, warnings and notices".
2 - I then attempted to change the questions category.
3 - I noted the exact file and line number that the error occurred in.
moodlelib.php on line 8006
4 - I opened up the php file with a text editor and changed the line that read,
"$status = mkdir($dir, $CFG->directorypermissions);" to,
"$status = mkdir($dir, $CFG->directorypermissions=00777,true);".
1 - To find the code I turned Debugging on and set it to "Normal: Show errors, warnings and notices".
2 - I then attempted to change the questions category.
3 - I noted the exact file and line number that the error occurred in.
moodlelib.php on line 8006
4 - I opened up the php file with a text editor and changed the line that read,
"$status = mkdir($dir, $CFG->directorypermissions);" to,
"$status = mkdir($dir, $CFG->directorypermissions=00777,true);".
Hi guys,
By just seeing the posts in this thread, I was able to fix my issue. Thank you for your clear and detailed information with fixing this issue.
Regards,
mvsx
Hello guys,
I just changed the script under moodlelib.php what Thomas did as well and it worked fine with backing up courses however when I try to import activities/courses it still gives me the same error message. I turned debug mode on and the line that its having problems was the line that I edited with regards fixing backing up courses:
Copying course files
Copying site files used in course
Zipping backup
Copying zip file
---------------------------------------------------------------
Warning: mkdir() [function.mkdir]: Permission denied in /home/olympus/public_html/olympusfitnesscourses.com/moodle/lib/moodlelib.php on line 8274
Warning: mkdir() [function.mkdir]: Permission denied in /home/olympus/public_html/olympusfitnesscourses.com/moodle/lib/moodlelib.php on line 8274
An error occurred while copying the zip file to the course directory
---------------------------------------------------------------
The line is :$status = mkdir($dir, $CFG->directorypermissions=00777,true);
Is there something that I miss brought me to this issue?
Kind Regard,
mvsx