The 'Data Directory' you specified could not be found or created.

The 'Data Directory' you specified could not be found or created.

by Jonathan Konrad -
Number of replies: 13
This is my second installation of Moodle 1.5.2 Stable. My first went without a problem. It was done on Mac OSX, with Apache 1.3, MySQL 4.x and PHP 4.x. My hardware was too weak to do justice to this great package, so I tried to install to a linux box I have kicking around.

The os is Fedora Core 4, Apache is 2.x, PHP is 5.x with GDI support and MySQL is 4.x My problem occurs right at the begining with this error:

"The 'Data Directory' you specified could not be found or created. Either correct the path or create that directory manually."

It's strange, since the directory I point it too has 777 as it's permissions, it's owned by the apache user and apache group. I've tried creating a variety of directories, in a variety of location, all with no success. Any help would be greatly appreciated. I demonstrated this to my admin on the Mac, now the Admin wants me to deliver on linux!
Average of ratings: -
In reply to Jonathan Konrad

Re: The 'Data Directory' you specified could not be found or created.

by Sanjay Katiyar -
Hi Jonathon,

There is one suggestion:
Copy or rename config-dist.php file to config.php file and make the all changes according to your settings (dbname, user, webroot...etc) and then point browser
http://your host/moodle/index.php

smile
In reply to Sanjay Katiyar

Re: The 'Data Directory' you specified could not be found or created.

by Jonathan Konrad -
Thanks for the suggestion. It did not work. Now I just have a blank screen. Actually this is similar to what I first tried. I tried to copy my existing moodle installation to the new server, and then just edit the config.php file. What results is a blank white page that does not go anywhere. Any other thoughts?
In reply to Sanjay Katiyar

Re: The 'Data Directory' you specified could not be found or created.

by Jonathan Konrad -
A linux friend of mine mentioned that this is most likely a permission issue with PHP and Apache 2. Does anyone know how to allow full access or script source path access or something like that to directories in Apache 2? The folders have 777 permissions on the local linux box, but Apache is actualy controlling the access from php files. Help?
In reply to Jonathan Konrad

Re: The 'Data Directory' you specified could not be found or created.

by Jonathan Konrad -
Just thought I'd post the solution. When I installed core 4 I wasn't paying that close attention. I enabled selinux. That was shutting down Apache from having the proper read/write access. I'm told one can configure selinux to work with this, but it was well beyond me. Just needed to add a command line kernel parameter "selinux=0" in /boot/grub/grub.conf).

Also the php that comes with Fedora Core 4 needs to have GDI and MySQL extentions added.

Now it works as expected. Thanks for all who thought about the problem.
In reply to Jonathan Konrad

Re: The 'Data Directory' you specified could not be found or created.

by Lena Persson -

Similar problem here, although this is on a Virtual Private Server...

I would like to keep the data directory outside the web root, but whatever permissions are given to it, so long as it remains outside the webroot, Moodle (ie PHP) fails to find it.   So, despite concerns about security and accessibility, it's now sitting in the httpdocs directory, protected by .htaccess "deny from all".

My setup: PHP 4.3.10 on Apache 2.0.51

I wonder (does any know?) if the following php settings are relevant:

safe_mode on
safe_mode_include_dir novalue
open_basedir /home/domain/httpdocs

I'll do some experimenting shortly, but would welcome any advice.

BTW, what is so bad about putting the data directory under the webroot, so long as it remains protected as described above?

In reply to Lena Persson

Re: The 'Data Directory' you specified could not be found or created.

by Jim St. Peter -

Actually, if your using different OS's (OpenBSD) you will find Apache is chrooted and the data directory must be under the chrooted directory. Mine is in /var/www/moodledata.

Jim

In reply to Jonathan Konrad

Re: The 'Data Directory' you specified could not be found or created.

by Barry C -
Actually. From  security point of view, the solution is not to trun off the security features smile

I am installing on the same sw config - FC4, etc. and got the same error.

Here is how I resolved it:

# chcon system_u:object_r:httpd_sys_content_t moodledata/
# ls -Zd moodledata/
drwxrwxrwx  apache   moodle   system_u:object_r:httpd_sys_content_t moodledata/

This leaves the security that selinux brings (not inconsiderable) intact on your whole system.

Best,

Barry



In reply to Barry C

Re: The 'Data Directory' you specified could not be found or created.

by Skak Agrawal -
Hi,

I am trying to install on linux server and getting the same problem "Thed 'Data Directory' you specified could not be found or created".

I tried changing the owner and group of folder to apache. Also tried setting the selinux=0; but still it is not working.

Any other pointers?

Regards
Arvin
In reply to Skak Agrawal

Re: The 'Data Directory' you specified could not be found or created.

by Richard Enison -
AA,

For starters, changing the owner and group to apache will not do any good at all unless the name of the user and group under which Apache (I presume you are using the Apache web server) runs. The instructions only imply it is usually apache or nobody. It might be neither. It would help if you at least have read access to the httpd.conf file (or whatever file is being used to configure Apache). Look in there for a User directive that is not commented out by a # in front of it. This should tell you what username Apache runs as, provided it is started up by the root linux user.

Also, you said you turned off selinux, but what about safe_mode and open_basedir? They can make it difficult to put your data directory outside the web root because PHP might be prevented from accessing it.

RLE
In reply to Richard Enison

Re: The 'Data Directory' you specified could not be found or created.

by jessie butler -
well where do I start,
I am having the the same problems as everyone else, but I am a newbe at linux and server tech. I am running Ubuntu os and lampp for the server. So a lot of this advice is going over my head. I can login as nobody as shown above, as far as editing any of the php or conf files I more details as far as which file the code and where to edit it. any help is welcome thanks
In reply to jessie butler

Re: The 'Data Directory' you specified could not be found or created.

by Richard Enison -
JB,

No problem. But as I take a cursory look over the posts in this thread, in every case that I noticed where a file was referenced, the name of the file was given (I said in mine that the Apache configuration file is usually called httpd.conf because I have seen posts in earlier threads that reported a different name, but it ended in .conf; since you are using lampp I would guess that in your case, it is called httpd.conf). So if you could be more specific about which files you need help with, we might be able to answer you. And when you ask where to edit it, do you mean you want to know where the file is located, that is, what folder (directory)? Or do you mean what program should be used to edit it?

RLE
In reply to jessie butler

Re: The 'Data Directory' you specified could not be found or created.

by Richard Enison -
JB,

After posting my previous reply, I couldn't get the question out of what I laughingly call my head: how does Apache know the name of the main configuration file if it isn't httpd.conf? So I looked in the Apache manual and found that, if it (or a batch file or shell script that launches or installs it) is launched with the -f option, that option gives the full pathname of the main Apache configuration file. So unless the shell script you use to start up Apache, or the one that was used to install it as a daemon, contains a line that uses the -f option or was run with the -f option, your configuration file is httpd.conf. It would be in the conf subdirectory of the main Apache directory, although this could have been changed when Apache was compiled. The shell script would be called something like apache or apachectl.

RLE
In reply to Jonathan Konrad

Re: The 'Data Directory' you specified could not be found or created.

by Mohamed Rasheed -

Hi

I’m new to linux. I was trying to install moodle in Fedora7 virtual dedicated server using Plesk and/or SSH
I receive the same error message. I tried all the solutions posted here

1- Create the directory manually in different locations such as

/var/www/moodledata
/var/www/vhosts/chroot/var/moodledata
/var/www/vhosts/httpdocs/moodledata

also changed directory permissions, didn't work

2- Edited config.php manually, received the following error
"Error: Database connection failed. It is possible that the database is overloaded or otherwise not running properly. The site administrator should also check that the database details have been correctly specified in config.php".

Even though all parameters are correct

3- Logged in as root tried to edit the /boot/grub/grub.conf
could not find the file

4- I also Tried to edit selinux using the following command

#chcon system_u:object_r:httpd_sys_content_t moodledata

Received error message "operation not supported"


does anyone know what am missing here