Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
24
Help us understand the problem. What is going on with this article?
@intemous9

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

More than 5 years have passed since last update.

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

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

24
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
intemous9
主に作業ログとして

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
24
Help us understand the problem. What is going on with this article?