Installation help

 
 
Picture of Nigel Irwin
Moodle 2.0 Installation
 
I've been running Moodle 1.9 and decided to upgrade to Moodle 2.0. Moodle installed ok and i amended config.php as follows wwwroot = moodle.rewards-trc.co.uk and i also amended httpd.conf for servernamae as the same. I can access moodle locally but when i try to access remotely all i get is a blank page. When i look at registration under administration it still shows url as localhost. Is there another setting i need to change in Moodle 2.0
 
Average of ratings: -
Picture of Nigel Irwin
Re: Moodle 2.0 Installation
 
Also formatting is out and when i do try to access i get a message saying that access is only allowed by http://localhost
 
Average of ratings: -
Picture of Nigel Irwin
Re: Moodle 2.0 Installation
 

When i access via moodle.rewards-trc.co.uk i get this error merssage

Incorrect access detected, this server may be accessed only through "http://localhost" address, sorry.
Please notify server administrator.

I have amended config.php and httpd.conf but no difference.  I am running moodle under xamp. I had no problem when i installed 1.9, all is fine with that installation.

Also i find that the formatting has gone no matter which theme i choose everything is down the centre of the page with not colours or layout.

Any suggestions would be gratefully received

 
Average of ratings: -
Picture of Andrea Bisello
Re: Moodle 2.0 Installation
 
Hi Irwin,

there is a little "work around" ... but this is not the final solution.

i'm using moodle 2.0 "beta",

i installed on a ubuntu virtual machine on 192.168.1.227 ip

if i open page http://192.168.1.227 i obtain "IT WORK" php test page ... so apache and php are running well,

but if i try to connect http://192.168.1.227/Moodle i obtain your same problem.

i modify etc/moodle/apache.conf :

#deny from all
allow from 192.168.1.0/255.255.255.0

but it not resolve.

putting in my windows hosts file

192.168.1.227 localhost

first time moodle say to me that i can't log-in because i'm not localhost, after http://192.168.1.227/moodle become http://localhost/moodle and it work.

but i can't ask to all to change hosts file ...




 
Average of ratings: -
Picture of Andrea Bisello
Re: Moodle 2.0 Installation
 
sorry it won't work because moodle will not able to find css sad



Hi,

i don't know if this is the right solution, but with a "reverse search" of the error i reach this page.



to solve you can edit file

/var/www/moodle/lib/setuplib.php

and find

// Used in load balancing scenarios.
// Do not abuse this to try to solve lan/wan access problems!!!!!
if (empty($CFG->reverseproxy)) {
if (($rurl['host'] != $wwwroot['host']) or
(!empty($wwwroot['port']) and $rurl['port'] != $wwwroot['port']$
// Explain the problem and redirect them to the right URL
define('NO_MOODLE_COOKIES', true);
//add a comment here
#redirect($CFG->wwwroot, get_string('wwwrootmismatch', 'error',$
}
}



 
Average of ratings:Useful (1)
Picture of Jake Nolan
Re: Moodle 2.0 Installation
 

I'm using Andrea's solution. It kinda works but...

I don't see the reason why Moodle implemented this? I'm deploying a local moodle server in 1 physical network with 3 subnets. I would also like it to be accessed over the internet.

I have 3 IP's for my single moodle server and this is really a pain.

 
Average of ratings: -
wen photo
Re: Moodle 2.0 Installation
Group DevelopersGroup Particularly helpful Moodlers

I wonder other than comment out that redirect line, can I use DNS alias record to achieve similar result?

I mean if I have a fixed ip dedicated server which is hosting several Moodle sites (each one of them has their own domain names), and I want to avoid user seeing that "incorrect access detected" warning message and be able to smoothly go to the Front Page no mater whether they have typed in www.mydomain.com or just mydomain.com in the Web browser, can this be resolved by changing the DNS setting by creating a DNS Alias record? Thanks!

 
Average of ratings: -
Picture of Fabrizio Miglior
Re: Moodle 2.0 Installation
 
Try this in config.php: put in $CFG->wwwroot = 'http://'.$_SERVER['SERVER_NAME']; In that case, it fills in the correct address that you typed in whether it be localhost, an IP address, or any other valid address. There are a couple of caveats of using this method, by it is mostly on the administrator end (like calling the cron with the FQDN, copying in URL's with the full name, etc.) see this post: http://moodle.org/mod/forum/discuss.php?d=100778
 
Average of ratings: -
Picture of Chad Parmentier
Re: Moodle 2.0 Installation
 

That also caused moodle to not be able to find the css. I replaced localhost with the ip of my machine. This worked however the problem with this is you I will have to edit the config file each time I aquire a new ip from the network. see coded below.

 

 

<?php  // Moodle configuration file

unset($CFG);
global $CFG;
$CFG = new stdClass();

$CFG->dbtype    = 'mysqli';
$CFG->dblibrary = 'native';
$CFG->dbhost    = 'localhost';
$CFG->dbname    = 'moodle';
$CFG->dbuser    = 'root';
$CFG->dbpass    = '';
$CFG->prefix    = 'mdl_';
$CFG->dboptions = array (
  'dbpersist' => 0,
  'dbsocket' => 0,
);

$CFG->wwwroot   = 'http://10.124.232.24/moodle';
$CFG->dataroot  = 'C:\\wamp\\moodledata';
$CFG->admin     = 'admin';

 
Average of ratings: -
Picture of Stephen S
Re: Moodle 2.0 Installation
 

I too get the error:-
"$string['wwwrootmismatch'] = 'Incorrect access detected, this server may be accessed only through "{$a}" address, sorry.<br />Please notify server administrator.';"

... because in config.php 'wwwroot' is configured without the www. and if you enter the address with the www. you get the error and it then redirects to the wwwroot address. Because it redirects it is no real problem other than the annoying error message. As someone earlier pointed out this address check is in setuplib.php. However, because it is just annoying and no big deal, I thought changing the error message is a simpler solution. [But I also agree with an earlier post - why is it implemented if all it does is check and output an annoying message but then redirects and life goes on?]

In \lang\en\error.php around line 515 you will find a string $string['wwwrootmismatch']. Just change the value. Mine changed to: "Connecting, please wait". No one any the wiser now. The only problem I found with this was the string is cached somewhere on the server and I don't know where. The original error message kept appearing!! So I changed the name to $string['wwwrootmismatch1'] and changed the reference in setuplib.php

I would have preferred simply to change the original string and hence no need for any code changes in the core but I can't find where it is cached to delete it and  so force a refresh with the new error message! When I find the cache I will revert to the simpler, more elegant solution to this annoying error message!

Commenting out the code (as stated earlier by a post) works but then doesn't redirect. I felt keep the redirect just lose the message.

 
Average of ratings: -
Picture of Erfan Soleymani
Re: Moodle 2.0 Installation
 

Hello

 

I change the wwwroot adress to my ip and it worked.

but my question is wy this happen?

Thanks

 
Average of ratings: -
Picture of Pete Chapman
Re: Moodle 2.0 Installation
 

I have the same problem as well can anyone help with a solution. I get the same message on the LAN but then when redirected moodle works. If I access over the internet moodle will not let me. Running moodle 2.0 on xampp,

 
Average of ratings: -
Picture of Athar Nouman
Re: Moodle 2.0 Installation
 

Hi All,

 I had the same problem but i did some thing different. first I'll explain my scenario. I had a localhost installed with Appache, PhP and MySQL. I created a virtual directory on my localmachine and installed moodle. Moodle was working fine from the local machine but when I tried to access it from anyother machine I had the same error message. So I went to the moodle installed directory and Edit config.php. you will see all your username, password and path are set in this file.

On line 16 My actual seeting was as following (lsstmoodle was my virtual drive name in apache configured at C:\mywebsite\site\web)

$CFG->wwwroot   = 'http://lsstmoodle';


Then I changed line 16 as following replacing the URL with my machine name.(my machine is on LSST.COM domain on LAN and my machine name is moodle).

$CFG->wwwroot   = 'http://moodle.lsst.com';

Note you can also replace it with your machine ip as following but it will look eguly in the broswer address bar as you'll have ip address instead of a name.

$CFG->wwwroot   = 'http://146.x.x.x';

I hope this will help some of you guys

 
Average of ratings: -
Picture of Matthew smith
Re: Moodle 2.0 Installation
 

I have installed moodle 2.0 find

but does anyone know to  set 2 $CFG->wwwroot   =
because at my school we have a different addresses a internal address and a public address
thanks

 
Average of ratings: -
Picture of Stuart Morrison
Re: Moodle 2.0 Installation
 

Hi

I think it depends on the number of machines and how you manage your internal network.

I do not think you can set 2 $CFG ->wwwroot = in moodle (although with some fancy php you might be able to set up a hook to use different config files based on the ip address of the client).

I might prefer to put an entry in a local DNS.  Are your DNS IP addresses on your network? - if they are just put an entry that maps the name to the internal IP.

Otherwise you could put an entry in the hosts file on each machine.

 
Average of ratings: -
Picture of Matt Nation
Re: Moodle 2.0 Installation
 

easy fix that's not too messy is just to remove the code that points to the error message, so its just a simple redirect then.  ie:

if (($rurl['host'] !== $wwwroot['host']) or (!empty($wwwroot['port']) and $rurl['port'] != $wwwroot['port'])) {
// Explain the problem and redirect them to the right URL
if (!defined('NO_MOODLE_COOKIES')) {
define('NO_MOODLE_COOKIES', true);
}
redirect($CFG->wwwroot, get_string($CFG->wwwroot), 3);
}
}

 
Average of ratings: -
Picture of Steve SIANI
Re: Moodle 2.0 Installation
 

Please, I still have this error message that appears. Does someone has already found a solution for this problem?

Moodle locally works fine but when I put in the remote host, I still have this message "Incorrect access detected, this server may be accessed only through" http://domainename/moodle "address, sorry."

I'm calling for your help please.

 

 
Average of ratings: -
Picture of ICB BNE
Re: Moodle 2.0 Installation
 

I just finished a smooth installation. Everything went very very well except the same problem that others experiencing on this topic.  How we can solve that issue?

Incorrect access detected, this server may be accessed only through "http://localhost/moodle" address, sorry. Please notify server administrator.

 
Average of ratings: -
Picture of ICB BNE
Re: Moodle 2.0 Installation
 

Update to my previous post.

/var/www/moodle      config.php


Chnaged the localhost to IP and everything start working properly.

 
Average of ratings: -
Picture of Yeni Hernandez
Re: Moodle 2.0 Installation
 

I am new to this,

I need help ..

I have a problem installing moodle on a Windows Server 2008 and access to the attempt, but I see this error:

Incorrect access detected, this server may be accessed only through "http://localhost/moodle" address, sorry.
Please notify server administrator.

This Page Should Automatically redirect. If nothing is happening please use the continue link below.
Continue


if I do continue enters into locally, but if you access from another computer can not find the page

can help me with this error....

 
Average of ratings: -
Picture of srikanth raju
Re: Moodle 2.0 Installation
 

Which IP should i change ?

because i want to access from different access, we are 4 peoples working on same project and all of them have to work from different places. So which IP should i change ?

whether local ip or any other IP ?

 
Average of ratings: -