いつかエンジニアになりたい

Nothing is too late to start

Homebrewを使ったMANP環境構築

今さらながらmacportsからhomebrewに乗り換えてみた。

とりあえず以下の環境でPHP, mysql, apacheの環境を揃えた。

PC:Macbook 

OS:Mac OS X lion

パッケージ管理:homebrew

% brew install coreutils
% brew install bash-completion
% brew install curl
% brew install zsh
% brew install readline
# php, mysql, apache
% curl -O https://raw.github.com/ampt/homebrew/php/Library/Formula/php.rb
% mv php.rb `brew --prefix`/Library/Formula
% brew options php
% php
  --with-mysql
% Include MySQL support
  --with-pgsql
  Include PostgreSQL support
% --with-mssql
  Include MSSQL-DB support
% --with-fpm
  Enable building of the fpm SAPI executable
% --with-apache
  Build shared Apache 2.0 Handler module
% --with-intl
  Include intl extension
% --with-readline
  Include readline extension
% brew install php --with-mysql --with-apache --with-readline
# php
% vi /etc/apache2/httpd.conf で以下を追加
LoadModule php5_module    /usr/local/Cellar/php/5.3.10/libexec/apache2/libphp5.so
# mysql
% mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
% mysql_install_db

いつも分からなくなるので、以下は、設定ファイル、コマンドなど。

php

/user/local/Cellar/php/5.3.10/etc/php.ini

apache

/etc/apache2/httpd.conf
apachectl start (= /usr/sbin/apachectl start)
apachectl stop (= /usr/sbin/apachectl stop)
apachectl restart (= /usr/sbin/apachectl restart)

mysql

/usr/local/Cellar/mysql/5.5.25/bin/mysqld_safe &
/usr/local/bin/mysql.server start
/usr/local/bin/mysql.server stop
/usr/local/local/bin/mysql.server restart    

phpinfo();にアクセスして確認

f:id:berukann:20120621011804p:plain

想像していた通り、元々macに入っているapache2.2を利用してくれてる。

homebrewすげえええええええ。 とりあえずこんな感じ。