본문 바로가기

리눅스

PHP Redis 확장(Extension) 모듈을 설치하는 방법

728x90

PHP Redis 확장(Extension) 모듈을 설치하는 방법

redis server 설치

sudo yum install -y gcc gcc-c++ make jemalloc tcl
sudo yum install -y redis
systemctl --now enable redis
redis-cli -h 127.0.0.1 -p 6379 ping

redis extension 모듈 설치

phpredis 패키지 다운로드

wget https://github.com/phpredis/phpredis/archive/develop.zip
unzip develop.zip
cd phpredis-develop

phpredis 소스 코드 컴파일 및 설치

/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

php 확장 모듈 디렉토리 확인

/usr/local/php/bin/php -i | grep extension_dir
$ /usr/local/php/bin/php -i | grep extension_dir
extension_dir => /usr/local/php/lib/php/extensions/debug-zts-20180731/ => /usr/local/php/lib/php/extensions/debug-zts-20180731/
sqlite3.extension_dir => no value => no value

redis 확장 모듈을 추가(php.ini 편집)

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

redis 모듈 확인

 /usr/local/php/bin/php -m | grep redis
 /usr/local/php/bin/php -i | grep redis
 /usr/local/php/bin/php -r "phpinfo();" | grep redis

웹 서버 재시작

/usr/local/apache2/bin/apachectl restart

 

참고URL

- https://github.com/phpredis/phpredis

 

728x90