23
24

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CentOS6.4にmemcachedをインストールしPHPで利用できるようにするまで

Posted at

CentOS6.4にmemcachedをインストールし、phpで利用できるまで。

最初に、yumパッケージにはmemcachedが入っていなかったので、rpmを追加

rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

memcachedの追加

yum install memcached

またpeclでmemcacheをインストールする際に必要となるパッケージを追加

yum install php-pecl-memcached
yum install gcc
yum install automake
yum install autoconf
yum install libtool
yum install make
yum install zlib-devel

また、peclでmemcacheを入れる際に、warning出たので回避のためre2c追加

cd /usr/local/src/
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
rpm -Uvh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

#指定して使用するようにデフォルトは無効とする
vi /etc/yum.repos.d/rpmforge.repo

# 設定のenabledを0に
enabled = 0

re2cインストール

yum --enablerepo=rpmforge install re2c

memcacheインストール

pecl install memcache

起動設定

/etc/init.d/memcached start
chkconfig memcached on

これで、phpでmemcacheを利用出来るようになりました。

# php -i | grep memcache

/etc/php.d/memcached.ini,
memcache
memcache support => enabled
memcache.allow_failover => 1 => 1
memcache.chunk_size => 8192 => 8192
memcache.default_port => 11211 => 11211
memcache.default_timeout_ms => 1000 => 1000
memcache.hash_function => crc32 => crc32
memcache.hash_strategy => standard => standard
memcache.max_failover_attempts => 20 => 20
memcached
memcached support => enabled
libmemcached version => 0.31
Registered save handlers => files user memcache memcached

後は環境に合わせて設定の変更を行なう。

23
24
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
23
24

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?