memcacheしてみよう。
CentOS6 でmemcacheの仮想サーバをたてたので、
僕のMacでPHPを動かしてmemcacheサーバを利用する。
そのためにphpの拡張モジュールのmemcacheをインストールする。
memcacheは、pecl からインストールします。
PECLとは「The PHP Extension Code Library」の略で,C言語などで記述された拡張ライブラリです。
よく耳にする、一度は使ってみたいパッケージが結構あるです。
ちなみにPEARはPHPスクリプトによる拡張ライブラリです。
① install-pear-nozlib.phar を実行して pear をインストール
cd /usr/lib/php/
php ./install-pear-nozlib.phar
bash-3.2# php ./install-pear-nozlib.phar
[PEAR] Archive_Tar - installed: 1.3.7
[PEAR] Console_Getopt - installed: 1.3.0
[PEAR] Structures_Graph- installed: 1.0.4
[PEAR] XML_Util - installed: 1.2.1
[PEAR] PEAR - installed: 1.9.4
Wrote PEAR system config file at: /private/etc/pear.conf
You may want to add: /usr/lib/php/pear to your php.ini include_path
② php.ini に追記
cd /etc
cp php.ini.default php.ini
vim php.ini
include_path = ".:/usr/lib/php/pear"
を追記
③ アップデート
pear channel-update pear.php.net
pecl channel-update pecl.php.net
pear upgrade-all
④ peclでmemcacheをインストール。pearをインストールするとpeclも同時にインストールされるようだ。
bash-3.2# pecl install memcache
downloading memcache-2.2.7.tgz ...
Starting to download memcache-2.2.7.tgz (36,459 bytes)
..........done: 36,459 bytes
11 source files, building
running: phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
ERROR: `phpize' failed
⑤ ④でエラーになったので autoconfをインストール
curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-2.68.tar.gz
tar xzf autoconf-2.68.tar.gz
cd autoconf-2.68
./configure --prefix=/usr/local
make
sudo make install
もっかい④を実行
⑥ phpinfo(); で確認
参考 URL :
http://drewish.com/content/2012/07/drupal_on_mountain_lion_osx
http://wiki.poyo.jp/read/Writing/llm/library/pecl
http://stackoverflow.com/questions/9322742/php-autoconf-errors-on-mac-os-x-10-7-3-when-trying-to-install-pecl-extensions
コメント
コメントを投稿