반응형
OS : CentOS7
PHP : 7.3.23
phpredis : 5.3.4
Redis : 6.2.1
phpredis install
----------------------------------설치파일 있다고 가정----------------------------------
tar xzvf phpredis-5.3.4.tar.gz
cd /usr/local/src/phpredis-5.3.4
/usr/local/php/bin/phpize
./configure
make && make install
--------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------
vi /etc/php.ini (아래 추가)
[redis]
extension=/usr/local/php-7.3.23/lib/php/extensions/no-debug-zts-20180731/redis.so
session.save_handler = redis
session.save_path = "tcp://127.0.0.1:6379"
--------------------------------------------------------------------------------------
------------------------------------Apache restart------------------------------------
/usr/local/apache/bin/apachectl restart
--------------------------------------------------------------------------------------
-----------------------------------#redis 모듈 확인-----------------------------------
[root@dongtaek phpredis-5.3.4]# php -i | 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
session.save_handler => redis => redis
PWD => /usr/local/src/phpredis-5.3.4
$_SERVER['PWD'] => /usr/local/src/phpredis-5.3.4
This program is free software; you can redistribute it and/or modify
--------------------------------------------------------------------------------------
Redis 테스트 Source
<?php
//redis test source
$redis_host ="127.0.0.1";
$redis_port = 6379;
echo "<h1>Redis TEST<h1><br/>";
try {
$redis =new Redis();
$redis->connect($redis_host,$redis_port, 1000);
$key ="mytest:first_key:incr_test";
$value =$redis->get($key);
echo "value : ".$value."<br>";
$redis->incr($key);
$redis->expire($key, 2);//2초 유지
}catch(Exception$e) {
die($e->getMessage());
}
?>
반응형
'👨🏻💻Infra > 🟦WEB & WAS' 카테고리의 다른 글
Apache Log4j 2.16.0 업데이트 방법 (Log4j 2.12.2 포함) (0) | 2021.12.15 |
---|---|
Apache Log4j2 취약점 해결방법 (0) | 2021.12.12 |
Apache client denied by server configuration (0) | 2020.12.15 |
PHP7 SSH2 (0) | 2020.10.27 |
PHP7 opcache 설정 (0) | 2020.10.14 |