After migration images link not working

After migration images link not working

by Angelos Kinas -
Number of replies: 7

Hello, i have a big problem.
Yestarday i did migration from old server to new (Own server VPS) on the old server everything worked fine 

but when I did the transfer! I connected moodle to the database, the photos of the courses do not appear! when I open them in a new tab it shows: No file input! I updated to the latest version of moodle 3.9.2 and the problem persists. while all other files are displayed, photos and some videos are not displayed.

My new server specs is: Web Server: Vritualmin (Last) with php7.4 and Mysql

can somebody help me; thank you.
Attachment Screenshot 2020-10-09 at 5.55.23 PM.png
Attachment Screenshot 2020-10-09 at 5.55.33 PM.png
Average of ratings: -
In reply to Angelos Kinas

Re: After migration images link not working

by Ken Task -
Picture of Particularly helpful Moodlers

Did the migration involve a change in the fully qualified domain name of the server?   Moodle uses wwwroot variable in config.php to build full url's to images/files.

Also, did the migration involve moving from http:// to https:// ... see in your screen shot a 'not secure' icon.

IF either above is true, then you need to run search and replace ... to find oldurl and replace with new url + change http:// to https://

https://docs.moodle.org/39/en/Search_and_replace_tool

Do heed what it says ... ** backup your database and know how to restore it in case something goes wrong **

'SoS', Ken

In reply to Ken Task

Re: After migration images link not working

by Angelos Kinas -
Hello, and thank you!
No the domain is tha same! without SSL withe the same web panel!
the only change is the newest php version php7.4 and the mysql8 (from oldest)
i did the migration with the guide of moodle!
im comfused!
In reply to Angelos Kinas

Re: After migration images link not working

by Ken Task -
Picture of Particularly helpful Moodlers

A full site migration included code, db, and moodledata.

moodledata ownerships and permissions should be quite liberal - globall all must be able to at least read.

moodledata/filedir/ is where files uploaded to moodle are stored.

Files in filedir are not humanly recognizable ...

Since you can see the filename of an image not display you need to query the mdl_files table of the DB for a filename to see the contenthash value.  In examples below you adjust replace for a known image file type ... like \%.jpg.   Example below for .gifs.

mysql> select filename,filesize,contenthash from mdl_files where filename like '%.gif';

Shows info like this:

+------------------------------+----------+------------------------------------------+
| filename                     | filesize | contenthash                              |
+------------------------------+----------+------------------------------------------+
| alien_eyes_md_wht.gif        |     8545 | 783adb04a7da39ed7e4db1a0c4e6debda24635f5 |
| alien_eyes_md_wht.gif        |     8545 | 783adb04a7da39ed7e4db1a0c4e6debda24635f5 |

The alien_eyes_md_wht.gif file is in

moodledata/filedir/78/3a/ and called 783adb04a7da39ed7e4db1a0c4e6debda24635f5

'SoS', Ken


In reply to Ken Task

Re: After migration images link not working

by Angelos Kinas -
all the steps! is ok! on editing... i found the image! replace... and boom! nothing! but the problems is only on images... not to soundclips or videos.
slasharguments turned off! the server is another but the domain, the web server , the php and mysql versions, folder, paths, permissions...everything is the same!
In reply to Ken Task

Re: After migration images link not working

by Angelos Kinas -
i found the problem! is the PHP 7.4 Version. i changed to PHP 7.2 and all works fine on moodle 3.8. maybe the moodle is not ready for php7.4. Thanks for again!
Average of ratings: Useful (1)
In reply to Angelos Kinas

Re: After migration images link not working

by Ken Task -
Picture of Particularly helpful Moodlers

Might want to bookmark/favorite the following:

http://www.syndrega.ch/blog/#php-and-dbms-compatibility-of-major-moodle-releases

And make use of Environment check in Moodle admin ... it will inform.

'SoS', Ken


In reply to Ken Task

Re: After migration images link not working

by Angelos Kinas -
thank you very much for your help! smile
mark the thread as: solved.