web server write access

web server write access

by Anja Choon -
Number of replies: 22

ERROR: You need to create the directory *** with web server write access


The site administrator needs to fix the file permissions

 

This happens when I try to upload a file. Who knows how to fix this problem? Thanks, Anya

Average of ratings: -
In reply to Anja Choon

Re: web server write access

by David Delgado -
This error is because your moodledata directory (where all the uploaded files are) cannot be written by the web server. It cannot save files there.

To achieve this, your moodledata directory has to be writable by you, your group and others. You can make this with the File Manager at Cpanel, if you have it. Just click in the moodledata directory and selecting "Permissions" in the right column.

Then, you have to set its permisions to:

RWX RWX RWX -> (Read, Write, eXecute) for User, Group and Others

If you have direct shell access (SSH, telnet) you could do it also with this command:

chmod 777 moodledata

Asuming you are in the parent directory of moodledata. If you have Cpanel, you do not need this command.

Take into account that, for security reasons, the moodledata directory should not be inside your web site directory (normaly public_html), but in your home directory.

Hope this helps.
In reply to David Delgado

Re: web server write access

by Anja Choon -

Hola David,

thanks for your reply. I am a real newbie to all this, so please excuse that I didn't understand all what you said. I know I have to change the permission somehow so that the files can be stored but I still don't know how I must do that. You have given me an explanation, but either I don't understand it or it is not applyable in my case for whatever reason.

I think I don't have Cpanel. My webspace provider is www netclusive.de and the database is at http://spencer.netclusive.de/phpMyAdmin/. The attachment contains a screenshot of that last page as it looks like when one is loged in. I would be very grateful for any further comments, if you can spare the time.

Hasta luego, Anya

Attachment database.jpg
In reply to Anja Choon

Re: web server write access - Answer to Anja MC - Permissions without Cpanel

by David Delgado -
I am sorry, Anja, for the delay of my response. I just missed your post for some reason. I have just seen it. There is an answer:

You do not have Cpanel, but I have seen the site of your hosting provider and, having it translated by Google, it says that there is a "simple homepage administration with Confixx 2,0 Pro". Perhaps that tool has a web interface to change permissions from your files.

Anyway, you do not even need to have a Web interface to change the permissions. You can even use a simple FTP program (the one you use to transfer your files to the server). You can use WS FTP, for example. To change permissions in this program, just click with the right button on the moodledata directory and choose chmod(UNIX), then select all the checkboxes in the form and click on OK. That's it!

So these would be the steps:

1) Create your moodledata directory in your home directory (the place where you are when you make an FTP). Say it could be /home/mywebsite (where "mywebsite" is your username)

2) Change the permissions of this directory and the files and directories in it to rwxrwxrwx (that is, Read, Write and eXecute permisions for the User, his Group and Other users). In a numerical form that is expressed as 777. You can change this permissions both
  • With a Web interface, selecting the directory and then permissions and checking all the boxes.
  • With an FTP program, such as WS FTP. Click on the directory with the right button and select chmod.


3) Make sure that in your ~/moodle/config.php Moodle configuration file you put the right path to your moodledata directory (say, /home/mywebsite/moodledata )

I hope all this may help you, if you still have problems with that.
In reply to David Delgado

Re: web server write access - Answer to Anja MC - Permissions without Cpanel

by Anja Choon -
Hi David, sorry as well. I just have seen your response now and hope that I will be able to make any sense of it. Thanks for giving me a helping hand even if it should not work in the end. See you, Anja
In reply to Anja Choon

Re: web server write access - Answer to Anja MC - Permissions without Cpanel

by Anja Choon -
Hi everybody, thanks for your enormous efforts! Nevertheless, in the end it didn't work. A friend of mine said that it could (at least partly) be due to my server. He has installed it now on a different one and this particular problem has dissappeared. Instead, now, we have other ones Clown. That probably means you will see me around once in a while! Greetings, Anya
In reply to Anja Choon

Re: web server write access - Answer to Anja MC - Permissions without Cpanel

by raju malav -
hi dear............
i have just installed moodle1.4 on linux fedora 3 and windows xp.i would be highly gratefull if i can do some help to ppl who facing problems during of its installation......
tell me bt ur problem and on which plateform u r using it...
bbyeee
raju
In reply to David Delgado

Re: web server write access

by Siegwart Mayr -

>chmod 777 moodledata

I have seen several postings recommending this set of  permissions (world read/write) on the data directory, including the official moodle documentation (installation: http://moodle.org/doc/?file=install.html). 

I am concerned here about the security.  Some students get very creative when they find a wide open directory.  I think it would be better to recommend chmod 770 instead (or even 0750), and make all files owned by the webserver. Then there is no need to make all files readable by "other".   We run successfully our site with permissions rwx for "user" and "group" only.  For example:

drwxr-x---    2 apache   apache       4096 Jan 20 16:54 1
drwxr-x---    3 apache   apache       4096 Nov 30 17:42 11
drwxr-x---    4 apache   apache       4096 Dec 29 12:07 12
drwxr-x---    2 apache   apache       4096 Aug  1 09:58 16

Is there a need to make it wide open for "others" as well?  Have I missed something? 

Thank you for clarifying this point.

In reply to Siegwart Mayr

Re: web server write access

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
It doesn't actually say anything about chmod 777 in the install documentation, but I guess the reason people suggest it is because it's the answer with the best chance of making everything work quickly.

For people who understand this stuff or who have user accounts on their server able to browe these home directories then they should restrict it more. I agree - 750 is a much more secure option. There is also a setting in config.php for setting the mode of new directories.
In reply to Siegwart Mayr

Re: web server write access

by Herbert Keijers -
If you run the machine Moodle is on, an even better choise would be permissions 0700 on moodledata and make the webserver owner of directory.
In config.php you set 0700 on dirs to create and you don't forget to change the permission of config.php to 0700 and make the webserver owner of the file.
You don't want other shell users to read your config file !
In reply to Herbert Keijers

Re: web server write access

by David Delgado -
I agree that 700 and owner changed to the Apache user (apache, nobody, httpd,...) is the best option, but... most people run Moodle in a hosting server and are not able to change the ownership of the moodledata directory. So, the only option for them is to set permissions to 777, having moodledata out of the web site directory (normaly ~/public_html).
In reply to David Delgado

Re: web server write access

by Pastor Jim Ouellette -

Hi All. I have successfully installed the Moodle Script on the server using Ws_FTP. I did what you said and went to my CPanel to the File Directory. I created a folder data outside of public_html, set permissions for 777, 755, 700 etc. when I click on Site Files in the site I still get the error. I even tried inside of public_html & even used Ws_ftp to set the permissions and I still get the error. Do the other folders in Moodle need permissions also? Is there something I am missing? I searched your manual and help files. I use - Linux, Apache version1.3.27 (Unix)

Thanks for your time.

In reply to David Delgado

Svar: Re: web server write access

by Trond Kristiansen -
David,
I have this problem with my installation. I am unable to change the ownership of the moodledata directory. Permission is set to 777, but I still have problems uploading files. Here is the error message I get:

Warning: mkdir(/home/xxxxx/moodledata/users) [function.mkdir]: No such file or directory in /hsphere/local/home/xxxxx/xxxxx/moodle/user/lib.php on line 65

rgds,
Trond
In reply to Trond Kristiansen

Re: Svar: Re: web server write access

by Zbigniew Fiedorowicz -

Judging from the error message, you have

$CFG->dataroot  = '/home/xxxxx/moodledata';

in your config.php file, whereas it should be:

$CFG->dataroot  = '/hsphere/local/home/xxxxx/moodledata';
In reply to Zbigniew Fiedorowicz

Svar: Re: Svar: Re: web server write access

by Trond Kristiansen -
Aaah! Thank you so much for your help. The answer was right in front of me. My Moodle installation is now running as a clock.

Many thanks,
Trond big grin
In reply to Anja Choon

Re: web server write access

by Debasis Satapathy -
This happens because your moodledata directory(/home/moodledata) has no webserver write access permission.So either from GUI you can go to the moodledata properties->permissions and there make group as apache and owner as apache or from CUI just use chmod +777 to give write permission to apache.
 Still in /etc/httpd/conf/httpd.conf file just write AcceptPathInfo on.
Now it should work.
In reply to Anja Choon

Re: web server write access

by Antonio Abril -

Hellow:

            I have this problem with my installation. Permission in moodle data directory is set to 777, but I still have problems uploading files. Here is the error message I get:

Warning: mkdir(home/tonymza/public_html/moodle/mooledata): Not file or directory in home/tonymza/public_htnl/moodle/lib/moodlelib.php on line 1002

            The site is www.rrett.org/moodle

           I do not know where is the error !!!!

                        Than you,

                                               Antonio

In reply to Antonio Abril

Re: web server write access

by Jan Dierckx -
Did you make a typing error in config.php ?
the error message states "mooledata" as the moodledatafolder.

Off course you can call this directory whatever you like, but the way you call it in the directory structure should be the same as the directory you reference in config.php
In reply to Jan Dierckx

Re: web server write access

by Jan Dierckx -
I checked and your moodle datafolder definitely is in /moodle/moodledata

Did you correct the typo?

There is another problem. You shouldn't put the moodle data folder inside you public_html directory. Everyone can access your uploaded files by looking at ...

http://www.rrett.org/moodle/moodledata/

Read the discussion above your question.
In reply to Jan Dierckx

Re: web server write access

by Antonio Alvarez Abril -

Hello

           I move Moodle data directory out public_html directory.

          Permission is set to 777, but I still have problems uploading files.

           But now the error message is:

Warning: mkdir(home/tonymza/Moodledata): No such file or directory in /home/tonymza/public_html/moodle/lib/moodlelib.php on line 1002

ERROR: You need to create the directory home/tonymza/Moodledata with web server write access

          But I set up permissions to O777 with cPanel. but the problem persist.

          The Moodledata directory is created and I do not know where is the problem.  The config.php is:

        datarrot = 'home/tonymza/Moodledata';

         The typing is good. 

                                    Thank you so much for your help

In reply to Antonio Alvarez Abril

Re: web server write access

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
Perhaps the missing slash (datarrot = '/home/tonymza/Moodledata';) could be the problem? wink

Uhm, I think I've answered this question in another course recently... big grin

Ciao smile
In reply to Antonio Alvarez Abril

Re: I solved a mystery of (my) web server write access

by Boris N. -
Hello Antonio (and all who have the same problem)!

I was spending 3 days (+2 nights) to reading all about problems with server write access... But when I found an explanation of Zbigniew Fiedorowicz when he answered to Trond Kristiansen in discuss (link: http://moodle.org/mod/forum/discuss.php?d=4604) I ocured that all the problem is in the path of "dataroot". If you are using cPanel to access to your setting you must use the physical path to your "moodledata" folder.

In my case is that folder on:
$CFG->dataroot = 'D:\hshome\xxxxx\moodledata';

My host server is HSPHERE and I was instaled Moodle ver.1.4.4.,
my setting of directorypermissions=0777 and 'moodledata' folder have all read/write permission (I checked it with FileZilla). The folder is outside of my web folder.

I hope that my advice help you (+all) to solved one's own (big) problem!?

Best regards,
Boris