Redis installation and the Redis extension for PHP

Source: Internet
Author: User

I. Installation and configuration of Redis

1. Official Current source

Https://redis.io/download

2. Extracting source code

Tar zxvf redis-3.2.11.tar.gz

3. Compiling

Make

Once the compilation is complete, ll view the redis.conf file and the src directory, enter SRC to start the installation

4. Installation

CD src

Make install

Deployment of 5.redis

1-p/usr/local/redis/-p/usr/local/redis//lamp/redis-3.0. 7/redis.conf/usr/local/redis//lamp/redis-3.0. 7/SRCMV mkreleasdhdr.sh redisredis-check-dump redis-cli redis-server/usr/local/redis/ Bin
Redis-check-dump: This file I have not found here;

6. Execute the redis-server command to start the Redis service

This is a pre-boot, and the Redis shuts down when it's closed.

7. Background Start Redis

First edit the Conf file, change the Daemonize property to Yes (indicating that you need to run in the background)

Start: redis-server/usr/local/redis/etc/redis.conf

A. Check whether the port is occupied;
[Email protected] src]# NETSTAT-TUNPL | grep 6379
TCP 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 8440/./bin/redis-se

B. See if Redis is enabled

[Email protected] src]# Ps-ef|grep Redis
Root 8440 1 0 12:13? 00:00:00./bin/redis-server 127.0.0.1:6379
Root 8468 5302 0 12:27 pts/1 00:00:00 grep redis

8. After the server starts successfully, execute REDIS-CLI to start the Redis client

[[email protected] src]# redis-CLI127.0. 0.1:6379set  name Vicok127.0. 0.1:6379get  name"Vic"127.0. 0.1:6379> exit[[email protected] src]#

Reference: http://www.cnblogs.com/wangchunniu1314/p/6339416.html

Two. The Redis extension for PHP

: Http://pecl.php.net/package/redis

1. Installation Method:

A. Direct: Copy files directly to the extension directory to open the appropriate extension
B. Compiling the installation: compiling

2. Steps

A. Executive Phpize
Execute phpize in your unzip extension directory
/usr/local/php/bin/phpize
B. Configuring compilation parameters
The main configuration is the PHP configuration file parameters
./configure--with-php-config=/usr/local/php/bin/php-config
C. Compiling and installing
Make && make install
D. Copying extension files to the corresponding directory
E. Turn on extensions, configure corresponding extension parameters
F. Restart PHP-FPM

Expansion of the 3.redis

A. Download the Redis extension for PHP
wget http://pecl.php.net/get/redis-3.1.4.tgz
B. Unzip
Tar zxvf redis-3.1.4.tgz
C. Implementation of the Phpize
Enter the extracted directory; Execute/usr/local/php/bin/phpize
D. Compiling the installation
./configure--with-php-config=/usr/local/php/bin/php-config
Make && make install
E. Open
Vim php.ini Modification
Extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/"
Extension=redis.so
F. Testing
$redis=new$res=$redis->connect (' 127.0.0.1 ', 6379   Var_dump($res);

Returns True, the installation was successful;

Reference: http://www.imooc.com/video/13452

Redis installation and the Redis extension for PHP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.