homebrewでapache2.4とphp7.0.7をインストール

#Apache2.4のインストール
とりあえず、brewコマンド使える前提で。
```$ brew tap homebrew/dupes
$ brew tap homebrew/apache
$ brew install httpd24 --with-privileged-ports```
割とあっさり入ります。

####apacheインストールログ
```
==> Installing httpd24 from homebrew/apache
==> Installing dependencies for homebrew/apache/httpd24: pcre, homebrew/d
==> Installing homebrew/apache/httpd24 dependency: pcre
==> Downloading https://homebrew.bintray.com/bottles/pcre-8.38.mavericks.bottle.
######################################################################## 100.0%
==> Pouring pcre-8.38.mavericks.bottle.tar.gz
🍺  /usr/local/Cellar/pcre/8.38: 203 files, 5.4M
==> Installing homebrew/apache/httpd24 dependency: homebrew/dupes/zlib
==> Downloading https://homebrew.bintray.com/bottles-dupes/zlib-1.2.8.mavericks.
######################################################################## 100.0%
==> Pouring zlib-1.2.8.mavericks.bottle.1.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/zlib/lib
    CPPFLAGS: -I/usr/local/opt/zlib/include

==> Summary
🍺  /usr/local/Cellar/zlib/1.2.8: 11 files, 361.7K
==> Installing homebrew/apache/httpd24 dependency: apr
==> Downloading https://homebrew.bintray.com/bottles/apr-1.5.2.mavericks.bottle.
######################################################################## 100.0%
==> Pouring apr-1.5.2.mavericks.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

Apple's CLT package contains apr.
==> Summary
🍺  /usr/local/Cellar/apr/1.5.2: 56 files, 1.2M
==> Installing homebrew/apache/httpd24 dependency: apr-util
==> Downloading https://homebrew.bintray.com/bottles/apr-util-1.5.4_1.mavericks.
######################################################################## 100.0%
==> Pouring apr-util-1.5.4_1.mavericks.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

Apple's CLT package contains apr.
==> Summary
🍺  /usr/local/Cellar/apr-util/1.5.4_1: 50 files, 706.7K
==> Installing homebrew/apache/httpd24
==> Downloading https://archive.apache.org/dist/httpd/httpd-2.4.18.tar.bz2
######################################################################## 100.0%
==> ./configure --enable-layout=Homebrew --enable-mods-shared=all --enable-uniqu
==> make
==> make install
==> Caveats
To have launchd start homebrew/apache/httpd24 now and restart at startup:
  sudo brew services start homebrew/apache/httpd24
Or, if you don't want/need a background service you can just run:
  apachectl start
==> Summary
🍺  /usr/local/Cellar/httpd24/2.4.18: 209 files, 4.2M, built in 2 minutes 31 seconds
```

#php7.0.7のインストール
```
$ brew tap homebrew/dupes
$ brew tap homebrew/versions
$ brew tap homebrew/homebrew-php
$ brew options php70（インストールできるかできないかの確認）
$ brew install php70 --homebrew-apxs
```
ちなみにphpインストールコマンドに--homebrew-apxsを付与すると、、
```
LoadModule php7_module    /usr/local/opt/php70/libexec/apache2/libphp7.so
```
この一文がhttpd.conf(apache設定ファイル)に自動的に追記され、apache側がこのphpを（もしpcの中に色んなphpが混在していても）判別し、ブラウザで実行することができるようになる。これがないとこのphpはブラウザで（というかapacheで）認識できない。

####phpインストールログ
```
###################################################################100.0%
==> ./configure --prefix=/usr/local/Cellar/php70/7.0.7 --localstatedir=/usr/loca
==> make
==> make install
==> Caveats
To enable PHP in Apache add the following to httpd.conf and restart Apache:
    LoadModule php7_module    /usr/local/opt/php70/libexec/apache2/libphp7.so

    <FilesMatch .php$>
        SetHandler application/x-httpd-php
    </FilesMatch>

Finally, check DirectoryIndex includes index.php
    DirectoryIndex index.php index.html

The php.ini file can be found in:
    /usr/local/etc/php/7.0/php.ini

✩✩✩✩ Extensions ✩✩✩✩

If you are having issues with custom extension compiling, ensure that
you are using the brew version, by placing /usr/local/bin before /usr/sbin in your PATH:

      PATH="/usr/local/bin:$PATH"

PHP70 Extensions will always be compiled against this PHP. Please install them
using --without-homebrew-php to enable compiling against system PHP.

✩✩✩✩ PHP CLI ✩✩✩✩

If you wish to swap the PHP you use on the command line, you should add the following to ~/.bashrc,
~/.zshrc, ~/.profile or your shell's equivalent configuration file:

      export PATH="$(brew --prefix homebrew/php/php70)/bin:$PATH"

✩✩✩✩ FPM ✩✩✩✩

To launch php-fpm on startup:
    mkdir -p ~/Library/LaunchAgents
    cp /usr/local/opt/php70/homebrew.mxcl.php70.plist ~/Library/LaunchAgents/
    launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php70.plist

The control script is located at /usr/local/opt/php70/sbin/php70-fpm

OS X 10.8 and newer come with php-fpm pre-installed, to ensure you are using the brew version you need to make sure /usr/local/sbin is before /usr/sbin in your PATH:

  PATH="/usr/local/sbin:$PATH"

You may also need to edit the plist to use the correct "UserName".

Please note that the plist was called 'homebrew-php.josegonzalez.php70.plist' in old versions
of this formula.

To have launchd start homebrew/php/php70 now and restart at login:
  brew services start homebrew/php/php70
==> Summary
🍺  /usr/local/Cellar/php70/7.0.7: 332 files, 49.5M, built in 5 minutes 58 seconds
```

上記メッセージが出たら成功。
あとはhttpd.confに下記を追加。
これもphpインストール時のログに出力されてる。
```
<FilesMatch .php$>
    SetHandler application/x-httpd-php
</FilesMatch>
DirectoryIndex index.php index.html
```
パスを通すために~/.bashrcに以下を追加。
```
PATH="/usr/local/bin:$PATH"
export PATH="$(brew --prefix homebrew/php/php70)/bin:$PATH"
PATH="/usr/local/sbin:$PATH"
```
ちなみに上記三行はこれを参考にするよりもphpをインストールした時に出力されたログ（上記の長いやつ）に書いてあるのでそっちをコピペした方が確実。

とりあえずパス追加しないとphp -vとかでバージョン確認してもデフォルトでpcに入ってるバージョンが出力されて焦ります。


設定したら、反映と確認。
```$ source ~/.bashrc（反映させて、、）
$ php -v（PHPのバージョンは、、、）
PHP 7.0.7 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
$ apachectl -v（apacheのバージョンは、、）
Server version: Apache/2.4.18 (Unix)
Server built:   Nov  6 2015 16:08:51```

###無事ゲット。