Data Directory not writeable

Data Directory not writeable

by Peter Astbury -
Number of replies: 12

I've looked through previous posts on this topic and haven't found a resolution yet.

The problem: Moodle can't write to my moodledata directory

  • I am using PHP 5.3.2
  • I have turned off PHP safe mode
  • I have disabled open_basedir restrictions
  • I have the moodledata directory outside my http root
  • I have used chmod 777 on the moodledata directory (temporarily I might add - the plan is to get it working like that and then reduce permissions afterwards)
  • I have successfully overcome the same problem with Mahara with the same settings as above on the same server (different vhosts but I don't see why that should effect it, both run identical configs)

Can anybody see anything I'm missing?  Seems wierd that Mahara would be fine but not Moodle.

Average of ratings: -
In reply to Peter Astbury

Re: Data Directory not writeable

by Peter Astbury -
problem solved.  I'd put the moodledata folder within a folder protected by plesk.  Moved it to just outside the webroot and all is now well.
In reply to Peter Astbury

Re: Data Directory not writeable

by Simon Clegg -

Hi Peter,

I'm having the same problems with Plesk. Could you please elaborate on what you did to overcome?

Many thanks,

Loquela

In reply to Simon Clegg

Re: Data Directory not writeable

by Simon Clegg -

I don't think Peter is subscribed to this forum so I appeal to anybody else out there.

I have my moodle installed on a Plesk server and it is working fine except for the fact that the moodledata folder is unaccessible/not writable.

The path to the install is /var/www/vhosts/mywebsite/httpdocs/here is moodle

I have placed the moodledata folder here: /var/www/vhosts/mywebsite/moodledata

CHMOD is 777 and CHOWN is "user":psaserv

It seems no matter where I put the directory I get the error:

ERROR: You need to create the directory {/var/www/vhosts/mywebsite/moodledata with web server write access}

Anybody managedto install Moodle successfully on a 1&1 dedicated server running Centos5 and Please Panel 9?

Help! angry

 

Many thanks in advance

L.

In reply to Simon Clegg

Re: Data Directory not writeable

by Andrea Bicciolo -

You have the moodledata folder outside the web space, which is ok, however you need to chown moodledata to apache user (which in centos should be "apache"), then you can give a safer 750 permission.

According to your php config, you may also need to tweak your "open basedir" directive, either globally or per vhost configuration.

In reply to Andrea Bicciolo

Re: Data Directory not writeable

by Simon Clegg -

Hi Andrea,

I think I am correct in setting chown to user:psaserv as this is how Plesk is configured.

I tried uncommenting and setting the base_opendir = /var/vhosts/ in /etc/php.ini but that didn't work either...sad

In reply to Simon Clegg

Re: Data Directory not writeable

by Andreas Gounaris -

Same problem I had until I was adviced by my host provider to switch PHP support from Apache module to fastCGI. Plesk supports this switch through the interface. Then I was able to access directories outside wwwroot.

Apache module probably sees the docroot folder as the global root '/'

This was reported in another discussion: http://moodle.org/mod/forum/discuss.php?d=160912#p705662

In reply to Andreas Gounaris

Re: Data Directory not writeable

by Simon Clegg -

Hi Andreas, thanks.

I changed to fastCGI but that didn't help sad

In reply to Simon Clegg

Re: Data Directory not writeable

by Simon Clegg -

I'm still trying to sort this and contact my providers at 1&1 Hosting UK has called up blanks.

For those of you currently trying to decide which hosting partner to use, see if the following support exchange from 1&1 helps you decide at least who NOT to go with:

First I telephoned their dedicated support line (6p/minute) and had to wait in a queue for 5 minutes. The support agent spent about 20 minutes tinkering about on the server and we concluded with an unresolved situation. So I decided to email.

Me to 1&1 dedicated support at 11:51 :

Hi there,
I spoke to one of your agents earlier today regarding this same issue. We thought we had resolved it but in fact we had not.
I am running Moodle at www.mydomain.co.uk

The installation works perfectly fine accept for the fact that it is unable to access/write to a data directory that is stored outside the webroot: var/www/vhosts/myvhost/datafiles

In order to get the application working correctly, I have had to move this
data directory into the web doc root: var/www/vhosts/myvhost/httpdocs/datafiles

The instruction for the application to point to this directory is in httpdocs/config.php

For security reasons, I need the datafiles in a location outside the web doc
root. However, no matter what I try the application is unable to access/write to any directory outside of httpdocs.

I have not had this issue before with installations of this software on other unix and windows servers not using Plesk.

Please help asap.

Kind regards,

Simon

Their reply at 16:24

Thank you for contacting us.

Unfortunately, this is not something we support. From the issue you are having, it sounds like it may be linked to permissions. My suggestion would be to search on the Plesk support page to see if further information is available about using this software.

If you have any further questions please do not hesitate to contact us.

!?! surprise


In reply to Simon Clegg

Re: Data Directory not writeable

by Andreas Gounaris -

Here is what I did, just for the record:

  1. Created a "data" folder under the root of my domain. My thought was to have a root directory for all data folders for future projects.
  2. Told my provider to chgrp the folder to Apache group (psasrv) and set permissions 775. I didn't have permissions to do that myself
  3. I then created the subfolders <projectName>/moodledata. These were set automatically to user:psacln (cln for client I suppose).
  4. Set permissions for the above folders as:
    • /data/<projectName> : 775
    • /data/<projectName>/moodledata: 777
  5. Set php mode to fastCGI from Plesk CP for the subdomain of my project, as I said earlier (I was instructed by my host to do that, without this setting, it doesn't work)
  6. Started Moodle 2.0 installation all over again.

It worked fine, but I have to admit that I had a fruitful cooperation with my hosting provider in Crete, Greece (TopHost.gr) which have all their installations in Germany.

Now, I have created 3 moodle sites under /data/<projectName> with no problems.

I'm 99.99% sure that this is under the good will of your host.

I wish you the best of luck smile

In reply to Andreas Gounaris

Re: Data Directory not writeable

by Simon Clegg -

Thanks for that Andreas,

I have actually now managed to sort it and I think this is probably the most correct and cleanest way of doing it for Plesk users. It also means you can still run PHP as an Apache module.

Unfortunately, as you can see from my above post, I didn't have the same amount of luck with 1&1 as you did with youyr host. Needless to say, I will not be using that hosting company again. But for those who are stuck with them, here is how to get your Moodle server working with plesk.

Basically, you need to set a bespoke directive for your domain to allow your files in /var/www/vhosts/yourdomain/httpdocs to write to your directories above httpdocs. You do this by creating a vhost.conf file and then instructing Plesk to include it in your vhosts httpd.include file:

 

(If you don't have permissions, you may need to ask your hosting provider to do this for you - good luck if you are with 1&1, I woldn't hold your breath!)

1. Place your moodledata just above your httpdocs:

/var/www/vhosts/yourdomain/moodledata

2. CHOWN the directory to username:psaserv

username is the username set up for the virtual host and psaserv is the Apache group set up by Plesk

3. Set the permissions for moodledata as normal (777)

4. create the file in /var/www/vhosts/yourdomain/conf/vhost.conf

This is where you can put any of your own Apache config options.

5. Add the following lines:

<Directory /var/www/vhosts/yourdomain/httpdocs/>
php_admin_value open_basedir "/var/www/vhosts/yourdomain/httpdocs:/var/www/vhosts/yourdomain/moodledata"
</Directory>

6. When you've saved that you need to instruct Plesk to update the httpd.include file

/usr/local/psa/admin/sbin/websrvmng -u --vhost-name=yourdomain


That got it working for me! smile

In reply to Simon Clegg

Re: Data Directory not writeable

by Andreas Gounaris -

Good 4u.

You have to know however that in this way you might have moodledata directory accessible through http. Is this what moodle suggest to be avoided? You 're just fooling moodle installer but the security risk remains.

On the other hand, I might be wrong. Have you checked that?

In reply to Simon Clegg

Re: Data Directory not writeable

by Victor Castro -

Hello, I had the same problem with almost the same setup. centos server and plesk control panel. I was able so solve the problem by adding the moodle data path to the open_basedir line in the php.ini file of the domain.

hope that helps.