MAMP on OSX - Yosemite

MAMP on OSX - Yosemite

by Alfredo Mora -
Number of replies: 14

Hi all smile

I have installed Moodle 2.9 with MAMP in a Mac with Yosemite 10.10.5 on the intranet of my school and it works fine. What should I do to publish to Internet? I already changed passwords and access ports, the certificates are already installed, but I can not see the server from the outside.

Our public IP is 201.140.105.5 and the server answer with the attached image

Thank you in advance smile

Attachment Screen Shot 2015-09-06 at 2.27.57 PM.png
Average of ratings: -
In reply to Alfredo Mora

Re: MAMP on OSX - Yosemite

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

You need to update the Moodle config.php file with the new ip address.  Then you will need to run the replace tool on your database (found at yoursite.com/admin/tool/replace/index.php

However, if you want to access from both the intranet and from outside, you will need to set up a DNS name that resolves to both ip addresses.


In reply to Alfredo Mora

Re: MAMP on OSX - Yosemite

by Ken Task -
Picture of Particularly helpful Moodlers

+1 to what Emma said ...

DNS, however, might need an entry in two DNS servers ... 1 for the internal private network and resolves the 192.168.20.x IP address to a fully qualified domain name ... like: elearning.somenetwork.net - and in an external DNS server that resolves public IP addresses ... your 201.140.105.5.

Those are not necessarily on the same DNS server.

Change the config.php file's $CFG->wwwroot value to point to the FQDN of the server.  If you have developed courses/added links to uploaded files, then the search and replace tool needs to be run AFTER you get the FQDN setup and working.

DNS setup doesn't take long IF your network people are the DNS server admins.  Internal DNS happens quickly but external might take a day or two to propagate.

On a temporary basis, if you know what the FQDN will be, one could make an entry in internal machines host file (on a Mac found in /etc/hosts) that maps the 192.168.x.x IP address to the FQDN of the server.  External access could be gained the same way, but best to setup DNS properly.

'spirit of sharing', Ken

In reply to Ken Task

Re: MAMP on OSX - Yosemite

by Brian Lockwood -

It might be worth pointing out that the access from outside to your moodle should best be handled by the institution firewall.

The IT provider will be able to give a fqdn for your server that will work from outside and inside the institution. A fqdn that would be entered into config.php.

Any change you do on your machine (as opposed to at the firewall) is likely to come across the problem of only being accessible from outside or inside the intranet but not both.

In reply to Alfredo Mora

Re: MAMP on OSX - Yosemite

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

What you are trying to do might "technically" work, but I wonder about it.  From what I can recall, Apple doesn't see Yosemite as a "server" platform.  Second, MAMP seems to be much more of a developmental/experimental environment.  I am not a server guy, others here are, and they might be able to guide you.

But have you considered running your Moodle from a hosted server, or a VPS?  I am running my moodle from a VPS, it's not that expensive, and it immediately is on the Internet with firewalls an much of the other networking stuff.

In reply to Alfredo Mora

Re: MAMP on OSX - Yosemite

by Bob Puffer -

Yosemite runs LAMP natively though you need to set it up. Google it. It's going to be a much better choice than MAMP.

In reply to Bob Puffer

Re: MAMP on OSX - Yosemite

by Brian Lockwood -

I have started a non mamp install document. You have two choices basically. Adapt the default apache install o go down the homebrew route.


Adapt the native apache and it will most likely get killed by the next apple update, whereas the homebrew version won't.


Homebrew is excellent and is essentially apt/yum/dnf for OSx for a set of up to date system software in /usr/local

In reply to Brian Lockwood

Re: MAMP on OSX - Yosemite

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Personally....

1. http://php-osx.liip.ch/

2. http://dev.mysql.com/downloads/mysql/

3. Spark up terminal and type - sudo apachectl start

4. Document root is at '/Library/WebServer/Documents/'. Make a link or whatever

Five minutes. That's all there is to it. 

In reply to Howard Miller

Re: MAMP on OSX - Yosemite

by Brian Lockwood -

Well it is nice to know that it is such a straightforward process for Howard.

You may have issues with some of the php requirements.

My Yosemite is the result of upgrades from several versions ago of OSX and hence may not be typical but getting some php modules going from a native Apple Apache install were far from straightforward.

intl was particularly fun, perhaps Howard or some other Apple Guru could document this  for us.

I have both a native install going and a homebrew install and the php components were a breeze with homebrew. Furthermore, I am confident that the next Yosemite security update won't just throw away all my php modules from homebrew whereas that is very likely with the native version.

One aspect that you may well want is to have moodle in your Sites folder. Here is a guide that is pretty good although the writer did not consider the process as only a five minute job.

http://coolestguidesontheplanet.com/get-apache-mysql-php-phpmyadmin-working-osx-10-10-yosemite/

In reply to Brian Lockwood

Re: MAMP on OSX - Yosemite

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Perhaps you should go and try my wonderful advice before being so cynical wink

The Liip install involves pasting one line into Terminal and sitting back for a couple of minutes. That's it done (including all those nasty dependencies). If you like making things difficult for yourself by all means carry on doing it the hard way!

If you are the only user on your OSX box then why bother with the Sites folder? I make a link to the system document root (/var/www for old time's sake) and own it by myself. Makes sense to me. 

Seriously, 5 minutes and up and running. Who cares if it gets trashed on an upgrade. Do it again. 

In reply to Howard Miller

Re: MAMP on OSX - Yosemite

by Brian Lockwood -

I really was not being cynical, apologies if you are offended.

The Liip install did not work for me and although it is a well known fix you are relying on someone elses script (although that is also the case with homebrew).

In any case, for me Liip failed to fix the php modules.

As I stated it may be because I upgraded to Yosemite rather than bought a new Mac (Part of Apples preferred upgrade path). Also Apple's updates are famed for their forks and over-writing.

A google concerning Apple and Apache change will show that there are many competent users who see Apache - php - mysql upgrades as far from trivial, hence my invitation for gurus such as yourself to document the process.

In reply to Brian Lockwood

Re: MAMP on OSX - Yosemite

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I've got four Macs at various locations, some newer than others, some with clean installs and some with upgrades. The Liip install has never failed for me. I might have been lucky but I've used it a hell of a lot. I see no reason to suspect that Liip (a Moodle Partner remember) haven't done a proper job. 

You can install PHP on OSX however you like but, yes, installing PHP can be pain so I would strongly suggest to everybody else - try the Liip install before you go down some other route. 

As far as I'm concerned I've documented the process I use (and I use Macs all day every day for Moodle development). I've never had to do anything more complicated. 

Oh, and you'll need to try harder to offend me big grin


In reply to Howard Miller

Re: MAMP on OSX - Yosemite

by Brian Lockwood -

FWIW the php issues occurred with

/usr/local/php5/bin/pecl install pecl_http
I am not sure how pecl works to be honest but it appeared to me to be an issue to do with whatever library my pecl pointed to.

The homebrew install fixed all this.

I almost always use linux for my work and find OSX a labyrinth in comparison in that whilst it almost always works fine it is great but when it doesn't it is a pig.

Also, I am not the only user of the mac.

To paraphrase Longfellow

    When Apple is good she is very very good

    but when she is bad she is horrid.

In reply to Brian Lockwood

Re: MAMP on OSX - Yosemite

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Doesn't work for me either. I don't have 'autoconf' installed. However, you don't need these extensions for Moodle. 

There are several tutorials for installing autoconf on OSX but - although not rocket science - it's no longer dead simple. I've added an issue for the Liip installer so that they might mention this in the FAQ (or even provide a more elegant alternative)

In reply to Brian Lockwood

Re: MAMP on OSX - Yosemite

by Bob Puffer -

I've been running native LAMP on OS X since Mavericks and it didn't get clobbered when I moved to Yosemite. What I like most about it is that it mirrors Linux a lot better than Homebrew or Macports.