#
ドキュメント

Document

自分のための備忘録です。

PHPローカル開発環境構築

開発環境概要

種類

ローカル開発環境は大きく以下の環境に分類できます。

大分類 タイプ アプリケーション
ローカル ビルトインサーバー ローカルのPHP/MySQL/MailCatcher
ローカル Apache ローカルのPHP/MySQL/MailCatcher
仮想化 Vagrant プロビジョニングでインストール

ローカルのPHP/MySQL/MailCatcher

ビルトインサーバーやデフォルトのApacheはローカルのPHP/MySQL/MailCatcherを使用します。   HomebrewでPHP/MySQLをローカルへインストールします。

ローカルへインストールする方法はいろいろとありますがMacではHomebrewを使うことをお勧めします。

  1. PHPインストール
  2. MySQLインストール
  3. MailCatcherインストール

PHPのインストールと合わせて下記を行うとと後々便利です。 それぞれ導入方法は後述します。

  • PEAR/PECL導入 PHPセクションで導入方法記載
  • XDebug拡張モジュールインストール PHPセクションで導入方法記載
  • phpbrew 後述

Homebrew

brew install

brew instal パッケージ名は下記の処理を行います。

  1. /usr/local/Callerへインストール
  2. /usr/local/binへシンボリックリンクを作成

brew unlinkbrew uninstall

  • brew unlinkはシンボリックリンクを削除します。
  • brew uninstallは本体も削除します。

コマンド一覧

$ brew update         // Homebrew本体とformulaを更新
$ brew upgrade        // formulaのみ更新
$ brew upgrade foo    // formulaを指定して更新
$ brew list           // インストール済み表示
$ brew search phpunit // 利用可能なphpunitを検索
$ brew info phpunit   // インストール済みphpunitの詳細情報(インストールパスなど)

brew searchで下記エラーが発生しました。

Error: GitHub API Error: API rate limit exceeded for XXX.XXX.XXX.XXX. (But here's the good news: Authenticated requests get a higher >rate limit. Check out the documentation for more details.) Try again in 55 minutes 9 seconds, or create a personal access token: https://github.com/settings/tokens/new?scopes=&description=Homebrew and then set the token as: export HOMEBREW_GITHUB_API_TOKEN="your_new_token"

エラーメッセージにあるとおりリンクへリンクし取得したトークンを.bash_profileを記載すると改善されます。

export HOMEBREW_GITHUB_API_TOKEN="xxx.xxx.xxx.xxx"

上記記載後はbashの再起動が必要です。

$ brew unlink mysql // MySQLを一時的に停止
$ brew link mysql   // 再リンク

LAMP構築

PHP

$ brew php56               // インストール
$ php --version            // バージョン確認
$ php --ini                // 設定ファイル配置確認

シェルにパスを通す。

vi ~/bash_profile
// または
vi ~/zshrc

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

MacのPHP5をPHP7にbrewでアップデートする - Qiita

ビルトインサーバー

$ php -S localhost:8080 -t .    // ビルドインサーバー起動

-tはドキュメントルート指定するオプションです。

PEAR/PECL

PEARをインストールするとPECLもインストールされます。

$ sudo php /usr/lib/php/install-pear-nozlib.phar -d /usr/local/lib/php -b /usr/local/bin

XDebug

インストール

$ brew install php56-xdebug

下記コマンドで設定ファイルの場所を確認できます。

$ php --ini
Configuration File (php.ini) Path: /usr/local/etc/php/5.6
Loaded Configuration File:         /usr/local/etc/php/5.6/php.ini
Scan for additional .ini files in: /usr/local/etc/php/5.6/conf.d
Additional .ini files parsed:      /usr/local/etc/php/5.6/conf.d/ext-xdebug.ini  # XDebug設定ファイルです。

MySQLインストール

$ brew install mysql

必要があれば下記でパスワードなどセキュリティーを設定できます。

$ mysql_secure_installation

MailCatcher

MailCatcher

インストール

$ gem install mailcatcher

PHPと連携

php.iniのsendmail_pathを変更します。

- ;sendmail_path =
+ sendmail_path = /usr/bin/env catchmail

実行

$ mailcatcher
Starting MailCatcher
==> smtp://127.0.0.1:1025
==> http://127.0.0.1:1080
*** MailCatcher runs as a daemon by default. Go to the web interface to quit.

停止

http://127.0.0.1:1080へアクセスしブラウザ上で実行します。

Apache

Macのデフォルトでインストール済みのApacheの設定方法をまとめています。
Yosemite(MacOS:10.10.X)やEl capitanでApacheを使えるようにしてみる - Qiita

コマンド/ファイル 内容
起動 sudo apachectl start
停止 sudo apachectl stop
再起動 sudo apachectl restart
設定確認 apachectl configtest
httpd.conf /private/etc/apache2/httpd.conf
httpd-vhosts.conf private/etc/apache2/extra/httpd-vhosts.conf
DocumentRoot /Library/WebServer/Documents
shiroshi.conf /private/etc/apache2/users/shiroshi.conf
httpd-userdir.conf /etc/apache2/extra/httpd-userdir.conf

トラブルシューティング

libphp5.so
apachectl configtest
httpd: Syntax error on line 527 of /private/etc/apache2/httpd.conf: Syntax error on line 8 of /private/etc/apache2/other/+php-osx.conf: Cannot load /usr/local/php5/libphp5.so into server: dlopen(/usr/local/php5/libphp5.so, 10): Symbol not found: _unixd_config\n  Referenced from: /usr/local/php5/libphp5.so\n  Expected in: /usr/sbin/httpd\n in /usr/local/php5/libphp5.so

最初はlibphp5.soが正しく読み込めていないのが原因と思いましたがhttpd.confの下記をコメントアウトすることで改善しました。

LoadModule php5_module libexec/apache2/libphp5.so
Forbidden 403, You don’t have permission to access /~username/ on this server
  1. httpd.conf変数
    LoadModule userdir_module libexec/apache2/mod_userdir.soのコメントアウトをはずす。
      Include /private/etc/apache2/extra/httpd-userdir.confのコメントアウトをはずす。
  2. /private/etc/apache2/users/shiroshi.conf作成
  3. /etc/apache2/extra/httpd-userdir.conf編集

2の内容

<Directory "/Users/shiroshi/Sites/">
AllowOverride All
Options Indexes MultiViews
Options +FollowSymLinks
Require all granted
</Directory>

hostsファイル

hosts(/private/etc/hosts)ファイルでドメインを設定します。   127.0.0.1へ設定したドメインはホストOSで起動しているWEBサーバーへ渡されます。

project
  |
  |-- index.php
$ sudo vi /private/etc/hosts
127.0.0.1 www.example.com   # 追加

ビルトインサーバー起動

$ cd /path/to/project
$ php -S www.example.com:8080

ブラウザ

http://www.example.com:8080

仮想化 Vagrant

ヘルプ

$ vagrant --help

Vagrant自体のUpgrade

Vagrant公式サイトからパッケージをダウンロードしインストールしてください。

ローカル全体のVagrant環境確認

// ローカルにインストールされているVagrant環境表示
$ vagrant global-status
// キャッシュをクリアして表示
$ vagrant global-status --prune

boxのリスト

$ vagrant box list

boxの更新情報

// Vagrantfile配置フォルダで下記コマンド実行します。
$ vagrant box outdated

boxのアップデート

// Vagrantfile配置フォルダで下記コマンド実行します。
$ vagrant box update

boxの削除

// box削除
$ vagrant box remove <box名>
// バージョンを指定して削除
$ vagrant box remove <box名> --box-version 1.x.x

VirtualBoxの状態

vagrant up/halt/destroyに対するVirtualBoxの状態です。

  • vagrant up 実行中
  • vagrant halt 電源オフ
  • vagrant destroy 中断

トラブルシューティング

事例1

A VirtualBox machine with the name 'vccw.dev' already exists. Please use another name or delete the machine with the existing name, and try again.

発生原因と解決策を調べてください。
競合しているboxをdestroyすると改善することがあります。

// vagrant global-status
$ vagrant destroy <box名>

事例2

An error occurred in the underlying SSH library that Vagrant uses. The error message is shown below. In many cases, errors from this library are caused by ssh-agent issues. Try disabling your SSH agent or removing some keys and try again.

If the problem persists, please report a bug to the net-ssh project.

timeout during server version negotiating

上記エラーが発生したときSource TreeやPhpStormを終了したら改善しました。

Homestead

https://laravel.com/docs/5.3/homestead

LaravelのVagrant環境です。 汎用性が高く他のプロジェクトでも使用できます。

大まかな手順

大きくグローバル(ホームディレクトリ)へインストールする方法とプロジェクトフォルダへインストールする方法があります。
下記はグローバルへインストールする方法です。

  1. グローバルへHomesteadをインストール
  2. 設定ファイルの変更(グローバルへインストールしたときは共通です。)
  3. hostsファイル設定(/private/etc/hosts)
  4. プロジェクトディレクトリへLaravelインストール
  5. ~/Homesteadでvagrant up

Homesteadインストール

(Vagrant)box追加

$ vagrant box add laravel/homestead

Homesteadクローン

$ cd ~
$ git clone https://github.com/laravel/homestead.git Homestead

インストール

cd ~/Homestead
$ bash init.sh

ホームディレクトリへ.homesteadフォルダが作成されます。
.homesteadフォルダには下記ファイルが作成されています。

  • Homestead.yaml
  • after.sh
  • aliases

変更が必要なファイルはHomestead.yamlです。

Homestead.yaml設定例

下記は変更する必要がある主な項目です。

  • Provider
  • Configuring Shared Folders

Homestead.yaml設定例

foldersへtype: nfsを追加すると非常に速くなります。

ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
 
authorize: ~/.ssh/id_rsa.pub

keys:
     - ~/.ssh/id_rsa
 
folders:
    - map: /path/to/project                      // ホストの/path/to/projectをゲストの/home/vagrant/Codeへマッピングします。
      to: /home/vagrant/Code
      type: nfs                                  // NFSを設定すると体感で感じる差がでます。
 
sites:
     - map: homestead.app                        // ブラウザでhomestead.appでアクセスします。
      to: /home/vagrant/Code/Laravel/public      // ドキュメントルートです。

databases:
    - homestead

/private/etc/hosts変更

設定例

192.168.10.10 homestead.app

設定するIPアドレスとドメインはHomestead.yaml(~/.homestead/Homestead.yaml)のそれぞれip, sitesで定義されています。

デフォルトのHomestead.yaml

projectへLaravelインストール

HomesteadはLavavelに限定されませんが例としてLaravelをインストールします。

$ cd /path/to/project
$ composer create-project --prefer-dist laravel/laravel Laravel

vagrant up

$ cd ~/Homestead
$ vagrant up

他のVagrant同様、Homesteadフォルダでvagrant sshなどもできます。

MySQL

デフォルトユーザー

ユーザー パスワード
homestead secret
$ cd ~/Homestead
$ vagrant up
##### ログイン #####
vagrant@homestead ~ $ mysql -uhomestead -psecret

concrete5インストール

通常版をインストールします。開発版は正常にインストールできませんでした。インストールで下記エラーがでました。

Carbon\Carbon::setTime($hour, $minute, $second = 0) should be compatible with DateTime::setTime($hour, $minute, $second = NULL, $microseconds = NULL

https://github.com/briannesbitt/Carbon

上記をから最新版をダウンロードしてsrcフォルダを下記と置き換えます。

concrete/vendor/nesbot/carbon/src

マルチドメイン

1 ホストOSからゲストOSへアクセス

ゲストOSのWEBサーバーへはIPアドレスでアクセスできます。
ゲストOSのIPアドレスはHomesteadの場合~/homestead/Homestead.yamlで定義されています。

http://192.168.10.10

192.168.10.10へのリクエストはゲストOSのWEBサーバー(HomesteadのデフォルトはNginx)を呼び出します。

ドメインによるアクセスはホストOSの/private/etc/hostsで定義します。

192.168.10.10 example.com

上記設定でexample.comへのリクエストはゲストOSのWEBサーバー(HomesteadのデフォルトはNginx)のrootへ渡ります。

http://example.com

リクエストを受けたゲストOSのWEBサーバーどのような処理をするかはゲストOSのWEBサーバーの設定ファイルで定義します。
HomesteadのデフォルトWEBサーバーはNginxです。
Nginxのドメイン処理は/etc/nginx/sites-availableで定義します。

Homesteadのデフォルトの設定例
/etc/nginx/sites-available/homestead.app

下記例ではhomestead.appを/home/vagrant/Code/concrete5で処理します。

server {
    listen 80;
    listen 443 ssl http2;
    server_name homestead.app;
    root "/home/vagrant/Code/concrete5";

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/homestead.app-error.log error;

    sendfile off;

    client_max_body_size 100m;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
    }

    location ~ /\.ht {
        deny all;
    }

    ssl_certificate     /etc/nginx/ssl/homestead.app.crt;
    ssl_certificate_key /etc/nginx/ssl/homestead.app.key;
}

PuPHPet

  • Ubuntu14
  • PHP7

https://puphpet.com/

Vagrantfileをオンライン上でGUI操作で作成できます。

concrete5はPHPライブラリgd, zipが必要なのでPHPライブラリで追加してください。
構築後にapt-getでも追加できます。

PuPHPet作成したVagrantへconcrete5テスト環境構築

  • concrete5インストール
  • テスト環境の準備(ゲストOSで作業)
    • MySQLへテスト用ユーザーtravisを追加
    • php.iniでshort_open_tag有効化
    • PHPUnitインストール
MySQLへtravisユーザー作成・権限付与
mysql > CREATE USER travis;
mysql > GRANT ALL PRIVILEGES ON *.* TO travis;
PHP CLI版のshort_open_tagを有効化

php.iniの場所確認

$php --ini

php.iniでshort_open_tagを有効にします。

$ vi php.ini

short_open_tag = On
PHPUnitインストール

https://phpunit.de/manual/current/ja/installation.htmlに詳細な記載があります。

$ wget https://phar.phpunit.de/phpunit.phar
$ chmod +x phpunit.phar
$ sudo mv phpunit.phar /usr/local/bin/phpunit
$ phpunit --version
testsディレクトリでテスト実行
$ phpunit

PuPHPetで構築したVagrantへPHP拡張のインストール

前提

  • Ubuntu
  • PHP5.6

GDライブラリ

phpinfoでgd項目が表示されるか確認します。
表示がなければインストールします。

環境で利用可能なGDライブを検索します。

$ apt-cache search gd | grep php
php-gd - GD module for PHP [default]
php7.0-gd - GD module for PHP
kdevelop-php-dbg - debugging symbols for the KDevelop PHP plugin
php-horde-image - Horde Image API
php-image-text - Image_Text - Advanced text maipulations in images
php-numbers-words - PEAR module providing methods for spelling numerals in words
php5.6-gd - GD module for PHP
php7.1-gd - GD module for PHP

PHP5.6用の php5.6-gdをインストールします。

$ sudo apt-get install php5.6-gd

下記記述のある/etc/php/5.6/fpm/conf.d/20-dg.iniが作成されます。

extension=gd.so

php.iniの変更は必要ありません

ZIP

phpinfoでzip項目が表示されるか確認します。
表示がなければインストールします。

$ apt-cache search zip | grep php
...
$ sudo apt-get install php5.6-zip

下記記述のある/etc/php/5.6/fpm/conf.d/20-zip.iniが作成されます。

extension=zip.so

はphp.iniの変更は必要ありません

VCCW

ホスト変更

ホスト名が競合するのを防ぐためprovision > default.ymlのhostnameを変更しています。
provision > default.yml

(例)
hostname: vccw-example.dev

このときvccw.devでもログインできます(原因調査)。 vccw.devでログインしてしまうとファイルアップロードなどができません。

PhpStormでXdebugを使いデバッグ

VCCWのリモートデバッグは下記記事を参考にしてください。
PhpStormでVCCWをリモートデバッグする(Mac) : WordPress – FindxFine

  1. XDebug設定
  2. PhpStorm設定

1. XDebug設定

インストール

$ brew install php56-xdebug

設定ファイル

下記コマンドで設定ファイルの場所を確認できます。

$ php --ini
Configuration File (php.ini) Path: /usr/local/etc/php/5.6
Loaded Configuration File:         /usr/local/etc/php/5.6/php.ini
Scan for additional .ini files in: /usr/local/etc/php/5.6/conf.d
Additional .ini files parsed:      /usr/local/etc/php/5.6/conf.d/ext-xdebug.ini <----- XDebug設定ファイルです。

記載例です。

[xdebug]
zend_extension="/usr/local/opt/php56-xdebug/xdebug.so"
xdebug.remote_enable=1
;xdebug.remote_port="9000"
xdebug.remote_port=10000
xdebug.profiler_enable=1
xdebug.profiler_output_dir="/Users/shiroshi/tmp"                                                                                       

デフォルトはxdebug.remote_port=9000です。
下記エラーが発生するときは他のアプリケーションが9000を利用している可能性があります。
xdebug.remote_portを9000以外へ変更します(例は10000)。

Can not start listening for connections from 'xdebug': Port 9000 is busy

デバッグの際に下記エラーの発生する環境がありました。

14:29	Debug session was finished without being paused
            It may be caused by path mappings misconfiguration or not synchronized local and remote projects.
            To figure out the problem check path mappings configuration for 'localhost (1)' server at PHP|Servers or enable Break at first line in PHP scripts option (from Run menu).
            Do not show again

下記のように設定ファイルを変更し解消しました。
ext-xdebug.iniを変更

xdebug.default_enable = 1
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_port=9001
;xdebug.profiler_enable=1
xdebug.profiler_output_dir="/Users/shiroshi/tmp"
; xdebug.remote_host=localhost
xdebug.max_nesting_level=10000
xdebug.remote_connect_back=1
xdebug.idekey = "PHPSTORM"

xdebug.max_nesting_level=10000が小さいと発生する可能性が高いと感じていますが、検証はできていません。

PhpStorm

preference > Languages & Frameworks > PHP > Debug
XdebugセクションのDebug portを/usr/local/etc/php/5.6/conf.d/ext-xdebug.iniへ記載したポートを設定します。

PhpStormのドキュメントでは他の設定項目について記載がありますが、
上記設定以外の設定はせずブレークポイントを貼り電話アイコンクリックしリッスン状態にすれば、
初回アクセス時にダイアログが表示され自動で設定されます。

自動セットアップで設定される項目

自動で設定される項目下記のとおりです。

  • preference > Languages & Frameworks > PHP
    設定なし(interpreterも指定しません)
  • preference > Languages & Frameworks > PHP > Debug
  • preference > Languages & Frameworks > Servers Host localhost Port 8080 Debugger XDebug
ビルトインサーバーではない環境

PhpStorm から Vagrant VM の PHP アプリケーションをリモートデバッグする(Web & CLI) - Shin x blog

phpbrew

事前準備

phpbrewをインストールする前に必要なパッケージなどが記載されています。   Requirement · phpbrew/phpbrew Wiki

xcode-select --install
brew install automake autoconf curl pcre bison re2c mhash libtool icu4c gettext jpeg openssl libxml2 mcrypt gmp libevent
brew link --force icu4c // 公式は--forceが付いてないが必要
brew link --force openssl
brew link --force libxml2

公式ドキュメントはic4cに--forceは付いてませんが私の環境では必要でした。

インストール

インストールは下記記事を参考にしました。
MacでのPHP開発はphpbrewが非常に良い | karakaram-blog;

curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew
chmod +x phpbrew
sudo mv phpbrew /usr/local/bin/phpbrew

Macの最新版は公式のREADMEにある/usr/binへはsudo mvコマンドでもパーミッションエラーがでます。
パスが通っているフォルダであればよいので/usr/local/binへ配置しました。

$ phpbrew init

(.bashrcではなく).bash_profileへ下記を記載します。 私の環境では下記を記載した.bashrcを作成しても正常に動作しませんでした。

source $HOME/.phpbrew/bashrc

ターミナルを再起動してください。

PHP7インストール

$ phpbrew install 7.0.11 +default +mysql +fpm +opcache +intl +iconv

opensslエラーでインストールできないときは下記を試してください。

$ brew install openssl # Optional
$ phpbrew install 7.0.18 +default +openssl=$(brew --prefix openssl)

phpbrew でPHP7 をインストールする。 - Qiita

phpbrewで拡張モジュールをインストール

拡張をモジュールをインストールしたいバージョンへ切り替えます。

$ phpbrew use 7.0.11
// XDebugをインストールします。
// 7.0.11に対してインストールされます。
phpbrew ext install xdebug

パージョン切り替え

一時的に切り替える

// 切り替え 再起動後はシステムへ戻る
$ phpbrew use PHPバージョン

// 再起動後もシステムへ戻らない切り替え
$ phpbrew swicth PHPバージョン

// システムへ戻す
$ phpbrew off

インストールのオプションによるConfigure Commandの違い

例1

$ phpbrew install 7.0.11 +default +mysql +fpm +opcache +intl +iconv
'./configure' '--cache-file='''/Users/shiroshi/.phpbrew/cache/config.cache'''' '--prefix=/Users/shiroshi/.phpbrew/php/php-7.0.11' '--with-config-file-path=/Users/shiroshi/.phpbrew/php/php-7.0.11/etc' '--with-config-file-scan-dir=/Users/shiroshi/.phpbrew/php/php-7.0.11/var/db' '--disable-all' '--enable-session' '--enable-short-tags' '--with-zlib=/usr' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--with-mysql-sock=/tmp/mysql.sock' '--enable-fpm' '--enable-opcache' '--enable-intl' '--with-icu-dir=/usr/local/opt/icu4c' '--with-iconv' '--enable-libxml' '--enable-simplexml' '--enable-xml' '--enable-xmlreader' '--enable-xmlwriter' '--with-xsl' '--with-libxml-dir=/usr/local/opt/libxml2' '--enable-bcmath' '--with-bz2=/usr' '--enable-calendar' '--enable-cli' '--enable-ctype' '--enable-dom' '--enable-fileinfo' '--enable-filter' '--enable-shmop' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-json' '--enable-mbregex' '--enable-mbstring' '--with-mhash=/usr/local' '--with-mcrypt=/usr/local' '--enable-pcntl' '--with-pcre-regex' '--with-pcre-dir=/usr/local' '--enable-pdo' '--enable-phar' '--enable-posix' '--with-readline=/usr/local/opt/readline' '--enable-sockets' '--enable-tokenizer' '--with-curl=/usr' '--with-openssl=/usr/local/opt/openssl' '--enable-zip' '--with-pear=/Users/shiroshi/.phpbrew/php/php-7.0.11/lib/php'

例2

$  phpbrew install 7.0.11 +default
./configure' '--cache-file='''/Users/shiroshi/.phpbrew/cache/config.cache'''' '--prefix=/Users/shiroshi/.phpbrew/php/php-7.0.11' '--with-config-file-path=/Users/shiroshi/.phpbrew/php/php-7.0.11/etc' '--with-config-file-scan-dir=/Users/shiroshi/.phpbrew/php/php-7.0.11/var/db' '--disable-all' '--enable-session' '--enable-short-tags' '--with-zlib=/usr' '--enable-libxml' '--enable-simplexml' '--enable-xml' '--enable-xmlreader' '--enable-xmlwriter' '--with-xsl' '--with-libxml-dir=/usr/local/opt/libxml2' '--enable-opcache' '--enable-bcmath' '--with-bz2=/usr' '--enable-calendar' '--enable-cli' '--enable-ctype' '--enable-dom' '--enable-fileinfo' '--enable-filter' '--enable-shmop' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-json' '--enable-mbregex' '--enable-mbstring' '--with-mhash=/usr/local' '--with-mcrypt=/usr/local' '--enable-pcntl' '--with-pcre-regex' '--with-pcre-dir=/usr/local' '--enable-pdo' '--enable-phar' '--enable-posix' '--with-readline=/usr/local/opt/readline' '--enable-sockets' '--enable-tokenizer' '--with-curl=/usr' '--with-openssl=/usr/local/opt/openssl' '--enable-zip' '--with-pear=/Users/shiroshi/.phpbrew/php/php-7.0.11/lib/php'

トラブルシューティング

エラーメッセージ

Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.

解決策

config.vm - Vagrantfile - Vagrant by HashiCorp