PHP+Homebrewの設定(APC編)

前回記事に引き続き、PHPのエクステンションをHomebrewでインストールしていきましょう。今回はAPCです。

ただし、そのままでは次のようなエラーが出てしまいます。

[Tue Nov 15 14:12:19 2011] [error] [client 127.0.0.1] PHP Fatal error:  Unknown: apc_fcntl_unlock failed: in Unknown on line 0

これに対し、下記URL中のパッチを当てることにします。

* https://bugs.php.net/bug.php?id=59750

$ brew edit emacs
...
$

これでパッチが当たった状態でビルドされます。

$ brew install apc
Also installing dependencies: pcre
==> Downloading ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.12.tar.bz2
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/pcre/8.12 --enable-utf8 --enable-unicode-properties --enable-pcregrep-libz --ena
==> make test
==> make install
/usr/local/Cellar/pcre/8.12: 111 files, 2.8M, built in 59 seconds
==> Downloading http://pecl.php.net/get/APC-3.1.9.tgz
######################################################################## 100.0%
==> phpize
==> ./configure --prefix=/usr/local/Cellar/apc/3.1.9
==> make
==> Caveats
To finish installing APC:
 * Add the following lines to php.ini:
    [apc]
    extension="/usr/local/Cellar/apc/3.1.9/apc.so"
    apc.enabled=1
    apc.shm_segments=1
    apc.shm_size=64M
    apc.ttl=7200
    apc.user_ttl=7200
    apc.num_files_hint=1024
    apc.mmap_file_mask=/tmp/apc.XXXXXX
    apc.enable_cli=1
 * Restart your webserver
 * Copy "/usr/local/Cellar/apc/3.1.9/apc.php" to any site to see APC's usage.
==> Summary
/usr/local/Cellar/apc/3.1.9: 2 files, 208K, built in 23 seconds