본문 바로가기

리눅스

PHP redis extension 모듈 설치

728x90

PHP redis extension 모듈 설치

phpredis github : https://github.com/phpredis/phpredis/releases

redis 확장 모듈 설치

wget https://github.com/phpredis/phpredis/archive/refs/tags/5.3.4.tar.gz
tar xvfz 5.3.4.tar.gz
cd phpredis-5.3.4
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
$ make install
--output--
Installing shared extensions:     /usr/local/php/lib/php/extensions/debug-zts-20180731/
728x90
cp /usr/local/php/lib/php/extensions/debug-zts-20180731/redis.so /usr/local/php/lib/php/extensions/.

 

echo "extension=redis.so" >> /usr/local/apache2/conf/php.ini

 

/usr/local/php/bin/php -m | grep redis
$ /usr/local/php/bin/php -m | grep redis
redis

 

/usr/local/php/bin/php -r "phpinfo();" | grep redis
$ /usr/local/php/bin/php -r "phpinfo();" | grep redis
redis
redis.arrays.algorithm => no value => no value
redis.arrays.auth => no value => no value
redis.arrays.autorehash => 0 => 0
redis.arrays.connecttimeout => 0 => 0
redis.arrays.consistent => 0 => 0
redis.arrays.distributor => no value => no value
redis.arrays.functions => no value => no value
redis.arrays.hosts => no value => no value
redis.arrays.index => 0 => 0
redis.arrays.lazyconnect => 0 => 0
redis.arrays.names => no value => no value
redis.arrays.pconnect => 0 => 0
redis.arrays.previous => no value => no value
redis.arrays.readtimeout => 0 => 0
redis.arrays.retryinterval => 0 => 0
redis.clusters.auth => no value => no value
redis.clusters.cache_slots => 0 => 0
redis.clusters.persistent => 0 => 0
redis.clusters.read_timeout => 0 => 0
redis.clusters.seeds => no value => no value
redis.clusters.timeout => 0 => 0
redis.pconnect.connection_limit => 0 => 0
redis.pconnect.echo_check_liveness => 1 => 1
redis.pconnect.pool_pattern => no value => no value
redis.pconnect.pooling_enabled => 1 => 1
redis.session.lock_expire => 0 => 0
redis.session.lock_retries => 10 => 10
redis.session.lock_wait_time => 2000 => 2000
redis.session.locking_enabled => 0 => 0
Registered save handlers => files user redis rediscluster
This program is free software; you can redistribute it and/or modify
  • PHP 재시작
/usr/local/apache2/bin/httpd restart

 

  • 확장 모듈 설치 확인

Redis 확장 모듈이 PHP에 정상적으로 설치되었는지 확인하기 위해 PHP phpinfo() 함수를 사용하여 확인할 수 있습니다. 다음과 같은 PHP 스크립트를 생성하고 실행하세요.

<?php
phpinfo();
?>

 

728x90