Can not read file, either file does not exist or there are permission problems

Can not read file, either file does not exist or there are permission problems

by Wanda Bostock -
Number of replies: 3

I have a Moodle site in production that I am trying to copy to another (development) location to do some editing.  I've successfully copied the site, but when I attempt to access some of the files that were uploaded to production, I get an error when I click on them: "Can not read file, either file does not exist or there are permission problems".  I've copied the entire contents of the moodle directory, and have exported and imported the database.


Can someone please tell me where uploaded files are stored and why I can't seem to access them from the copied (development) version?

Thank you!

Average of ratings: -
In reply to Wanda Bostock

Re: Can not read file, either file does not exist or there are permission problems

by Ken Task -
Picture of Particularly helpful Moodlers

Sounds like a version 2.x of Moodle.  Correct?

If the copy was from

http://somesite/moodle

to

http://somesite/development

then the database references which point to the location of the files (which are now 'hashed named') located in the data directory 'filedir' folder needs adjusting.

**In the "development" instance**, ie, the copy, there is a 'search and replace' tool whose location is dependent upon version of 2.  In a 2.2.4 it's in

/'development'/admin/tool/replace/

'development' above as per moved example.

In earlier versions of 2, think one had to use URL line of browser, already logged on as an Admin level user, going to:

/'development'/admin/replace.php

Search for: http://somesite/'moodle'/

Replace with: http://somesite/'development'/

'spirit of sharing', Ken

In reply to Ken Task

Re: Can not read file, either file does not exist or there are permission problems

by Wanda Bostock -

Thanks for the quick reply!  Yes, I'm using 2.2.3. 

If I do this, and then migrate my changes back up to Production, I assume I'd have to run this again in Production to point to the docs there, correct?  I'm trying to find the easiest way of copying Production down to my Development region to do my work, then getting it back up to Production.  Correct me if I'm wrong, but these are the steps I think I need to take:

1.  Export the Prod db

2.  Import the Prod db to Dev

3.  Copy the entire contents of the Prod moodle folder and restore to the Dev moodle folder.

4.  Run the Search and Replace tool in Dev.

Now, if I don't care about whether the links to the uploaded docs work in Dev, I assume I could go ahead and make all my other changes, and then it would just be a matter of exporting the Dev db back up to Prod once I'm done (and have shut down the Prod site in the interim of course), correct?

Thanks very much for the help!

In reply to Wanda Bostock

Re: Can not read file, either file does not exist or there are permission problems

by Ken Task -
Picture of Particularly helpful Moodlers

Process you've described sounds right, but seems like a lot of work.  The only time one might need to consider a 'dev' server is when testing new add-ons or something that might render the production site un-accessible, I would think.

Why not create a category called 'Development' and hide it, restore courses in production to that category?  Leave them hidden as well.

'spirit of sharing', Ken