[PHP Plugin Tutorial]003.phpredis

Source: Internet
Author: User
Tags install redis

Phpredis

    • Introduced
    • Mac installation Steps
      • Installing Redis
      • Installing Phpredis
    • Sample code
Introduced
    • Redisis a high-performance Key-value database.
    • RedisClients such as Java,c/c++,c#,php,javascript,perl,object-c,python,ruby,erlang are provided.
    • Now, let's talk about<如何在Mac上安装PhpRedis>
Mac installation steps to install Redis
    1. DownloadRedis
      Address http://download.redis.io/releases/redis-3.0.3.tar.gz
    2. Compile and start (execute the following command sequentially in the unpacked directory)

       Make sudo  Make Install Redis-server

    3. Test

       shell$ redis-cli 127.0.0.1:6379> set name zergling OK 127.0.0.1:6379> get name "zergling"
Installing Phpredis
  1. Download FirstPhpRedis
    GitHub Address: Https://github.com/nicolasff/phpredis
  2. Compile the installation (execute the following command sequentially in the unpacked directory)

    • 默认php环境

        phpize  . /configure--with-php-config=/usr/bin/php-config  sudomake  sudo  makeInstall

    • xampp环境(Modify the corresponding PHP command path)

        /applications/xampp/xamppfiles/bin/phpize  . /configure--with-php-config=/applications/xampp/xamppfiles/bin/php-config  sudo  make  sudomakeinstall

    • The phpize following error may occur when executing

       Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable.

      Workaround (Installed brew direct execution of the second sentence)

      " $ (curl-fssl https://raw.github.com/Homebrew/homebrew/go/install) "  Install autoconf

  3. Modifyphp.ini
    /ect/php.ini(Default environment)
    /Applications/XAMPP/xamppfiles/etc/php.ini(XAMPP Environment)

    At the end of the add

     extension=redis.so
  4. Restart Apache

  5. Verify

    php-m | grep  /applications/xampp/bin/php-m | grep Redis

    Appears to redis indicate successful installation

Sample code
<? PHP $redis New Redis (); $redis->connect (' 127.0.0.1 ', 6379); $redis->set (' name ', ' zergling '); Echo $redis->get (' name ');   

This site article is for baby bus SD. Team Original, reproduced must be clearly noted: (the author's official website: Baby bus )
Reprinted from "Baby bus Superdo Team" original link: http://www.cnblogs.com/superdo/p/4726430.html

[PHP plugin tutorial]003.phpredis

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.