Installing Learning Locker on Mac OS X with MAMP

The Learning Locker requirements page recommends a LAMP style stack to install on, I use Mac OS X, which is close enough and because I want to keep my Apache, MySQL and PHP stuff self contained I use the free version of MAMP which is great for the most part but requires a little bit of extra fidderling when you want to compile new PHP extensions, like the Mango extension that you will need for Learning Locker, although the documentation says I can use MySQL and I didn’t want to go against the grain. Installing MAMP is a case of downloading the application and moving it to your applications folder.  I also use Homebrew which is a package manager for the Mac OS which I really recommend it if you looking to install *nix like tools, although be honest something like that should be included in the OS by default.

1. Install Composer

Composer is a dependency manager for PHP and required for Learning Locker, installed via Homebrew at the terminal with

brew update
brew tap homebrew/homebrew-php
brew tap homebrew/dupes
brew tap homebrew/versions
brew install homebrew/php/composer

2. Create Project

Then you will need to create your project. You can create it where ever you like, but it makes sense to serve it from the same directory that Apache is serving from. I don’t server it from the default MAMP directory but from /Users/David/Sites. You can create the project with:

composer create-project learninglocker/learninglocker

3. Artisan

Change in to the learninglocker directory and run the following artisan command:

php artisan generate:migration add_statements

 4. Install and run MongoDB

Did this easily with brew

brew install mongodb
mongod –fork

 5. Install MongoDB PHP extenson

MAMP doesn’t ship with the PHP source to compile I had to download PHP source in to the MAMP directory for the PHP version I was using, i.e /Applications/MAMP/bin/php/php5.5.3/includes/php . This means I had to go to the PHP site and download the source for 5.5.3 and put it in includes/php. Make sure you get the right version! Then:

cd /Applications/MAMP/bin/php/php5.5.3/includes/php
./configure --with-php-config=/Applications/MAMP/bin/php/php5.5.3/bin/php-config

find the appropriate php.ini in MAMP and add this line:

Reset MAMP

6. Final config

add mongodb config to database.php

sudo nano app/config/app.php

Add the following service provider to app/config/app.php in ‘Autoloaded Service Providers’


sudo nano app/config/app.php

Then you can head over to localhost/learninglocker to get started