Skip to content

Instantly share code, notes, and snippets.

@nw-tsubo
Last active October 10, 2016 03:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nw-tsubo/4f9f30a53e232b4de5ad014f075de8db to your computer and use it in GitHub Desktop.
Save nw-tsubo/4f9f30a53e232b4de5ad014f075de8db to your computer and use it in GitHub Desktop.
mac への PHP5.6 のインストール

Mac への PHP v5.6 のインストール

homebrew のインストール

brew コマンドをインストールしていない場合はインストールします。 インストール方法はこちら

brew レポジトリの追加

PHP は brew の公式レポジトリからはインストールすることができません。 brew tap コマンドを使って外部のリポジトリを追加します。

$ brew tap homebrew/dupes
$ brew tap homebrew/versions
$ brew tap homebrew/php

PHP v5.6 のインストール

$ brew install php56
$ brew install php56-mcrypt

php.ini の設定

エディタを使って php.ini の以下のように該当箇所を変更します。

;/usr/local/etc/php/5.6/php.ini

date.timezone = Asia/Tokyo
default_charset = "UTF-8"
mbstring.language = Japanese
mbstring.internal_encoding = UTF-8
mbstring.detect_order = UTF-8,SJIS,EUC-JP,JIS,ASCII

PHP バージョン確認

以下のように PHP 5.6.xx が表示されれば OK です。

$ php -v
PHP 5.6.20 (cli) (built: Mar 31 2016 17:14:52) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment