After 1 year and 292 days, it all happened at once: Missing images, error messages when downloading files, and other related problems.

After 1 year and 292 days, it all happened at once: Missing images, error messages when downloading files, and other related problems.

by John Baker -
Number of replies: 20

Dear Fellow Moodle Users,


I am in need of some help.

I have been successfully running 2.7 for one year and 292 days and hosting at bluehost.com, but I recently faced a wide range of problems, and they seem to all have begun about the same time. The only thing that was done to system was that a quiz was added a few days before it all happened, but this happens every week.


I'm hoping these are symptoms of a root cause. Any help you can provide would be greatly appreciated.

Problem 1:

When I attempt to download a file, often times the file won’t download. Instead, I get an error message:

You are already logged in as John, you need to log out before logging in as different user

I have also received this error:

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

More information about this error

 

I should not that I get this for many files, not all of them.

 

Problem 2:

There photos (jpeg and png) are not showing up on the Moodle page or in the quizzes.  Instead there is a blank box where the picture should be and a broken link “x” in the upper left corner.

 

Problem 3:

When I attempt to upload a new picture, it also just shows a blank box with an x.

 

 

When I try to delete a course, I get this 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



Related Background

The site is hosted at Bluehost.com.  I have site back up pro. That means that the site is backed up every day, week, and month. Unfortunately, Bluehost tells me something peculiar happened and no backups have been kept for the database for at least a month. They are not sure why.

 

Things were working fine four days ago. The whole site seemed to crash during to or just prior to a final exam.  50 students were logging in, and apparently too many logged in at the same time.  There was an error explaining that the system was overloaded. Normally this would sort itself in a few minutes. This time, it took two hours. 


Average of ratings: -
In reply to John Baker

Re: After 1 year and 292 days, it all happened at once: Missing images, error messages when downloading files, and other related problems.

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

This sounds like a server issue at BlueHost - whether related to overloading the server resources during the quiz, or through some failing at their end. Is the site on shared hosting or a VPS?

I think I'd be particularly unhappy with them (and asking for compensation!) regarding not providing the backup service you've been paying for!

In reply to Richard Oelmann

Re: After 1 year and 292 days, it all happened at once: Missing images, error messages when downloading files, and other related problems.

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

I too wonder if your server has hit some kind of internal Bluehost limit.  Maybe number of files, maybe something else.

As asked by Richard, it would be helpful if you could let us know if this is a hosted server or a VPS.

I also wonder if Bluehost did some kind of upgrade that they thought would not harm anyone.  Maybe a new version of php, apache, etc.

When you phone Bluehost, what do they say?

In reply to John Baker

Re: After 1 year and 292 days, it all happened at once: Missing images, error messages when downloading files, and other related problems.

by Bret Miller -
Picture of Particularly helpful Moodlers

This is a pretty wild guess on my part, but have you checked permissions? I'm not on BlueHost, but my host used to mess up permissions when they'd move my site from one server to another. That causes all kinds of trouble with Moodle and other CMS. So here's where I'd start:

1. Reset your permissions on your moodledata folder. This is where your downloads and images are stored. If you followed the recommendations to put it outside your public html directory, it's semi-likely the permissions have been reset to prevent the web user from even reading the files. Resetting the permissions guarantees it's not that and might actually fix the file problems.

2. Deleting a course does a lot of database work at once. I ran into this issue on MediaTemple when I was using them for hosting WordPress sites. Anything database-intensive would give me exactly that error. Hosting companies regularly put limits on shared database servers to prevent one user from severely impacting the performance of everyone else. You should ask your hosting support if that's what's happening here. This is precisely why everything I have runs in a VPS these days including the database.

I suppose the other possibility is they had hardware issues and lost or corrupted your data. Hope it's not that, and that you have a backup...

In reply to Bret Miller

Re: After 1 year and 292 days, it all happened at once: Missing images, error messages when downloading files, and other related problems.

by John Baker -

Dear Bret,

This is good advice.  

This is good advice, Thank you.

 

I'm new to setting permissions. I've never done it I'm attaching a screen shot.

When I click on the Moodle data folder, it offers a list of folders to the right (cache, file dir, lang, localcache, lock, muc, sessions, temp, dir

If you could offer some ideas on which folders to change and what number to set them to, that would be great.

About the why’s behind this, I am curious, but I'm more worried about getting the site up, so I can retrieve my data at this point, as I failed to make adequate backups, but I asked Bluehost about two things. :

1. If they throttled my account. They said yes. After two years, I'm a little disappointed. Moodle is for teachers. Teachers have students. Students take tests.  And that means a spike in usage at midterm and final exams.  Now, they are suggesting a cloud account.  Two years ago, they suggested the site pro shared hosting and dissuaded me from a VPS. 

2.  About the sit not being backed up on the weekly and monthly, they say they have never seen this before. It's surprising that I'm the only one that is not being backed up.

Best wishes,

 

John


Attachment screen shot.JPG
In reply to John Baker

Re: After 1 year and 292 days, it all happened at once: Missing images, error messages when downloading files, and other related problems.

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

John, I have an experimental Bluehost hosted server with Moodle 3.0.2+ (Build: 20160218) installed.  I just tried creating an assignment, uploaded a picture, and everything looked fine.

How did you install your Moodle?  What version are you running?  Have you ever done an upgrade yourself?

In reply to Rick Jerz

Re: After 1 year and 292 days, it all happened at once: Missing images, error messages when downloading files, and other related problems.

by John Baker -

Thank you for the reply.

 

Here are the answers to the questions:

 Moodle is hosted on Bluehost's shared pro hosting. 

have not processed any Moodle updates or accessed Bluehost's CPanel, so this came as a really uncomfortable surprise.

Bluehost has told me that no apache or PHP updates have been done and that the site has not been migrated to another server recently

They also told me that for some reason my site was not being backed up and the daily, weekly, and monthly backups weren't being made.

There are three problems:

1. Missing photos that show a blank box with a broken link "x"

2. Many Microsoft Word files and PDF filesthat won't download (see error message:: You are already logged in as John Baker, you need to log out before logging in as different user.

3. I am unable to upload photos, Word, and PDF files.

My goal now is just to do one of two things, or both:

1.       Get the site up and running. That is, find the root cause of the many problems that occurred all at once:

2. In the event I can’t get the site working, download the Word, PPT, and Image files from the site and rebuild it from scratch

In attempt to fix it, I changed the permissions in the folders that open when I click the Moodledata folder  from 775 and 644 to 770 and 660.

In the directory tree under Moodle data, there are a lot more folders, and each has permissions. Do I need to change these too. If so, do you know what numbers I should them to?

 

Best wishes,

 

John


Attachment uScreen shot 3a.JPG
In reply to John Baker

Re: After 1 year and 292 days, it all happened at once: Missing images, error messages when downloading files, and other related problems.

by Bret Miller -
Picture of Particularly helpful Moodlers

Permissions for moodledata should be 777 for directories and 666 for files. It can be made more secure if you know what you're doing. I'm not sure how to recursively set file permissions in File Manager. I have always done it from ssh command line.

find moodledata -type d -exec chmod 777 {} \;

find moodledata/. -type f -exec chmod 666 {} \;

In reply to Bret Miller

Re: After 1 year and 292 days, it all happened at once: Missing images, error messages when downloading files, and other related problems.

by Bret Miller -
Picture of Particularly helpful Moodlers

...and I guess I should add, that the inability to read and write to the database could also cause these issues. So the fact that they are throttling your account could be the entire issue. BlueHost is cheap, but they have real limits. My guess is that as your site uses more resources, you'll need bigger and bigger plans to support it. Jumping to cloud as they suggest is probably the easiest fix at this point. I do know that will cost you more.

In reply to John Baker

Re: After 1 year and 292 days, it all happened at once: Missing images, error messages when downloading files, and other related problems.

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Consider going into your moodle, site administration, server, environment.  Do you get all okays?

Take a screen shot of this an post it for us to see.

Also go to site administration, server, development, purge all caches.  Do that (if you haven't already.)  Maybe this will free up some resources.

I have never had this problem, but it seems that a few others have.  I think that there is a switch somewhere that might control the display of pictures.  But this doesn't affect the upload or download of files.  Just trying to think this through with you.

In reply to Rick Jerz

Re: After 1 year and 292 days, it all happened at once: Missing images, error messages when downloading files, and other related problems.

by John Baker -

Hi Rick,


I checked the server environment. You are right. One thing is not checked.


I'm attaching a screen shot.


In reply to John Baker

Re: After 1 year and 292 days, it all happened at once: Missing images, error messages when downloading files, and other related problems.

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Okay.  Opcache is actually optional.

Well, interesting problem.  Here is what I would do if I were you (and if you know how to do this.)

1) Install a second moodle on your site.  See if a brand new installation works.  If it does, then I would move my production moodledata into it and my mySQL database into it, and see if it works.

2) If a new install doesn't work, then it points to something in your Bluehost account.  Maybe something with your php.ini file?

Overall, I am puzzled and might not be of much more help to you.

Here is a #3.  Purchase another Bluehost server and try installing moodle.  If this works, move your mySQL database and moodledata into it.

Here is one more important thing to do.  Have you backup up your current moodledata and mySQL database?  If not, make sure to do this before you do too much more experimenting.

In reply to Rick Jerz

Re: After 1 year and 292 days, it all happened at once: Missing images, error messages when downloading files, and other related problems.

by John Baker -

Dear Rick,

This is a long message, so I’ve separated it into two posts.  I haven’t solved the problems yet, but at least we have checked off a list of things (ways not to build a light bulb :>). With that in mind, we are closer to finding the solution (building one) :>. I agree that this indeed seems like one thing that’s causing everything (missing pictures on the page, inability to download most, not all of the files). It’s just a matter of finding it. 

 

I. What I Have Tried Unsuccessfully So Far:

II. What I’m Looking at Now and Have a Question About

III. Minor Success That I Hope Will Help Others

 

I. What I Have Tried Unsuccessfully So Far:

I looked into the Opache and php box in the screen shot. It seems that all is well the. Bluehost seems to be running a recent enough version.

With the help of Blue host, I set all of the permissions and all of the directories and files on the server,(except the Moodle data folder), to blue host defaults (as suggested in there help video). i.e., 755 for directories and 600 for files. The permissions were all over the place before this.  As you suggested, I then set the Moodle data directories to 777 and the files to 666. I asked for help from Bluehost to this because I couldn't figure out how to use the SSH command and doing it by hand was taking a long time.

As suggested in another forum, I unsuccessfully tried a few other things:

1.       Enabled and disabled the slasharguments setting as another site suggestions: Site Administration > Server > HTTP > enable/disable slash arguments

2.       Deleted, and reinstalled themes. I was using the clean theme when all this happened.

3.       Dealing specially with the file problem, I duplicated the Microsoft Word File also tried this with image files, but to no avail.

4.       I checked with Bluehost. The techs say the site has not been migrated or updated recently. They also tell me that I do not have too many files and I haven’t hit any usage limits. This last part I found confusing because the students did get a server is too busy error when 50 of them were using it.  Regardless, no one has been on the site for days, and I’ve even hidden the classes, so there is absolutely no load on the system. Nevertheless, all of the problems persist.

5.       I looked at the Moodle updates on my site:  I haven’t upgraded MOODLE, and it isn’t done automatically.

II. What I’m Looking at Now and Have a Question About

As mentioned above I did the following  Is it ok to follow this procedure?

“With the help of Blue host, I set all of the permissions and all of the directories and files on the server,(except the Moodle data folder), to blue host defaults (as suggested in there help video). i.e., 755 for directories and 600 for files. The permissions were all over the place before this.  As you suggested, I then set the Moodle data directories to 777 and the files to 666. I asked for help from Bluehost to this because I couldn't figure out how to use the SSH command and doing it by hand was taking a long time.”

2. Reflecting on the term permissions, I looked at the permissions in the individual files in the Moodle Platform. Administration: File Administration: Permissions.  I’m attaching a screen shot of what I found. It shows the permission for the one file that works (about the only one on the site that does work), and an example of the hundreds that don’t.  See “Image for Question 2”

Question: With this is mind, is it important to deal with the permissions on the Moodle platform, for example Site Administration/Administration/User/permissions? Are there other permissions that I need to look into?  If so, which ones? I’ve looked in there, but there are a lot of them, and I’m not sure which ones to check.

3 I looked at the assign roles (Administration File module administration/Locally assigned roles) with regards to the files, it seems that the roles assigned all have 0’s next to them. Is this a problem or a possible cause?  “See Image for Questions 3”.

4. Would it be of any help to copy my error logs here?

 

III. Minor Success That I Hope Will Help Others

I’m definitely going to look into the suggestions you made backing up the  about reinstalling Moodle on a fresh server.

1) Install a second moodle on your site.  See if a brand new installation works.  If it does, then I would move my production moodledata into it and my mySQL database into it, and see if it works.

2) If a new install doesn't work, then it points to something in your Bluehost account.  Maybe something with your php.ini file?

Overall, I am puzzled and might not be of much more help to you.

Here is a #3.  Purchase another Bluehost server and try installing moodle.  If this works, move your mySQL database and moodledata into it.

Here is one more important thing to do.  Have you backup up your current moodledata and mySQL database?  If not, make sure to do this before you do too much more experimenting.

 

In the interest of making sure I have safe copy of my most important files, I successfully tried the following

The pictures are still blank on the page and in the quizzes, but I have found a work around to start downloading files (PDF, Word, PPT, Excel) in case the whole thing crashes while I'm trying to get the Moodle site back up and running. I found that if I follow this procedure, I can make a back up copy of each file (PDF, Word, PPT, Excel), not the image files. The image files still on the server. I’ll try to get those later, but I am not sure how yet.

In the interest of helping others who might get into this mess, here is how I recovered the files on my site:

1.       Click the edit button next the file

2.       Click Settings

3.       Click Appearance

4.       Click Force Download

5.       Click Save and Display (the file will download and you can save it)

6.       Repeat this procedure for every file you want to save.

 I'm attaching some screenshots I hope will make up a helpful guide

Please note that this procedure does not fix the problem and the teacher and the student will still get the “You are already logged in as “your name”, you need to log out before logging in as different user. “ error if they click the main file link.  This is just a way for the manager/teacher to recover files. It’s just a way to download a safe copy.

I've put this here in the hopes of helping others who are having similar difficulties :>

The larger problem still remains, but I'm feeling a little safer having the files backed up.

 


Attachment Image for Question 1.PNG.PNG
Attachment Image for Quetion 3.JPG
In reply to John Baker

Re: After 1 year and 292 days, it all happened at once: Missing images, error messages when downloading files, and other related problems.

by John Baker -

As mentioned in the previous post, here is the screen shot of how I backed up the files individually



In reply to John Baker

Re: After 1 year and 292 days, it all happened at once: Missing images, error messages when downloading files, and other related problems.

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

John,

Simple question.  Have you tried a different browser?  It appears that you are using Chrome.  Might I be correct?  I wonder if this might be a browser problem?


I am not an expert at this, but I don't think that it has anything to do with permissions.  I can't think of anything that Linux would do to change your permissions.  But it appears that you like to upload files and then link to them. I don't do things this way, so I am a little at a loss (because I am not familiar with this method.)

You can give yourself SSH permission.  In Bluehost, cPanel, SSH Shell Access, turn it on.  Note your SSH login information.  On a PC, use Putty.  On a Mac (easier), use Terminal.  Command to change permission "chmod -R 777 moodledata". That's it. 

Have you ever installed Moodle from scratch?  It's not that hard.  This is what I would try next.  Still not sure if it has something to do with a wacked setting in Moodle, or a wacked setting on your Bluehost account.  A new install might help.

All of your information in III is interesting, but I have never needed to do any of this.  Again, I use my moodle differently.  You might  find it odd that I never upload files into moodle.  I link to files on my website instead.  But I am a little different.

Well, I am about at the end of my help.  I really have run out of ideas for you.  I will try to continue monitoring your discussion, just in case I spot something.

What are your thoughts?

In reply to Rick Jerz

Re: After 1 year and 292 days, it all happened at once: Missing images, error messages when downloading files, and other related problems.

by John Baker -

Hi Rick,

You are genius, thank you. You have helped me get closer and closer to a solution with each post. I'm not there yet, and, from what I can see from the other forums, a lot of others are in the same boat, but we are closer thanks to you.

About your last suggestions, here is how far I got and what I learned:

1. I called Bluehost. The php.ini file looks ok.

2. With the help of the tech, I applied a new Moodle installation with 3.4 on the same server.  The new installation worked well. Pictures could be seen and files could be uploaded and downloaded. It worked fine n the new installation.  The tech somehow put inside the public html folder. That's my fault. I forgot to ask him not to. It really fouled up the original install to the point that I couldn't get into my classes and one was missing.  It was an easy fix: We restored the installation. The old installation still doesn't work (no images or file downloads), but at least it's still all there.

I'm guessing this means that the Bluehost side is working ok at this point, and I need to too look more into the current MOODLE installation side of things. 

I'm going to continue to back up each file individually just to be safe. Once that's done, I'm going to try creating a new Moodle Installation and moving things over  again. We weren't able to get the point of moving the Moodle data and mysql database over, but that's the next goal once things are safe.

In the interest of getting the current installation working, I asked a few questions about permissions in the previous post.  If you have any ideas on that, I'd be very happy to hear them. You certainly have good ideas.

Thanks again.


Best wishes,


John



In reply to John Baker

Re: After 1 year and 292 days, it all happened at once: Missing images, error messages when downloading files, and other related problems.

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Our posts have occurred almost concurrently.

Good to hear that a new installation worked fine.  Yes, something gat wacked in your old moodle, my guess.

Two things to try.

1) Backup a course and restore it in your new moodle.  See what happens.

2) Restore your moodledata and mySQL files into your new moodle.  However, doing this might bring in the wacked settings.  See what #1 does first.

Do you know how to do #1?  It's pretty simple (once you do it once or twice.)

How are you backing up your moodle installation?  I am not sure what you mean "one file at a time."

The good news is that you are learning much more about moodle and your web server.  The bad news is that you are learning much more about moodle and your web server.  smile

In reply to Rick Jerz

Re: After 1 year and 292 days, it all happened at once: Missing images, error messages when downloading files, and other related problems.

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

John, here is yet another idea.  It might be (for whatever reason) that your picture url's got wacked.  Here are some notes from the moodle docs to fix this problem by running a "replace" script:

Changed URL image links set to old site

So you built your Moodle Server with a http//192.168.0.1/Moodle address. Then you changed the URL for your site to http://OurMoodle.org/Moodle. You changed the Moodle config file so the CFGs point to the new paths, but your images still point to the old url.

One simple, quick solution is to use the Replace script in Moodle to fix this. Login as admin and enter http://OurMoodle.org/admin/tool/replace/index.php in your browser address bar (or http://OurMoodle.com/admin/replace.php in older versions). Use the two form boxes to change http://192.168.0.1/ to http://OurMoodle.org/.

In reply to John Baker

Re: After 1 year and 292 days, it all happened at once: Missing images, error messages when downloading files, and other related problems.

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Reading through all this, I suspect the database has become corrupted somehow.  

Rick has had some great suggestions - I would try the replace function and see if that helps.

I would also try rightclicking on a file or image that is not working and open in new tab.  Take a look at the url and make sure that it correlates to your site.  This will tell you if the replace function is going to help.

Restoring a course to the new site is definitely a good idea.  However, I suspect that you might run into some issues with that if your original site has "lost" the files.

Have you checked your moodledata folder?  You have two folders in moodle, the code and the data.  It appears your code is probably fine but you data is having issues.  You need to check permissions on your moodledata folder - if you figured out ssh run chmod -R 755 on your moodledata folder and see if that helps anything.  Also, go into your moodledata (not moodle code) folder and delete the cache and temp cache folders.

If nothing there helps, talk to Bluehost and see if they can help you run a repair on your database.

Report back!  


In reply to John Baker

Re: After 1 year and 292 days, it all happened at once: Missing images, error messages when downloading files, and other related problems.

by John Baker -

Hi Rick,


Thank you for the ideas. 

I've learned a lot during this process. The first thing is to stop uploading files to Moodle.  Keeping the files somewhere else and linkiing them to Moodle sounds like a much safer approach.


I've tried the site with three browsers: Chrome, Firefox, and IE. The problem persists in each.


I will definitely try backing up a course and moving it over to a new installation. That could shed some interesting light on things. I'll let you know how that turns out.


About backing the files one by one, I have been downloading each file using the process I described earlier (changing the setting to forced download and then click display). It provides a work around to download the files.


About the URLs, something interesting happened a little while ago. I have been backing up the site files by downloading each one and downsizing the site by deleting old courses.  While doing this, I went back to a course that was in a previous year's section.  I haven't opened it in a long time Surprisingly, two of the photos work there on the main page, but they still don't work in the quizzes. I'm not sure why. 

I've put the URLs below.  The one that works looks different than the ones that don't work.

The one that works has "draftfile" and the ones that don'e have "pluginfile". The JPG is also capitalized in the ones that work, and it isn't in the ones that don't work.

This picture can be seen:

http: //mywebsite.com/moodle/draftfile.php?file=/3692/user/draft/881129213/Daily%20English.JPG


These pictures cannot be seen:

http: //mysite.com/moodle/pluginfile.php?file=/2162/course/section/367/Cover%20Photo.jpg

http: //mysite.com/moodle/pluginfile.php?file=/63/question/questiontext/26067/1/12645/Father%20n%20sonz.jpg


* so that the URLS would show in this forum instead of pointing to a photo, I put a space between http: and //


* I also used mysite.com instead of the actual site name.

Question: Do the differences in these URLS possibly point to the problem?


Another interesting thing about this course is that most of the files can be downloaded. The ones that can't were imported from other courses.

I'm not sure what to make of all this yet, but progress is being made.


Best wishes,


John

In reply to John Baker

Re: After 1 year and 292 days, it all happened at once: Missing images, error messages when downloading files, and other related problems.

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Emma gave a few more pointers.  Yes, try the "rename" tool and see what happens.

You do have a website for all of files, it's your server.  I just gave a presentation at MoodleMoot2016 US that might be of interest to you somewhat about this topic.  Here is my webpage for my resources, including my actual presentation (via video.)  You see, this is a link to an external resource on my website.

For quiz questions that have embedding pictures, follow Emma's advice and see where Moodle thinks the picture is located (it's URL).  The "rename" tool might then help.

Consider using underscores instead of spaces in your file names.  Then the file name will look like "file_name" instead of "file%20name".  This should bother anything on the Internet, I just find it easier.

I do not understand your backup system. You seem to be saying that you back up each file, file by file.  The two backup methods that I know about are: 1) backup a course, one by one. 2) backup your entire moodle, the moodledata folder and the mySQL database, and even the moodle program directory to be safe.  Do either of these two make any sense?

I don't have any thoughts about the differences in the picture URLs.  Here is how one of my quiz picture's URL looks:

"http: //www.mydomain.com/moodle/draftfile.php/5/user/draft/937479655/ppg__pearson__tm__om11h__f19g1q12g1.gif"

Here is another idea.  Backup on of your courses.  Get a MoodleCloud account.  Restore the course in your moodlecloud system.  Remember the 200MB limitation and 50 user limit of Moodlecloud.  If the 50 users is a problem, backup your course without user data.  If the 200MB becomes a problem, well, you are out of luck.

Now that I am on this topic, I hate to say this.  I have my courses on my "production" moodle.  I have also successfully moved a course to Moodlecloud, pictures show.  I have also moved my entire production moodle to my local MAMP experimental moodle system, pictures work.   So your situation is puzzling since I have never ran into this problem myself.