General help

Transferred files not opening from Moodle (2.5.1)

Picture of William Mair
Transferred files not opening from Moodle (2.5.1)


I have taken a backup of my live Moodle instance and added it into my test environment (also as an archive) and ran the replace tool to change all from 'moodle' to 'moodletest' in the database.

I have also transferred all of the file from 'moodledata' to 'moodletestdata' to ensure that the required files are in place. 

If I try to open any of the files from my 'moodletest' instance, the software (I've tested Word doc(x) and PDF), the files seem to be corrupted (they download, but do not open).  However, if I trace the file in the database and through the path to the actual file and download by ftp, the file opens no problem (so the file itself is not corrupted).

I've changed the permissions and ownership on the files to be the same as the live one (which still works fine), but cannot figure out why downloading the files from Moodle seems to corrupt it.

Anyone any suggestions of what is causing it/where I can look?


Average of ratings: -
Picture of Ken Task
Re: Transferred files not opening from Moodle (2.5.1)
Particularly helpful Moodlers

Is test environment *same* as production server environment?  (ie, production Linux, test is linux).  Others might disagree, but think there is enough of a difference to make a difference.

When you did the search and replace did you literally search 'moodle' and replace with 'moodletest'?  The reason for search and replace is to correct the URL's that Moodle constructs and uses in the DB so the search should have been for: http://productionsite/moodle/ replace with http://testsite/moodletest/ - using the full url's and trailing slash.

Could be that you've in-advertently replaced some other 'moodle' item related to file system that's causing the issue.

To fix - use the same exported .sql dump of production server DB and replace the database you have in test site.  Do search and replace again ,but only as described above.

That's my best guess ... 'spirit of sharing', Ken


Average of ratings: -