0
2

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 3 years have passed since last update.

Redisとphpredisのインストール

Posted at

Redisのインストール

Redis5.05をダウンロードして解凍する

$ wget http://download.redis.io/releases/redis-5.0.5.tar.gz
$ tar -xvf /home/ec2-user/redis-5.0.5

makeするためのツールをインストール

$sudo yum install tcl-devel
$sudo yum install gcc
$sudo yum install make

makeしてインストール

$cd /home/ec2-user/redis-5.0.5/deps
$sudo make hiredis jemalloc linenoise lua geohash-int
$cd ..
$sudo make install

makeコマンドが完了すると、/usr/local/binにRedisバイナリが作成されてます。

Redisが動くか確認する

$ redis-server
$ redis-cli

phpredisのインストール(AmazonLinux2でPHP7.3の場合)

Remiリポジトリのインストール

$ amazon-linux-extras enable epel
$yum install epel-release
$yum install http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

redisモジュールの存在を確認

$sudo yum list | grep php73 | grep redis
php73-php-pecl-redis4.x86_64           4.3.0-1.el7.remi               remi-safe
php73-php-pecl-redis5.x86_64           5.1.1-1.el7.remi               remi-safe
php73-php-phpiredis.x86_64             1.0.0-10.el7.remi              remi-safe

php73-php-pecl-redis5をインストールする

$ sudo yum install php73-php-pecl-redis5

シンボリックリンクを張る

sudo ln -s /opt/remi/php73/root/usr/lib64/php/modules/redis.so /usr/lib64/php/modules/redis.so
sudo ln -s /opt/remi/php73/root/usr/lib64/php/modules/igbinary.so /usr/lib64/php/modules/igbinary.so
sudo ln -s /opt/remi/php73/root/usr/lib64/php/modules/msgpack.so /usr/lib64/php/modules/msgpack.so

iniファイルのコピー

sudo cp /etc/opt/remi/php73/php.d/50-redis.ini /etc/php.d/50-redis.ini
sudo cp /etc/opt/remi/php73/php.d/40-igbinary.ini /etc/php.d/40-igbinary.ini
sudo cp /etc/opt/remi/php73/php.d/40-msgpack.ini /etc/php.d/40-msgpack.ini

webサーバ(Apaceh)を再起動して適用する

sudo systemctl restart httpd

phpでphpredisが読み込まれているか確認するコマンド

php -m | grep redis
0
2
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
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?