facebook twitter hatena line email

「Mac/インストール/php-fpm」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(自動起動)
 
(同じ利用者による、間の10版が非表示)
行1: 行1:
 
==php-fpmインストール==
 
==php-fpmインストール==
  $ brew tap homebrew/dupes
+
$ brew update
 +
  $ brew tap homebrew/dupes # Formuraの追加(apache)
 
  $ brew tap homebrew/versions
 
  $ brew tap homebrew/versions
  $ brew tap homebrew/php
+
  $ brew install homebrew/php/php56 --with-fpm
 +
 
 +
ちなみに間違えて入れた場合は以下感じで削除できる
 +
brew untap homebrew/php
  
 
==php-fpm設定==
 
==php-fpm設定==
行17: 行21:
  
 
==自動起動==
 
==自動起動==
  ln -sfv /usr/local/opt/php56/*.plist ~/Library/LaunchAgents
+
  ln -s /usr/local/opt/php56/homebrew.mxcl.php56.plist ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
 +
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
 
  launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
 
  launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
 +
 +
==確認==
 +
$ php-fpm -v
 +
PHP 5.6.24 (fpm-fcgi) (built: Aug  8 2016 16:58:54)
 +
Copyright (c) 1997-2016 The PHP Group
 +
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
  
 
== Operation not permittedエラー==
 
== Operation not permittedエラー==
 
error_logを変更せずにphp-fpmを起動しようとするとエラーとなる
 
error_logを変更せずにphp-fpmを起動しようとするとエラーとなる
 +
 +
==Error: Failed to download resource "libpng"==
 +
Homebrewの権限を確認
 +
ls -ltA /Users/mac1/Library/Caches/Homebrew
  
 
==起動==
 
==起動==
  $ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
+
  $ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
  
 
==停止==
 
==停止==
 
  $ launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
 
  $ launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist

2016年12月29日 (木) 19:47時点における最新版

php-fpmインストール

$ brew update
$ brew tap homebrew/dupes # Formuraの追加(apache)
$ brew tap homebrew/versions
$ brew install homebrew/php/php56 --with-fpm

ちなみに間違えて入れた場合は以下感じで削除できる

brew untap homebrew/php

php-fpm設定

$ sudo cp /private/etc/php-fpm.conf.default /private/etc/php-fpm.conf
$ sudo vi /private/etc/php-fpm.conf
 ;pid = run/php-fpm.pid
 pid = /var/run/php-fpm.pid
 ;error_log = log/php-fpm/php-fpm.log
 error_log = /var/log/php-fpm/php-fpm.log
$ sudo mkdir /var/log/php-fpm
$ sudo php-fpm

参考:http://qiita.com/alegriaghost/items/7af4bf029e90ec37f7e0

自動起動

ln -s /usr/local/opt/php56/homebrew.mxcl.php56.plist ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php56.plist

確認

$ php-fpm -v
PHP 5.6.24 (fpm-fcgi) (built: Aug  8 2016 16:58:54)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

Operation not permittedエラー

error_logを変更せずにphp-fpmを起動しようとするとエラーとなる

Error: Failed to download resource "libpng"

Homebrewの権限を確認

ls -ltA /Users/mac1/Library/Caches/Homebrew

起動

$ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist

停止

$ launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist