Images do not display after migration

Images do not display after migration

by Clint Fisher -
Number of replies: 8

Images no longer display after migrating a Moodle 3.5.2 site from IIS and Microsoft SQL to bluehost. The new environment is using mysql 5.7 for the database.

I used the database transfer tool in Experimental to move from Microsoft SQL to mysql. Running PHP 7 in the Windows environment and in the new environment.

URL did not change.

If you go to www.schoolofcleaning.com and right click any of the images on homepage under testimonials to open in new tab, you can see that no image is displayed.

Logos at the top and bottom did not display correctly after migration, I uploaded those to fix with no issues.

I've cleared caches with site administration and manually.

Slash arguments are on.

Debugging is on but I am not seeing anything.

Where do I go from here?

Average of ratings: -
In reply to Clint Fisher

Re: Images do not display after migration

by Ken Task -
Picture of Particularly helpful Moodlers

migration consist of code, DB (which you xferred via experimental) and moodledata.  In moodledata files uploaded to moodle are in moodledata/filedir/ - does that exist?   If so, ownerships/permissions on filedir - recursively?

Plus ... current site shows no certs ... https:// .... was the site before migration https:// with a valid cert from a CA?  Links to images use the  config.php files $CFG->wwwroot variable and builds links to images adding that value in front of every link to a image file.

New server means new IP address and a change to DNS.

New environment on a shared hosting plan?

Surely the apache service error log would show something.

'SoS', Ken


In reply to Clint Fisher

Re: Images do not display after migration

by Ken Task -
Picture of Particularly helpful Moodlers

Follow up ... images issue might be related to former hosting using http:// ... new server does have a valid CA/cert and does respond to https:// but see attached screen clip.   To fix, one must run search and replace ... https://site/admin/tool/replace/

** BACKUP DB before using above.

'SoS', Ken


In reply to Ken Task

Re: Images do not display after migration

by Clint Fisher -

This site has never had a certificate. $CFG->wwwroot setting = 'http://www.schoolofcleaning.com ' on the old and new config.php.

filedir has lots of files, 755 on folders and 644 on files.

This is on a shared hosting plan at bluehost.

In reply to Clint Fisher

Re: Images do not display after migration

by Ken Task -
Picture of Particularly helpful Moodlers
Shared host ... does Bluehost set up all accounts on that shared host with a cert using LetsEncrypt?

Go to your site using https:// then click the lock in the browser URL line.

Check your cPanel.

You can always contact BlueHost helpdesk to submit a ticket to inquire.   Guess you'll find out what sort of support you will now get from provider related to Moodle. smile

'SoS', Ken
In reply to Ken Task

Re: Images do not display after migration

by Clint Fisher -
Yes, they run AutoSSL and put a cert on the install. You're telling me because they added a certificate to the site even though we've never used one on it that's why it doesn't work?

I went ahead and switched config php to https and used replace.php to update the URLs. So now we have a broken site on https instead of http.
In reply to Clint Fisher

Re: Images do not display after migration

by Ken Task -
Picture of Particularly helpful Moodlers

I don't host with Bluehost.  I didn't do the transfer/migration.

The DB transfer tool not smart enough to know about Bluehost's autossl and do changes to http://site/ to https://site.   How could it?

Well, if Bluehost auto's https and you've done change to config.php and did search and replace via tool and you still end up with broken images ... **except the ones you uploaded after the site was transferred and running to fix those** .... then???   Purge the caches again?  protcol did change, right?

Did you transfer moodledata using FTP and in binary mode rather than ascii?  Wondering if the image files located in moodledata/filedir/xx/yy/xxyylonglistofcharcters got messed up during transfer ...

I have a moodle that uses and image called:

6-Models-of-Blended-eLearning-Infographic.png

In the meta data of the DB (mdl_files):

id    filename    filesize    contenthash

32    6-Models-of-Blended-eLearning-Infographic.png    166654    1d353a04952f0652bf58474d2211965e7997ef75

In /var/www/moodle35data/filedir I can locate the file by it's contenthash name:

[root@sos filedir]# find ./ -name 1d353a04952f0652bf58474d2211965e7997ef75

That responds with:

./1d/35/1d353a04952f0652bf58474d2211965e7997ef75

On checking the mimetype of that file via:

file -b ./1d/35/1d353a04952f0652bf58474d2211965e7997ef75

above responds with:

PNG image data, 500 x 1601, 8-bit colormap, non-interlaced

If I copy ... copy ... that file out of moodledata/filedir/ to the root of the web site: https://site/6-Models-of-Blended-eLearning-Infographic.png I can see the image in the browser.   That same file shows in the moodle course also.

So on your shared host ... Is moodledata/ in public_html or is it in /home/account/ ... and does it have rw for the account used to run the shared hosting web service?  Does moodledata have an .htaccess files in it?   If so, what does the .htaccess file have in it.

For the most part site works ... it's just a 'tweakie' kind of thing but it all has to match!   So you are close, me thinks! ;)

Am only human though ... no Vulcan Mind Meld possible! :|

Just checked your site again with web console turned on ...

Hmmmm ...

Loading mixed (insecure) display content “http://cleaningbusinessbuilders.com/Portals/25/Foundations/Foundations-of-Success-8.jpg” on a secure page

Looks like images in theme not uploaded to moodle but linked to via URL .... http:// one at that.

cleaningbusinessbuilders.com. 900 IN    A    24.96.236.24 (WIDEOPENWEST - finance?)

www.schoolofcleaning.com. 900    IN    A    50.87.253.68 (bluehost)


'SoS', Ken


Average of ratings: Useful (2)
In reply to Ken Task

Re: Images do not display after migration

by Clint Fisher -
Looks like this was a file transfer issue. Filezilla was set to Auto, I changed it to Binary and overwrote filedir.

Everything is looking good now.

Thanks for the assist!
In reply to Clint Fisher

Re: Images do not display after migration

by Ken Task -
Picture of Particularly helpful Moodlers

Good!  Glad to here it!  Welcome. 

Another way to say 'thanks' is to rate the response that was useful as 'useful'.

'SoS', Ken