Installing php Redis Extension Notes under Fedora
- 2021-07-16 01:59:31
- OfStack
1. Install the compiler tool
yum install wget make gcc gcc-c++ zlib-devel openssl openssl-devel pcre-devel kernel keyutils patch perl
2. Install redis php-redis
# yum install redis php-redis
So the installation is successful
Start redis
# sudo redis-server /etc/redis.conf
1. Download the php-redis zip installation package
https://github.com/nicolasff/phpredis
2. Find the PHP installation path
Command whereis phpize and whereis php-config to find phpize and php-config paths
3. Generate configure
# /usr/bin/phpize
4. Compile and install
# ./configure --with-php-config=/usr/bin/php-config
# make && make install
5. Add the installed redis. so module
# vim /etc/php.ini
6. Restart apache or nginx
7. Test
$redis = new Redis();
$redis->connect('127.0.0.1',6379);
$redis->set('test','hello world!');
echo $redis->get('test');