Forums | Mahara Community
Support
/
Image file cannot display or download
07 June 2016, 11:59
When I Installed Mahara 16.04 or 15.10 or 15.04 on Ubuntu Server 14.04 or 12.04 using MySQL or PostgreSQL, all function is right except image file.Image files in Content File or Site Files and profile pictures can be uploaded sucessfully, I can get it in dataroot,but in Web page download.php and thumb.php cannot get image file,click image file link,it can be downloaded sucessfully but cannot be opened using anying software,it is a invalid image file,why?
07 June 2016, 16:43
Hello Denny,
Do you have all necessary dependencies installed and file permissions set correctly?
You can find the installation instructions at: https://wiki.mahara.org/index.php/System_Administrator's_Guide/Installing_Mahara
Cheers
Kristina
07 June 2016, 18:18
I installed necessary software and Mahara in accordance with the System_Administrator's_Guide.
download.php and thumb.php cannot get image file,so these image cannot display in page ,but these image file can be download to computer by link in Files,then these image file cannot open by any softwares.
today I use another server to try again,only install necessary softwares and not modify default configurations,this problem does not appear.
I did not find which unnecessary softwares or configurations for Mahara affect this problem.
Thank you!
07 June 2016, 21:44
Hello Denny,
Good to hear that you could install Mahara correctly on another server. I don't know what could have caused the issue on the first server. Maybe there was something corrupted in any of the downloads or the operating system itself.
I hope you'll not have issues on your new server.
Cheers
Kristina
07 May 2024, 21:21
I just had the exact same symptoms with our new Mahara instance after migrating it to a new server and automating the deployment at the same time.
As I searched the net I found several possibly solutions, I tried checking:
- relevant config entries (e.g. dataroot to point to the correct file system location)
- the dataroot file system permissions (owned by www-data (ubuntu) and having read/write access)
- the existence of the requested file in the dataroot and rsyncing it to my PC to check the integrity by comparing it to the uploaded original file
- the requirements over and over again to have every package/dependency installed that is required
I also tried other unlikely fixes:
- switching from PHP-FPM to Apache's mod-php
- switching from Apache's mpm_event to mpm_prefork
- downgrading to an older PHP Version (7.4)
Nothing helped, so I debugged through the relevant endpoint with xDebug - still to no avail.
I then completely synced the src directory from the old server (v22.10.0) to the new server (v22.10.5 before) and somehow it worked again. This way I could rule out a faulty environment installation.
Then I compared relevant sections of these src directories, but couldn't find a significant difference.
In the end I felt kinda dumb, because I found out that the config.phps differed. The old one started directly with
<?php
on the first line while the new config.php had an empty line at the beginning before PHP's opening tag, which had to be removed.
This little difference resulted in having no impact on the DOM-Content (because the browser doesn't care about exceeding whitespaces), but corrupting the file download bytestream, because the empty line was prepended to the actual bytestream.
13 May 2024, 11:15
Hi Lucas,
I'm glad you could work out your problem and fix it.
My reply for future forum readers:
Yes it is important when creating / editing the config.php file that no whitespace or other characters are introduced before the opening <?php line. This can include hidden characters that some text editors may add without you noticing.
It is also important to make sure the adding or editing of any $cfg lines are of correct syntax as well. Often people have issues where they try adding a $cfg line and make a syntax mistake such as:
$cfg->whatever = newvalue;
When it needs to be:
$cfg->whatever = 'newvalue';
These mistakes will cause a hard time to try and diagnose as the problems will cause the site to not load properly.
Cheers
Robert