Before installing Phpredis, install Redisbefore installing the Phpredis plugin.
1. Download and install
On the Linux server, the command line executes the following command (CD./usr LOCAL/SRC General source code is here (recommended source installation))
wget https://github.com/nicolasff/phpredis/archive/2.2.4.tar.gztar zxvf phpredis-2.2. 4 . TAR.GZCD Phpredis-2.2. 4/usr/local/php5.5.30/bin/phpize
./configure--with-php-config=/usr/local/php5.5.30/bin/php-config
Make make Install
Description
wget: Download the remote file to the local current folder.
Tar xzf: Unzip the file to the current folder directory
CD: Go to Folder
/usr/local/php/php5.5.30/phpize generating Configure configuration files with Phpize
./configure--with-php-config=/usr/local/php5.5.30/bin/php-config Configure PHP so that it can use Redis
Make make install: Install Redis
Error message:
If you generate configure configuration file with Phpize error:cannot find autoconf. The configuration PHP will be error:./configure no file or directory
Workaround:
Execute the following command
wget http://ftp.gnu.org/gnu/m4/m4-1.4.9.tar.gztar-zvxf m4-1.4. 9 . TAR.GZCD M4-1.4. 9/. /configure && make && make installcd. /wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.62.tar.gztar-zvxf autoconf- 2.62. TAR.GZCD autoconf-2.62/. /configure && make && make install
Install successfully, you can see the following folder (remember this folder name may not be the same, but the same format no-debug-zts-20121212)
/usr/local/php5.5.30/lib/php/extensions/no-debug-zts-20121212/
2, Configuration Phpredis
Open PHP config file/usr/local/php/etc/php.ini add code ( reminder to see how much you no-debug-zts-20121212, don't copy ):
" /usr/local/php5.5.30/lib/php/extensions/no-debug-zts-20121212 " extension=redis.so
Then restart Apache:
/usr/local/apache/bin/apachectl restart
The execution of Phpinfo () now shows that the Phpredis installation was successful.
3, simple test using Phpredis plug-in operation Redis
<? PHP New Redis (); $redis->connect ('127.0.0.1'6379); $redis Set ('foo','bar'); Echo $redis Get ('foo');
The output is: Bar
Description Success O (∩_∩) o haha ~
Phpredis installation, configuration and simple use