As far as I know moodledata CAN NOT be inside moodle directory for security reasons.
Did you try creating it outside moodleroot directory?
If you could post the url to Moolde and the url to your moodle_date folder it might give us a bit more of a clue as to where the problem is.
Yes, this directory must be readable and writable by the webserver owner.
cut and paste from the config file
// 4. DATA FILES LOCATION
// Now you need a place where Moodle can save uploaded files. This
// directory should be readable AND WRITEABLE by the web server user
// (usually 'nobody' or 'apache'), but it should not be accessible
// directly via the web.
// - On hosting systems you might need to make sure that your "group" has
// no permissions at all, but that "others" have full permissions.
// - On Windows systems you might specify something like 'c:\moodledata'
$CFG->dataroot = '/home/example/moodledata';
end cut and paste
Best is to place it outside the scope of your webserver.
Can you do a chmod 777 on the directory ?
If it works, you can start to worry about restricting down permissions.
Im recently having the same issue, are you creating the moodledata director on a diffrent partion from the location of the moodle folder.
I belive it is to do with the way your web server trys to communicate to moodle. It cant find the specified directory as it is not located on the same partionion. Try creating a moodledata directory on the same level as your moodle folder, this seemed to work for me. And when your system goes live just removed the security on the folder an only allow administrators access, this will still be as secure as placing it in a diffrent location.
Manualy creating this folder will most likely not work. I have viewed your setup an seems that your moodledata directory should be placed onto a sepreate partion to allow for security issues that may arise.
If u create a new folder called moodledata, in the root of your c drive an configure your security settings on the folder to allow administrators full control. Also make sure your user accounts is a member of administrators. Once u have made this folder try pointing directly to it from the install file. If this does not work i would recommend manually editing the install file and entering your own speified zone for the folder.
Also it may be usefull for other's if u leave the details of what server, php and other viable information for future issues.
I'm afraid I know very little (as in next to nothing) about server admin, so I'm a bit confused by your message. If you could give me a little more explanation, that would be very helpful. This isn't my own server -- this is a server that is being hosted by a hosting company.
The server uses Redhat Linux and MySQL.
Where do you spefically want to create your moodledata folder, you will be required to open the file name install.php and manually edit two lines to force the program to recognise the choosen path. This would require you to change the way when moodle askes where would u like to create your data diretory from c:\moodledata. You would replace that with where u would prefer it to be an you should resolve this issue. If you have any problems paste the info about exactly where u want your moodle directory to be an i will configure a install.php file for you.
The URLs I'd like for them to be in are 'http://www.stevesilverphotos.com/moodle/' and 'http://www.stevesilverphotos.com/moodledata/'.
Thanks again for your assistance!
Just one last question about permissions: what permissions should I set for the moodle folder and the moodledata folder to give it the most security but still allow moodle to function properly?
Could you be a bit more specific which lines to edit in the install file as I am having the same problem. I have set the permissions to 777, on the directory, but stll no luck. My moodledata directory cannot be view on a URL is this a problem, however at the moment it is empty.
I am installing on Fedora Core 5 with MySQL
The moodle directory is
I am trying to put the data directory in
the URL is
Thanks that has let me progress
I am currently testing moodle on my Linux box(Redhat 5.1) with Mysql, PHP and Aapche.
I have a problem on the step data directory.
my current directory:
Moodle Directory /opt/moodledoc/moodle
Data Directory /opt/moodledoc/moodledata
I already granted permission 777 to /opt/moodledoc/moodledata and it still complain that "The 'Data Directory' you specified could not be found or created. Either correct the path or create that directory manually."
Can you help me to edit my installation.php file?
This whole discussion is an insane assylum. The only bit of sanity is the second post, from JDMP, which points out that the Moodle data cannot be within the Moodle folder for security reasons. Actually, it can be, but it shouldn't. In fact, if possible, it should be completely outside the web document root as defined in the web server configuration (in your case, httpd.conf), so that it is not accessible by the outside world over the Internet. If it is not possible, an .htaccess file should be placed in the folder to make it inaccessible. See http://docs.moodle.org/en/Installing_Moodle#Creating_the_data_directory_.28moodledata.29
The first bit of insanity is where HS asked SS for the URL of his data folder. Since the data folder should not be in a place where it can be accessed over the net, the correct answer should have been "there isn't any, of course, and shame on you for asking." Instead, he gives it, thereby not only confirming that his site is insecure, but announcing to the whole world how they can hack into his data folder!
Actually, there is another bit of sanity, in the first post by HK, which includes a comment that is part of config.php, that tells you the data folder should not be accessible. Nobody in this thread seems to have noticed that.
Aside from that, modifying install.php should not be necessary. The script prompts you for the pathname of your data folder, and you can give it any path you want. For some reason, for SS and you, it is not recognizing it. But we need to find out why. Changing the installation script is the wrong answer. And asking one of the inmates of this asylum is a bad idea.
I just checked the code to see how this error msg. is triggered. It does a number of things, but the bottom line is, it looks for a subfolder of your data folder called sessions. If it doesn't find it, it tries to create it. If it cannot create it, it issues the msg. So why not try creating a subfolder called sessions, and see if that helps.
While looking for something else, I ran across this old post of mine that might be of some small interest:
Thank you for your posting. I am SO glad I read to the bottom of the page before trying to change code in the installation script.
I am brand new to Moodle and was searching for an answer to my "data directory cannot be found" problem - and adding the sessions subfolder did the trick.
Im on an external windows based plesk server (shared hosting environment).
When I run the install file, http://www.xxx.xxx/moodle/install.php I get to a window where it asks "Please confirm the locations of this Moodle installation". Now, on this window it is right when it refers to the web address, however on the moodle directory it refers to "C:\Webs\xxx.xxx\httpdocs\moodle and on the data directory it refers to C:\Webs\xxx.xxx/moodledata(note the forward slash)
I have, as per the indication on this window created the complete address, however, it still when I click next, said "The 'Data Directory' you specified could not be found or created. Either correct the path or create that directory manually."
- Don't worry about the forward slash. Moodle is written in PHP, and in that language on Windows servers, it treats both types of slashes in pathnames interchangeably. In fact, it is better to use forward slashes consistently in pathnames, because backslashes are used as escape characters, so they can cause confusion. For example, if you enter \\server1\dir1\data, PHP will interpret this as \server1\dir1\data. If you want it to see the second backslash, you need to use three: \\\server1\dir1\data. But if you use forward slashes, you don't have that problem.
- Have you read the rest of this thread, and the other threads they link to (they are relatively few and short)? Because you haven't said that you have tried some of the suggestions listed in them, like checking PHP settings, or creating a sessions subdirectory.
The standard web path is /srv/www - Yast automatically installs the moodle directory and a moodledata directory under that path i.e. /srv/www/moodle and /srv/www/moodledata
It also installs a config-suse.php script which merely includes a config-moodle.php installed under /etc/moodle which is a config.php file version with the data path set to the /srv/www/moodledata directory.
I have tried every trick mentioned here and elsewhere to create the data directory in another place but no luck - this seems to be the required Suse setup
Could you be more specific about what you mean by "no luck"? Is the server yours (or your employer's), or are you using a shared commercial web host? In the latter case, it is quite possible that your host restricts your ability to create directories to within the web root. In that case, use .htaccess to prevent web browser access to your data directory.
But if the server does belong to you or your employer, organization, etc., and you can run Linux commands as superuser root, you should be able to create directories anywhere you want with any name you want anytime you want with the md (or mkdir) command; no "tricks" required. What happens when you try?
Then when you do create the data directory outside www, you will need to edit config.php so that it points to the correct pathname. If config.php has not yet been created, when you run the install script and it asks for the data directory path, give it the path where you created it.
If the version of Moodle Yast gives you won't let you answer that prompt, you can bypass the install script altogether by creating config.php yourself. Just copy config-dist.php (or config-moodle.php) to www and rename it config.php. Then edit it with your favorite text editor (vi, emacs, etc.). There are lots of comments in config-dist.php to guide you. Then when you browse to your home page (index.php), it will go straight to admin/index.php and start creating the database tables.
I have tried creating the directory through the Moodle installation process
I have tried creating the directory from the terminal (mkdir)
I have tried creating the directory using the 'Dolphin' file manager app
I have checked that Apache runs as wwwrun in group www and set the ownership as that
I have tried several different variants of the access permissions
I have turned off firewall and AppArmor security
I have verifed that SELinux is not running
I have examined and amended where necessary the php and apache config files.
I still cannot get Moodle to access the fiels except in the /srv/www directory
I asked you to be more specific about what you meant by "no luck". You have not answered that question. You say you tried creating a directory in various ways. But you haven't said whether the directory creation worked or not, i.e. did the directory actually get created? Or is the problem that it does get created, but Moodle cannot access it?
In the latter case, make sure you don't have safe_mode on in your PHP configuration. Also, check for open_basedir. If you have that on and cannot deactivate it, at least add the data directory to the list of directories in the open_basedir setting.
BTW see http://moodle.org/mod/forum/discuss.php?d=119596. OB's sarcastic response showed that he completely missed the point, so there was no point in responding. That went so well that I didn't use the same approach with you. Maybe I should have.
I've had a similar message in my installation.
In my case, I use Debian Lenny and the *.tgz file (version 1.9.4 of moodle) downloaded from moodle site.
When I got the message, what I found was that apache runs under user "www-data" (it was not the usual "apache" or "nobody").
After changing owner of the directory (previously created with mkdir) to that user (permissions set 755) it worked well.
Hope this helps.
As I stated in my first e-mail I have already tried the methods listed in the forum. A simple repetition of these was not helpful.
Obviously I have managed to create the directory, otherwise I would not have been able to attempt changes to the access permissions, as mentioned in my second posting. Also I have, as mentioned there, checked the PHP and Apache configuration files.
Also, ref Ariel's response, I have checked that Apache runs as user wwwrun in group www and used that.
As this is an experimental use of Moodle I have gone ahead with installing in the web path with an .htaccess file.
Thank you anyway
This is getting to be an epidemic. I am being misunderstood by OB and now by you. Let me try to clarify (both what I said and what you said).
First of all, you didn't upset me. I just have difficulty avoiding repeating suggestions to people who say they have tried "all the previous" suggestions, without specifying what those suggestions were. That's what I tried to explain to OB. I was trying to help him to understand why nobody else was replying to his post (and btw, nobody else has!) But as I said before, he totally missed the point.
Secondly, by "my previous response" I assume you mean my first post in this thread addressed to you. If that's what you mean, I am surprised. I would not be too surprised if you said my post to OB was patronising, although that was not my intention either. Or even my referring you to that thread. But my previous response? I am totally mystified. Unless you think I was being patronising because I was repeating suggestions you've already tried. But again, since you didn't say (before) exactly what suggestions you tried, I had no way of knowing what to avoid. As I said to OB, the only way to avoid all possible suggestions you may have tried would be to read every post on the subject in every forum (you did say "here and elsewhere"; that could mean this thread and others, or this forum and others) since Moodle began. And that's not going to happen.
[EDIT: Finally, I just took another look at your second post. Again, you were not very specific. Yes, you did say you "tried several different variants of the access permissions", but on what? You might have meant you tried changing the permissions on the parent directory to enable you to create the subdirectory.]
So I'm sorry I tried to help you. I won't make that mistake again.
And the next time someone says they have tried all the suggestions -- about anything -- I just won't reply.
I solved this problem by following these steps:
Step 1. Rename "config-dist.php" to "config.php"
Step 2. Enter the value manualy in config.php for the following variables.
Note: Create a data folder manually via FTP and give write permission (777) to it.
save and upload in your moodle root folder.
I hope it will work fine and no need to create .htaccess file.
Please refer config.php file for more details.