Making own AMP stack with Homebrew on a Mac

17
Making own AMP stack with Homebrew on a Mac Raimonds Kalniņš Wunderkraut Latvia

Transcript of Making own AMP stack with Homebrew on a Mac

Page 1: Making own AMP stack with Homebrew on a Mac

Making own AMP stack with Homebrew on a

Mac

Raimonds Kalniņš Wunderkraut Latvia

Page 2: Making own AMP stack with Homebrew on a Mac

AMP?

- Historically a bundle of Apache, Mysql and PHP

- Today refers to various combos of web server components

- LAMP: Linux + AMP

Page 3: Making own AMP stack with Homebrew on a Mac

- There are number of options to set up AMP on a Mac

- But there is also lack of - choice / customisation - performance

What is the problem?

Page 4: Making own AMP stack with Homebrew on a Mac

Options to set up AMP

- Built-in Apache and PHP - AMP software bundles (MAMP, XAMPP) - Virtualisation software - Package manager (Homebrew)

Page 5: Making own AMP stack with Homebrew on a Mac

Built-in Apache and PHP

- Good - It’s there already on the system - Only DB server needs to be added

- Bad - Hardly customisable - Can’t do without sudoing - Can’t start fresh if things go wrong

Page 6: Making own AMP stack with Homebrew on a Mac

Built-in Apache and PHP

You don’t want to sing this song at the end of the day if built-in binaries/config files become corrupted.

Page 7: Making own AMP stack with Homebrew on a Mac

AMP software bundles

- Good - Easy to set up - Easy to reinstall / remove

- Bad - Partly customisable - Lots of (usually) unwanted stuff

Page 8: Making own AMP stack with Homebrew on a Mac

Virtualisation software

- Good - Fully customisable - Easy to reinstall / remove

- Bad - Performance overhead

Page 9: Making own AMP stack with Homebrew on a Mac

Package manager

- Good - Fully customisable - Easy to reinstall / remove - Full speed

- Bad - Outdated packages - Package manager prone to major

internal changes

Page 10: Making own AMP stack with Homebrew on a Mac

Homebrew lingo

Formula A package definition file

Tap A repository of Formulae

More information can be found on Homebrew project website.

Page 11: Making own AMP stack with Homebrew on a Mac

Homebrew requirements

- OS X 10.6 (10.7 is recommended) - Intel CPU is recommended - Command line tools for Xcode*

* Install with xcode-select --install

Page 12: Making own AMP stack with Homebrew on a Mac

The Plan - HAMP

- Install Homebrew - Install Apache 2.4 - Install MariaDB 10 - Install PHP 5.6 - Install Drush 7

Page 13: Making own AMP stack with Homebrew on a Mac

HAMP requirements

Before setting up HAMP, these taps need to be added: - brew tap homebrew/apache - brew tap homebrew/homebrew-php

Page 14: Making own AMP stack with Homebrew on a Mac

Installing the software

Run - brew install http24 - brew install mariadb - brew install php56 - brew install drush

Page 15: Making own AMP stack with Homebrew on a Mac

Configure the software

Make changes to httpd.conf: - ServerName localhost:8080 - AllowOverride All - LoadModule php5_module [..]/libphp5.so - LoadModule rewrite_module [..]/

mod_rewrite.so - DirectoryIndex index.php - AddType application/x-httpd-php .php

Secure MariaDB: - mysql_secure_installation

Page 16: Making own AMP stack with Homebrew on a Mac

Demo

Page 17: Making own AMP stack with Homebrew on a Mac