1 [PHP] View plaincopy on code to see a snippet derived from my Code slice2 installing Redis and PHP Redis extensions under Linux3 4Environment configuration: CENTOS6.0nginx/1.0.0php/5.3.8mysql/5.5. - 5 6 Step one, download Redis7can go to http://redis.io/to download the latest version8I'm using Redis.2.8. One 9Go to the Software installation package storage directory: cd/var/Install/software/Ten wgethttp//download.redis.io/redis-stable.tar.gz One A - Step Two, compile the source program - TarXvzf redis-stable.Tar. GZ theCD redis-Stable - Make - Make Install - if make has an exception: + 1) Make[2]:cc: Command not found - exception Reason: GCC is not installed +Solution:Yum Install GCC-c++ A 2) Zmalloc.h:Wuyi: to: Error:jemalloc/jemalloc.h:no Suchfileor directory at exception Reason: Some compiler dependencies or original compilation legacy problems -Solution: MakeDistclean. Clean it up and make it again. - - after make is successful, make test is required to have an exception in make Test - 1) couldn't Execute "tclsh8.5": No such file or directory - exception Reason: Tcl not installed inSolution:Yum Install-y tcl. - toAfter the make command completes, 5 executables are generated in the SRC directory, namely Redis-server, REDIS-CLI, Redis-benchmark, redis-check-aof, redis-check-dump, their role is as follows: +redis-Server:redis Server Daemon startup program -redis-Cli:redis Command-line operation tool. Of course, you can also use Telnet to operate on its plain text protocol. theredis-Benchmark:redis Performance testing tools to test the read and write performance of Redis in your system and in your configuration *redis-check-aof: Update log Check $ Panax Notoginsengredis-check-dump: For local database checking - the + step three, configure A CPredis-server/usr/local/bin/ the CPredis-cli/usr/local/bin/ + then create a new directory, store the configuration file - mkdir/etc/Redis $ mkdir/var/Redis $ mkdir/var/redis/Log - mkdir/var/redis/Run - mkdir/var/redis/6379 the - Locate the profile template in the Redis solution directory and copy it to the following location. Wuyi CPredis.conf/etc/redis/6379. conf through the VIM command to modify the daemonize Yes -pidfile/var/redis/run/Redis_6379.pid Wulogfile/var/redis/log/Redis_6379.log - dir/var/redis/6379 About Finally, run Redis: $$ redis-server/etc/redis/6379. conf - - available NETSTAT–ATLN View port is a successful boot installation -<span style="White-space:pre"> "http://img.blog.csdn.net/20140617151010218?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaV9icnVjZQ==/font/ 5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/southeast"alt=""/></span> A step Four, Operation Redis database +#./redis-CLI the"http://img.blog.csdn.net/20140617150954812?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaV9icnVjZQ==/font/ 5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/southeast"alt=""/> - Let's take a brief look at the database. In case the instance is turned on: $ 1, inserting Data theRedis127.0.0.1:6379>Set name WWL the OK theSet up a key-value pair. the 2, query data -Redis127.0.0.1:6379>Get name in "WWL" the Remove the value corresponding to the key. the About 3, delete key values theRedis127.0.0.1:6379>del name the Delete this key and the corresponding value. the 4, verify that the key is present +Redis127.0.0.1:6379>exists name -(integer)0 the 0, which means that the key does not exist; 1 stands for existence. Bayi the the - step Five, download the Phpredis extension -To download HTTPS first://github.com/nicolasff/phpredis/downloads the#wgetHttps//github.com/nicolasff/phpredis/downloads the#Tar-ZXVF nicolasff-phpredis-2.1.3-124-gd4ad907.Tar. GZ the#MVnicolasff-phpredis-d4ad907 php-5.3.8/ext/phpredis/ the# CD php-5.3.8/ext/phpredis/ -#/usr/local/php/bin/phpize the#./configure--with-php-config=/usr/local/php/bin/php-Config the# Make&& Make Install the 94 Configure PHP.ini the VI/usr/local/php/lib/php.ini the (join: theextension=redis.so98 ) AboutLet's see if we have extension_dir=/.... .. -Restart Apache or nginx (reload PHP--->/etc/init.d/php-fpm Restart)101 102 To the normal situation, you can see the redis extension with Phpinfo103If Phpinfo does not have Redis extension information, add/etc/php.d/Redis.ini (path is my local)104 Redis.ini content is as follows: the ; Enable MySQL Extension Module106extension=redis.so107Restart Apache or nginx (reload PHP--->/etc/init.d/php-fpm restart)
Installing Redis and PHP Redis extensions under Linux