http://d.hatena.ne.jp/okonomi/20110501/1304256929
参考に。
# http://d.hatena.ne.jp/okonomi/20110501/1304256929 のものだと、リダイレクトを促すページのHTMLを取得するので
curl -O https://raw.github.com/ampt/homebrew/php/Library/Formula/php.rb
mv php.rb `brew --prefix`/Library/Formula
brew install php --with-mysql --with-apache --with-intl
intl はSymfony2で遊ぶのに必要
…エラーでた make[1]: *** [install-pear-installer] Segmentation fault: 11
の部分
pear のインストールでこけてるらしい
==> Installing php
==> Downloading http://www.php.net/get/php-5.3.10.tar.bz2/from/this/mirror
Already downloaded: /Users/tenkoma/Library/Caches/Homebrew/php-5.3.10
==> Patching
patching file ext/tidy/tidy.c
==> ./configure --prefix=/usr/local/Cellar/php/5.3.10 --disable-debug --with-config-file-path=/usr/local/Cellar/php/5.3.1
==> make
==> make install
Installing PHP SAPI module: apache2handler
Installing PHP CLI binary: /usr/local/Cellar/php/5.3.10/bin/
Installing PHP CLI man page: /usr/local/Cellar/php/5.3.10/share/man/man1/
/usr/share/httpd/build/instdso.sh SH_LIBTOOL='/usr/share/apr-1/build-1/libtool' libs/libphp5.so /usr/local/Cellar/php/5.3.10/libexec/apache2
Installing build environment: /usr/local/Cellar/php/5.3.10/lib/php/build/
/usr/share/apr-1/build-1/libtool --mode=install cp libs/libphp5.so /usr/local/Cellar/php/5.3.10/libexec/apache2/
libtool: install: cp libs/libphp5.so /usr/local/Cellar/php/5.3.10/libexec/apache2/libphp5.so
Warning! dlname not found in /usr/local/Cellar/php/5.3.10/libexec/apache2/libphp5.so.
Assuming installing a .so rather than a libtool archive.
chmod 755 /usr/local/Cellar/php/5.3.10/libexec/apache2/libphp5.so
[activating module `php5' in /private/etc/apache2/httpd.conf]
unable to open configuration file
Installing helper programs: /usr/local/Cellar/php/5.3.10/bin/
program: phpize
program: php-config
Installing man pages: /usr/local/Cellar/php/5.3.10/share/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /usr/local/Cellar/php/5.3.10/lib/php/
make[1]: *** [install-pear-installer] Segmentation fault: 11
make: *** [install-pear] Error 2
make: *** Waiting for unfinished jobs....
Installing header files: /usr/local/Cellar/php/5.3.10/include/php/
config.log was copied to /Users/tenkoma/Library/Logs/Homebrew
==> Exit Status: 2
http://github.com/mxcl/homebrew/blob/master/Library/Formula/php.rb#L168
==> Environment
HOMEBREW_VERSION: 0.8.1
HEAD: 2f5248f36f6ff292e3e68c09c96693b226ac3ccd
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
Hardware: dual-core 64-bit penryn
OS X: 10.7.3
Kernel Architecture: i386
Xcode: 4.3.1
GCC-4.0: N/A
GCC-4.2: build 5666
LLVM: build 2336
Clang: 3.0 build 211
MacPorts or Fink? false
X11: /usr/X11
System Ruby: 1.8.7-249
/usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Which Perl: /usr/bin/perl
Which Python: /usr/bin/python
Which Ruby: /Users/tenkoma/.rbenv/shims/ruby
==> Build Flags
CC: /usr/bin/clang
CXX: /usr/bin/clang++ => /usr/bin/clang
LD: /usr/bin/clang
CFLAGS: -w -pipe -march=native -Qunused-arguments -O3
CXXFLAGS: -w -pipe -march=native -Qunused-arguments -O3
CPPFLAGS: -I/usr/local/Cellar/icu4c/4.8.1.1/include -I/usr/local/Cellar/readline/6.2.2/include -I/usr/local/Cellar/gettext/0.18.1.1/include -I/usr/local/Cellar/libxml2/2.7.8/include -I/usr/X11/include
LDFLAGS: -L/usr/local/Cellar/icu4c/4.8.1.1/lib -L/usr/local/Cellar/readline/6.2.2/lib -L/usr/local/Cellar/gettext/0.18.1.1/lib -L/usr/local/Cellar/libxml2/2.7.8/lib -lstdc++ -L/usr/X11/lib
MAKEFLAGS: -j2
PKG_CONFIG_PATH: /usr/local/Cellar/icu4c/4.8.1.1/lib/pkgconfig:/usr/local/Cellar/libxml2/2.7.8/lib/pkgconfig
Error: Failed executing: make install
If `brew doctor' does not help diagnose the issue, please report the bug:
https://github.com/mxcl/homebrew/wiki/checklist-before-filing-a-new-issue
先にMac OS X 10.7.3 にアップグレードしたことが影響したのかを疑ったが、原因は Xcode 4.3 をインストールしたことらしい
http://mogutan.wordpress.com/2012/02/18/trouble-installing-xcode4-3/
以下のコマンドは、10.7.3 の影響を疑ったときに実行したコマンド
おそらく上の方はXcode 4.2以前用だと思うので、下の方だけでOKだと思う。
sudo xcode-select -switch /Developer
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
一応以下のコマンドも実行した
sudo chown -R $USER /usr/local
sudo chown -R $USER /usr/local/.git
その後で --use-llvm オプション付きでインストールしたらうまくいった
brew install --use-llvm php --with-mysql --with-apache --with-intl
% brew install --use-llvm php --with-mysql --with-pgsql --with-apache --with-intl tenkoma@Tanaka-Koji-no-MacBook-Air
==> Downloading http://www.php.net/get/php-5.3.10.tar.bz2/from/this/mirror
Already downloaded: /Users/tenkoma/Library/Caches/Homebrew/php-5.3.10==> Patching
patching file ext/tidy/tidy.c==> ./configure --prefix=/usr/local/Cellar/php/5.3.10 --disable-debug --with-config-file-path=/usr/local/Cellar/php/5.3.1
==> make
==> make install
==> cp ./php.ini-production /usr/local/Cellar/php/5.3.10/etc/php.ini
==> chmod 644 /usr/local/Cellar/php/5.3.10/lib/php/.lock
==> Caveats
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php5_module /usr/local/Cellar/php/5.3.10/libexec/apache2/libphp5.so
The php.ini file can be found in:
/usr/local/Cellar/php/5.3.10/etc/php.ini
==> Summary
/usr/local/Cellar/php/5.3.10: 479 files, 28M, built in 11.8 minutes
あとは
LoadModule php5_module /usr/local/Cellar/php/5.3.10/libexec/apache2/libphp5.so
を /etc/apache2/httpd.conf に追記して、
Include /etc/apache2/extra/httpd-vhosts.conf のコメントアウトをはずす。
/etc/apache2/extra/httpd-vhosts.conf にVirtualHost設定を書く。
システム環境設定からWeb共有をONにしてやる。
で見られるようになった。