Repositories

 
 
Picture of Gary Lebowitz
Invalid JSON String after Experiencing Server Problem
 

Can someone help me with a problem related to uploading images to a Moodle 2.2.3 installation? I moved my moodledata directory at one point and now am getting an JSON Invalid String message every time I try and upload anything from my harddisk. This almost certainly has something to do with the fact that I moved my /moodledata direcory, but I'm not quite sure what's wrong

 
Average of ratings: -
Picture of Frédéric Massart
Re: Invalid JSON String after Experiencing Server Problem
Group DevelopersGroup Moodle Course Creator Certificate holdersGroup Moodle HQGroup Particularly helpful MoodlersGroup Testers

Hi Gary,

I guess you've change the config.php parameter pointing to moodledata otherwise it wouldn't work. Another thing that you should check is that the directory (and its current content) is writeable by the server.

(I'd like to point out that moving moodledata is dangerous and I would not recommend to do it without taking extra care.)

Fred

 
Average of ratings: -
Picture of Gary Lebowitz
Re: Invalid JSON String after Experiencing Server Problem
 

Hi Fred,

Yes, I modified config.php accordingly. Yes, I know it's delicate, but I thought I'd done what I needed to do. Yes, it is writeable. Anyway, I am able to work like this.  I will just keep going until there is a pause and I can fix things properly. Regards, Gary

 
Average of ratings: -
Picture of Gary Lebowitz
Re: Invalid JSON String after Experiencing Server Problem
 

Hi Fred,

I was having so many problems after moving the /moodledata folder, even after the change to config.php, that in the end I restored to the original build with the /moodledata in a directory in the Web server. sad I know this is not a good idea. But I read that it is possible to protect it even if one must put it there (which I thought was the case originally when I did the installation) by creating an .htaccess file with a couple of lines in it that I could look up again. My question is: Where should this file sit? I noticed that I have a sort of dummyish .htaccess file sitting in the /moodledirectory itself, but it doesn't have the lines I saw in a posting nor does it seem very useful there. But who knows? Any tips on this protection of the /moodledata directory from being seen or worse?

 
Average of ratings: -
Picture of Frédéric Massart
Protecting moodledata directory
Group DevelopersGroup Moodle Course Creator Certificate holdersGroup Moodle HQGroup Particularly helpful MoodlersGroup Testers

Hi Gary,

the default .htaccess file should contain the following lines, and suffice to protect your moodledata directory.

deny from all
AllowOverride None
Note: this file is broken intentionally, we do not want anybody to undo it in subdirectory!

Please note that this would only work if you're using Apache as a web server. Please also note that the rule AllowOverride must have been set to On in your VirtualHost for it to work. Also, you should manually check if you can access this directory via the web (http://example.com/moodledata).

Even if this solution works, it is really not recommended to have the moodledata directory sitting there. I would suggest that you try again to move your moodledata directory, or reinstall Moodle using the correct path to a non-web accessible moodledata directly.

If you're still experiencing your JSON error, perhaps you could share it with us (enable the debug setting to DEVELOPER first) so that we could identify the issue.

Link to some documentation about securing your moodledata: http://docs.moodle.org/20/en/Creating_Moodle_site_data_directory

Let us know how it goes!

Fred

PS: The path in $CFG->dataroot should be an absolute path to the directory.

 
Average of ratings:Useful (1)
Picture of Gary Lebowitz
Re: Protecting moodledata directory
 

Hi Frédéric, I seem to be in trouble with my server. I have such large load levels that people are regularly unable to get in and get 500 Server Error erros. I think this may have something to do with my php5.ini file that when I look in the output of what is shown in Moodle doesn't seem to reflect what I put in it. The problem is, I am not quite sure where to put the php5.ini file on my virtual private server with GoDaddy. I did know on the shared hosting version, but not on this one. 

 
Average of ratings: -