XAMPP Installation ---does not work on remote machine

XAMPP Installation ---does not work on remote machine

by Scott Buelter -
Number of replies: 7

Hello....I bit confused...please help if possible.

I successfully installed Moodle using the XAMPP complete install package on one of our machines here. Lets call it machine A.  It works perfectly when I open browswer on machine A and type the ip address. smile

However, when I type the IP from another machine (machine B), it does not seem to work.  I actually will get the Moodle home page but there are many errors on the page, there is no style sheet applied and none of the links work.

Is that a function of the XAMPP installation or have I made a mistake?

THanks!

Scott

Average of ratings: -
In reply to Scott Buelter

Re: XAMPP Installation ---does not work on remote machine

by Matt Molloy -

Hello Scott,

Check the config.php file in your moodle folder. If it reads:

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

Change it to:

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

You can use the internal ip address, or the computer name if you are working on a LAN, or you can use the full web address if you are serving to the web.

Regards,

Matt

In reply to Matt Molloy

Re: XAMPP Installation ---does not work on remote machine

by Scott Buelter -

Hey there Matt....THANKS!!

This saved me...I went and started installing the standard configuration but spent two hours just getting PHP to work.

Thanks!

Scott

In reply to Scott Buelter

Re: XAMPP Installation ---does not work on remote machine

by Dave Hobson -

Hi - I have exactly this problem, and have amended the config.php file on the server, but still no joy.

Can anyone suggest anything else to try?

Dave.

In reply to Matt Molloy

Re: XAMPP Installation ---does not work on remote machine

by Theodore Tzidamis -

Hello Matt,

Thanks; I had forgotten the same thing when using the XAMPP-based installer and had to change it!

However, the $CFG->wwwroot read 'http://localhost', not 'http://localhost/moodle'. If I use the latter I get a problem.

Dave, could that perhaps be the case with your machine?

Best regards,
Theodore.

In reply to Theodore Tzidamis

Re: XAMPP Installation ---does not work on remote machine

by Dave Hobson -

Theodore,

Thanks for the suggestion, but it made no difference.  But what I did was completely UNINSTALL Moodle and the XAMPP setup, and started again from scratch, and it worked.  The only thing I did different was to amend the config.php file as you suggested BEFORE running Moodle for the first time from the remote machine...and all was well.  So, although I don't understand why, the problem is now resolved.

Dave.

In reply to Dave Hobson

Re: XAMPP Installation ---does not work on remote machine

by Matt Molloy -

Hello all,

I think we better summarise everything, so that anyone else coming across this will be able to follow. So, from the top!

  • Scott was having the problem of being able to view his site perfectly from the machine on which he had installed xampp, and from where he was serving the moodle site. However, when viewing from another machine on the same LAN, the site appeared, but had errors and style sheets and themes were not applied.
    This was because his original config.php file (which lives in the moodle folder and is created during the install process) was pointing at localhost as the webroot. When anyone tried to access his moodle installation from another machine, the config file told the client machine that the web root was on localhost. Each machine knows itself as "localhost" and of course, when the client machine was directed to localhost, it looked to itself for stying and theme information, which was not there.
    This is why the moodle site displayed, but without styles and themes.
  • Next, Scott had to figure out what to put in to his webroot entry in the config file. I suggested: 

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

    Change it to:

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

    You can use the internal ip address, or the computer name if you are working on a LAN, or you can use the full web address if you are serving to the web.

  • This worked for Scott, but then Theodore and Dave, who were looking in and had similar issues tried this fix. It did not work for Theodore, but he tried a variation of using 'http://localhost' for the web root and it worked.
    Dave then re-ran his Moodle installation and ammended the config.php file accordingly and it worked.

  • To work out what the correct webroot entry is in the config file for your installation is, it all depends on where you put the moodle folder during the set-up process.
    When you get xampp up and running, you have a folder called htdocs. This is the folder that Apache will serve all your site from. Apache is configured to go to this folder and uses the contents of it to serve to the web.
    If you put your moodle folder in here, then the correct webroot entry would read:

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

  • If you open your moodle folder and then copy all the contents directly into the htdocs folder, then the correct entry to access moodle would be:

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

  • If you subsequently put your installation on the web, and you wanted to access it via the internet, it is only a matter of substituting your ip address instead of 'localhost'

Regards to all,

Matt

In reply to Matt Molloy

Re: XAMPP Installation ---does not work on remote machine

by Dave Hobson -

Matt,

Thanks for this very useful summary.  However, I'm left a bit confused.  I've got Moodle working from the rest of the LAN by specifying http://[server_name] as the webroot entry.  But my htdocs folder is located at c:/xampplite/moodle/lib/magpie, and doesn't contain the Moodle folder (which is in c:/xampplite).  Is this OK?

Thanks,

Dave.