macでnginx + phpbrew + mysqlの環境
phpbrewのインストール
http://mxcl.github.io/homebrew/
下記のコマンドで
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
nginxのインストール
brew install nginx
設定ファイルの場所
/usr/local/etc/nginx/nginx.conf起動
sudo nginx
command not foundになった時は
sudo vim /etc/paths
最後に/usr/local/sbin/を追加
- 停止
sudo nginx -s stop
*リロード
sudo nginx -s reload
phpbrewのインストール
https://github.com/c9s/phpbrew
php-fpm付きでインストールは +fpm をつける
phpbrew install php-5.4.13 +default +fpm +dbs
~/.phpbrew/php/php-5.4.13/sbin/php-fpm
[08-Apr-2013 23:48:47] NOTICE: [pool www] ‘user’ directive is ignored when FPM is not running as root [08-Apr-2013 23:48:47] NOTICE: [pool www] ‘group’ directive is ignored when FPM is not running as root とかでるけど。。。?_?
- 停止
kill `cat ~/.phpbrew/php/php-5.4.13/var/run/php-fpm.pid`
または、 アクティビティモニターからphpで検索してプロセス終了 (こっちのほうが楽?)
mysqlのインストール
brew install mysql
nginxの設定
とりあえず最低限の設定
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log; #ディレクトリ作った
error_log /var/log/nginx/error.log; #ディレクトリ作った
server {
listen 80;
server_name localhost;
root /どこでも;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}
とりえあえずphpinfoもpdoも確認できた。
phpのバージョンの切替も楽、VMも起動しなくてもいいフラットな開発環境。 容量に悩んでたのがちょっと解消。
PHPUnitの方はまだなので今度書こうかと。
php 5.3.22に切り替えてみた (なぜか5.3.23はインストールのエラー…)
phpbrew use 5.3.22
~/.phpbrew/php/php-5.3.22/sbin/php-fpm
いやはや..