local server

local server

by curt bixel -
Number of replies: 4

I have installed moodle 3.7 on my laptop using MAMP.  It was really quite easy.  

I have uploaded two courses to the moodle installation on my laptop.  They are rather large, so I had to adjust some PHP and MySQL settings.  Again, not too hard.

I am wondering if I can wirelessly connect this laptop to a NetGear Router, and then log onto my moodle installation from other computers in my home.  ( I imagine you are wondering why anyone would want to do this, but I kind of want to skip past that discussion and see if this can be done.

Right now, I have both my laptop and my phone logged into the same wireless router, and I can open a webpage and access moodle on my laptop at http://localhost:8888/moodle37/course/view.php?id=13

I don't really have any idea what I would do to access that same moodle course from my phone.  

Any ideas would be much appreciated.

Average of ratings: -
In reply to curt bixel

Re: local server

by Ken Task -
Picture of Particularly helpful Moodlers

It's a combo issue of MAMP install for 'localhost' port 8888 and DNS used by phone.

Networking comes before application (MAMP/Moodle is the application).

In DNS localhost exist on every machine/device that connects to the network with a TCP/IP stack.   localhost is ip 127.0.0.1 ... other wise called the 'loopback'.  PC's have it, Mac's have it, iPhones,iPads and Androids have it.

On your phone check network settings ... DNS servers.

Since you don't run a DNS server inside your home network, your phone (Android or iPhone) will use your home network providers DNS servers ... looking up localhost in any DNS will always provide 127.0.0.1 ... the loopback ... which means ... your iPhone/Android device will never reach the moodle you installed via MAMP on that Mac by localhost:8888/moodle/

On the mac, go to terminal and type in ifconfig [ENTER]

Look for: en0 section .... that's one of your network interfaces ...

inet 192.168.0.4 netmask 0xffffff00 broadcast 192.168.0.255

See the 192.168.0.4 above ... that's my mac's internal priviate IP address. Yours might show a 192.168.1.x depending upon how your home router is setup for DHCP.

Change moodle config.php file from localhost to that IP:8888

But then you also have to search and replace the database for all internal links that go to http://localhost:8888/ to http://192.168.0.4:8888

If your device can install something like Fing ... a network app Fing will show IP address of your phone and all devices it can find on the local LAN ... including your Mac.

Clear as mud huh? :\

'SoS', Ken


In reply to Ken Task

Re: local server

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
,,,or, in config.php change the line....

$CFG->wwwroot = "http:://localhost:8888/moodle37";

to

$CFG->wwwroot = "http://...ip address...:8888/moodle37";

...where ...ip adress... is the ip address of your laptop. AS Ken has indicated, you need to find out what that is. On a typical home network using DHCP it *can* change but rarely does. Most routers will list "attached devices" if you can't find another way
In reply to curt bixel

Re: local server

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi

> I am wondering if I can wirelessly connect this laptop to a NetGear Router, and then log onto my moodle installation from other computers in my home. (I imagine you are wondering why anyone would want to do this, but I kind of want to skip past that discussion and see if this can be done.)

Nothing suspicious there. All the participants of a class connected to the same local network, usually a wireless LAN, is very common. As others have explained you can easily run a Moodle for them in your laptop. It is terribly convenient: you can correct their assignments and develop the course further without the Internet.

If you don't want them to depend on your laptop or not feel comfortable them accessing your laptop, you can have a common portable Moodle like the MoodleBox https://moodlebox.net/en/. I use it in different situations.

> I don't really have any idea what I would do to access that same moodle course from my phone.

Also simple. In the Moodle server under Site administration > Mobile app > Mobile settings set the flag "Enable web services for mobile devices". Install the Moodle mobile app https://download.moodle.org/mobile. Find more details in the forum https://moodle.org/mod/forum/view.php?id=7798.