Linux Xampp 下安裝PHP Redis擴充套件
# cd /usr/local
# wget http://pecl.php.net/get/redis-4.0.1.tgz
# tar -zxvf redis-4.0.1.tgz
# cd redis-4.0.1
# /opt/lampp/bin/phpize-5.6.38
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
這裡會提示沒有autoconf,那麼安裝它
# cd /usr/local
# wget http://mirrors.kernel.org/gnu/autoconf/autoconf-2.65.tar.gz
# tar -xzvf autoconf-2.65.tar.gz
# cd autoconf-2.65
# ./configure && make && make install
安裝完成繼續配置Redis擴充套件
# cd ..
# cd redis-4.0.1
# /opt/lampp/bin/phpize-5.6.38
# ./configure --with-php-config=/opt/lampp/bin/php-config-5.6.38
# make && make install
安裝後會提示擴充套件位置
Installing shared extensions: /opt/lampp/lib/php/extensions/no-debug-non-zts-20131226/
進入檢視一下是否存在redis.so
然後再配置php.ini,位置一般在 /opt/lampp/etc/
查詢;extension="interbase.so",在其下面一行加上
extension="redis.so"
配置成功,重啟Apache,至此PHP可以操作Redis了