CentOS7 Installing the Redis database and Php-redis extensions

Source: Internet
Author: User
Tags download redis install php php redis install redis

Redis
First install Redis to the server
1.wget http://download.redis.io/redis-stable.tar.gz Download Redis source code


2. Tar xvzf redis-stable.tar.gz Decompression


3.CD redis-stable


There may be a problem with 4.make make, and I have an exception.




Exception One:


MAKE[2]: Cc:command not found


Exception reason: GCC is not installed


Solution: Yum Install gcc-c++


Exception Two:


Zmalloc.h:51:31:error:jemalloc/jemalloc.h:no such file or directory


Exception reason: Some compiler dependencies or original compilation legacy problems


Solution: Make Distclean. Clean it up and make it again.


5.cd src make finished, enter SRC


6.make test I ran into an exception, a.


Exception A:


Couldn ' t execute ' tclsh8.5″: No such file or directory


Exception reason: Tcl not installed


Solution: Yum install-y tcl


7. After make is successful, there are some more executables in the SRC directory: Redis-server,redis-cli and so on.


Use the CP command to copy to the USR directory to run.
CP redis-server/usr/local/bin/
CP redis-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


Locate the profile template in the Redis solution directory and copy it to the following location.


CP redis.conf/etc/redis/6379.conf


Modify with vim command




Daemonize Yes is set service running in the background


Pidfile/var/redis/run/redis_6379.pid #设置pid文件
Logfile/var/redis/log/redis_6379.log #设置log文件的保存
dir/var/redis/6379 #设置文件夹




8.redis-server/etc/redis/6379.conf Running Redis




9. Use Telnet to test for installation and startup success:
Direct Input REDIS-CLI
If 127.0.0.1:6379&gt appears, the installation is successful




Redis Run successfully


Next, install the Redis extension for PHP


1.wget https://codeload.github.com/nicolasff/phpredis/zip/master Download Extension


2.unzip Master Decompression


CD Phpredis-master entry


3./usr/bin/phpize View information (environment is not the same, phpize location is not the same, it is best to Whereis phpize find the file location),
If you quote can ' t find PHP headers in/usr/include/php, first install yum install Php-devel


4./configure PS: My PHP is installed by default, if your PHP is not the default installation needs to specify the--with-php-config parameter to indicate where your Php-config file is located,
This can be found by using Find Oh ~ For example mine is like this./configure--with-php-config=/usr/bin/php-config


5.make && make install PS: here to pay attention to your users and permissions Oh ~


6.vim/etc/php.ini Adding a redis extension configuration


7. Locate the Extension_dir location below to add the following: extension=redis.so


8. Restart Apache #systemctl Restart Httpd.service


9. Test whether the PHP Redis extension was installed successfully:


<?php
$redis = new Redis ();
$redis->connect (' 127.0.0.1 ', 6379);
$redis->set (' Test ', ' Hello world! ');
echo $redis->get (' Test ');
?>


If the successful output of Hello world! is successful. PS, if not, you can temporarily shut down the firewall!

This is my reference to fly Hi article and personally in the CENTOS7 under the experimental installation, the effect is good! This process is roughly similar to his.

But in the process of installation will encounter other problems, this word, you can Baidu under the reference to the answer. Because of the problems that arise

are relatively simple, so there is no record! If there is anything you do not understand, you can contact me!


SOURCE statement: Fly hi? CentOS7 Installing the Redis database and Php-redis extensions (http://blog.feehi.com/linux/88.html)

Copyright: Hello, very happy to meet you on the CSDN! Hope to make friends with you!

CentOS7 Installing the Redis database and Php-redis extensions

Related Article

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.