Moodle 2 images not visible

Moodle 2 images not visible

by Stuart Ridout -
Number of replies: 24

Hi,

I'm having a few issues with a fresh install of Moodle 2.0

None of the images are visible at http://www.ousedaleschool.org.uk/moodle

If you try to view the image from its URL you get a 403 error.
Permissions on theme directories are 755 for /theme and all directories underneath.
Permissions on all files under /theme are 644

Any ideas please?

Stuart

Average of ratings: -
In reply to Stuart Ridout

Re: Moodle 2 images not visible

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi,

The way Moodle 2.0 looks for images is truely amaising...but there is nothing wrong with the URL for the Moodlelogo.gif on the front page as you can view it OK here...

although it is not showing up on the page, which suggests to me the $CFG->wwwroot in config.php in the root directory, has not been entered correctly. It should be ...

http://www.ousedaleschool.org.uk/moodle

if you have a  / after moodle like this...

http://www.ousedaleschool.org.uk/moodle/

then this is more likely to be the cause of the problem.


Mary

In reply to Stuart Ridout

Re: Moodle 2 images not visible

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Stuart,

images (and other assets) are cached by 2.0 under $CFG->dataroot/cache: here, and below, you need read&write permissions.

HTH,

Matteo

In reply to Matteo Scaramuccia

Re: Moodle 2 images not visible

by Stuart Ridout -

Hi,

I've checked the URL in config.php and it's fine.

I've looked at the cache folder and the permissions are 666 for the cache folder itself and all files/folders underneath.

Still have the same problem.  I've tried a fresh install.   My web host also has Installatron (automatic installation) and have tried installing Moodle 2.0 from there too but same problem.

Am totally confused now.

In reply to Stuart Ridout

Re: Moodle 2 images not visible

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

In the config.php for $CFG->wwwroot =

try changing the current URL so it reads...

$CFG->wwwroot   = 'http://localhost/moodle';

and see if this changes anything?

It works in Firefox...

Mary

In reply to Stuart Ridout

Re: Moodle 2 images not visible

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Have you turned on Debugging? If you do that, and then try an image URL again(e.g. http://www.ousedaleschool.org.uk/moodle/theme/image.php?theme=standard&image=moodlelogo&rev=162) then you should get a more helpful error message.

In reply to Tim Hunt

Re: Moodle 2 images not visible

by Susana Willemoës -

I m having the same problem: a fresh installation of Moodle 2.0 with dir data as info at the same level of public_html (not inside public_html) with all dirs in 755 (cache, fildir, lang,temp, etc) and images don`t display. Did you find the solution for this? Thanks!

In reply to Stuart Ridout

Re: Moodle 2 images not visible

by Stuart Ridout -
Thanks everyone. Got it solved. It was a host problem with a modsecurity rule. If anyone else has problems with this it may be worth checking with your host.
In reply to Stuart Ridout

Re: Moodle 2 images not visible

by Susana Willemoës -

Thanks! Can you be more specific? Which  modsecurity rule is making trouble and how they solve it? Can you ask them? Thanks!!

In reply to Susana Willemoës

Re: Moodle 2 images not visible

by Susana Willemoës -

I've solved it too! There was a litlle error in php.ini for ecellerator

In reply to Susana Willemoës

Re: Moodle 2 images not visible

by sl tan -

Which part of the php.ini where the eaccelerator error occurs? see below and let us know.

Thanks

;;;;;;;;;;;;;;;;;;;;;;;;;

; Paths and Directories ;

;;;;;;;;;;;;;;;;;;;;;;;;;

; UNIX: "/path1:/path2"

include_path = ".:/usr/lib/php:/usr/local/lib/php"

;

; Windows: "\path1;\path2"

;include_path = ".;c:\php\includes"

; The root of the PHP pages, used only if nonempty.

; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root

; if you are running php as a CGI under any web server (other than IIS)

; see documentation for security issues. The alternate is to use the

; cgi.force_redirect configuration below

doc_root =

; The directory under which PHP opens the script using /~username used only

; if nonempty.

user_dir =

; Directory in which the loadable extensions (modules) reside.

extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613"

zend_extension="/usr/local/IonCube/ioncube_loader_lin_5.2.so"

extension="eaccelerator.so"

eaccelerator.cache_dir="/tmp/eaccelerator"

eaccelerator.check_mtime="1"

eaccelerator.compress="1"

eaccelerator.compress_level="9"

eaccelerator.debug="0"

eaccelerator.enable="1"

eaccelerator.filter=""

eaccelerator.optimizer="1"

eaccelerator.shm_max="0"

eaccelerator.shm_only="0"

 

In reply to Stuart Ridout

Re: Moodle 2 images not visible

by Surachet D. -

Hi Stuart and Lila

I've got the same problem. Can you please explain how to fix this problem in more detail?

Many thanks for your help.

In reply to Surachet D.

Re: Moodle 2 images not visible

by Stuart Ridout -
Hi Surachet, I contacted my webhost and they looked in their error logs. They said they found a modsecurity rule.
In reply to Stuart Ridout

Re: Moodle 2 images not visible

by sl tan -

I have this same problem too - images not showing up after a fresh installation. -only the place holder.

Can you check with your web host and let us know specifically how it is fix so that I can contact my web hosting people to get it done.

Did you also tick the unix socket option at the database page during installation? Mine, I tick it , but it is not reflected in the generated config.php file after installation. The options are there in the config-dist.php which some people manually edit and copy it over.

Thanks.

 

In reply to sl tan

Re: Moodle 2 images not visible

by Chris Scurrah -

I have the same problem too with images not appearing after upgrading from 1.9.10 to 2.0.

The files appear to have been transfered properly to the Legacy Files Folder but when I try to edit the picture using the HTML Editor and browse for the picture I want to use in the System / Legacy Files Folder is comes up with an error message saying that the file already exisits.

If I right click on the image placeholder where the image should be appearing and look at its properties it's looking for the file at:-

mydomain.com/file.php/1/images/picture.jpg

If I then go to the System / Legacy Files Folder and look at the image properties, it shows the image correctly but the file location is different and looks like this:-

mydomain.com/file.php?file=%2F1%2Fimages%2Fpicture.jpg

It looks like it's being caused by the slash arguments / being changed to %2F.

Any help in resolving this problem would be most grateful

In reply to Chris Scurrah

Re: Moodle 2 images not visible

by Chris Scurrah -

Oops I forgot to mention that whenever I try to add or edit an image it saves it as mydomain.com/draftfile.php/79/user/draft/924450737/picture.jpg and the image doesn't appear

In reply to Chris Scurrah

Re: Moodle 2 images not visible

by Vidura Dissanayake -

Hi All,

I'm also having issues with a fresh install of Moodle 2.

I have posted a new thread regarding this issue (http://moodle.org/mod/forum/discuss.php?d=165599) but have had no luck. Initially I thought it might have something to do with image magic but am unsure now.

I notice that some of you have got this to work but I see no specific steps that you took.

Any help would be welcome.

Kind Regards,
Vidura

In reply to Vidura Dissanayake

Re: Moodle 2 images not visible

by Pascal Maury -
Picture of Plugin developers

Hi,

I have this same problem too - images not showing up after a fresh installation.

If I try to display the image (right click, "View Image"), I have the message "The image "http://xxx.fr/moodle2/theme/image.php?theme=standard&image=moodlelogo&rev=161" cannot be displayed, because it contains errors." with Firefox.
With IE or Chrome, only the place holder appears.

1/ correct $CFG->wwwroot without / in config.php => same problem
2/ $CFG->dataroot/cache: here, and below, you need read&write permissions => same problem
3/ install from CVS or manual install => same problem
4/ $CFG->wwwroot   = 'http://localhost/moodle'; => same problem
5/ Debugging turned on => no errors message
6/ error logs file => no errors message

If somebody resolved this issue, please could you be very specific about the way you did ?

Thanks.

Pascal

In reply to Pascal Maury

Re: Moodle 2 images not visible - solution ?

by Rod Suskin -

Hi All

I had the same problem. I pointed my hosting support at this page and asked them to read about the mod_security in this discussion.

They responded by saying 'we have disabled mod_security for this domain' and now the images work perfectly.

Hope that is enough for some of you to do the same!

Rod

In reply to Rod Suskin

Re: Moodle 2 images not visible - solution ?

by Chris Scurrah -

The following may help to stop broken images:-

It is quite common that mod_security is interfering the functions of your web applications. mod_security is installed and enabled by your web server admin but you can still disable it for your individual website using .htaccess file by following this tutorial.

mod_security is an Apache module (for Apache 1 and 2) that provides intrusion detection and prevention for web applications.”

Disable mod_security in .htaccess file

  1. If you do not have one yet, an .htaccess file in the folder of your web application
  2. To disable mod_security COMPLETELY, add the following line to the .htaccess file:
    SecFilterEngine Off
    OR, to disable HTTP POST scanning only, use the following instead:
    SecFilterScanPOST Off
  3. Save the file and test your web application to check whether disabling mod_security has solved your problem.

I recommend you to try SecFilterScanPOST Off first, instead of disabling mod_security completely.

In reply to Chris Scurrah

Re: Moodle 2 images not visible - solution ?

by Chris Scurrah -

If that fails to work and your site no longer loads remove any entries to do with mod_security (as listed above) in the .htaccess file and save it back to the server.

You will have to contact your hosting company and ask them to disable 'mod_security' in the main Apache configuration file for you.

In reply to Chris Scurrah

Re: Moodle 2 images not visible - solution ?

by Pascal Maury -
Picture of Plugin developers

Hi Chris,

Thanks for these news. Unfortunately, it doesn't help me because mod_security is not enabled on my server.

Still looking for what's going wrong with my server ... sad

Thanks

In reply to Pascal Maury

Re: Moodle 2 images not visible - solution ?

by Pascal Maury -
Picture of Plugin developers

Ok, problem resolved : the 2 versions I had installed were bugged. I made an initial installation from CVS and a second one with the zip file. The same day I guess (around 12/17/2010). I think it was javascript bugs.

It works now. I installed moodle2 twice today via the tgz file then via CVS.
Moodle 2.0 (Build: 20101124)

Thanks for your help.

Pascal

In reply to Pascal Maury

Re: Moodle 2 images not visible - solution ?

by patricio sanz -

Hello,

I have a workaround for this that might help you.
Ive posted here:

http://moodle.org/mod/forum/discuss.php?d=176747#p781628

Let me know if it helps.

Patorius

In reply to patricio sanz

Re: Moodle 2 images not visible - solution ?

by Pascal Maury -
Picture of Plugin developers

Hi,

Today, I tried to install another Moodle. And I got the same problem (again!) : images not showing up after a fresh installation.

The first thing I noticed is: when you have to fill the page admin user, the "star" for the required field is not displayed (text "required field" appears instead).

BUT I found the solution : when I created the config.php file, I choose "UTF8 format". The moodle's files are in the "ANSI format". I created another config.php with the correct format and the same installation works !

Maybe last year, I did the same mistake ...

NB : If you have completed the installation, it's too late : you have to start again and create the config.php in the correct format.