mac-Installing Redis

Source: Internet
Author: User
Tags curl fpm install redis redis server

1. Installing homebrew

  1. What is homebrew?

    Official explanation:
    Homebrew is the simplest and most flexible way to install UNIX tools that Apple does not include in MacOS.
    Official website: Portal
    Git repository Address: Portal

  2. How do I install the
  3. Homebrew? How to uninstall?

    • Install, open terminal, copy and paste, about 1 minutes, download complete, the process need to enter a password, other do not need any action:
    /usr/bin/ruby -e  "$ (Curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/install) "    
    • 1
    • Uninstall, install will have to uninstall, open Terminal, copy and paste:  
      actually only use the above installation Install and Replace with uninstall on the line.
    /usr/bin/ruby -e " $ (Curl-fssl https:// Raw.githubusercontent.com/homebrew/install/master/uninstall) "    
    • 1
  4. How to use Homebrew? What are the common commands?

    list更新Homebrew,如:brew update
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
  5. Homebrew Build complete diagram

Attention:

Due to network reasons, may not be successful, please try a few more times, until the successful installation.

In the middle there will be a press return to the continue or any other key to abort, please enter in time, and input the password, do not wait silly ...

Don't add sudo, it doesn't matter, you will be prompted to do not run as root

If a package is causing the installation to fail, you only need to follow the instructions to

When you see the following content

? Indicates that the installation has completed successfully.

==================================== installation redis==================================

Installing Redis with homebrew can reduce the amount of installation and configuration effort.

First, the installation of Redis
brew install redis

Message after installation is complete

Boot up Redis command

ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents

Starting Redis server with Launchctl

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

To start Redis server using a configuration file

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

Stop the Redis server from booting

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

Location of Redis configuration files

/usr/local/etc/redis.conf

Uninstalling Redis and its files

brew uninstall redis rm ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

Test if Redis server is started

redis-cli ping
Second, after the installation of Redis, then install the Phpredis extension (all installed on the MAC)
#这里根据你的PHP版本决定,我的是php70,所以安装php70的扩展

Edit your php.ini and add the following code to the end:

extension=redis.so

Restart your php-fpm.

sudo killall php-fpm #关闭php-fpm
    1. This is the way I start php-fpm.
    2. Cd/usr/local/cellar/php70/7.0.26_18/sbin/sudo
    3. ./php70-fpm Start

Check if there is a redis extension

php -m | grep redis

Last PHP test code:

    1. <?php
    2. $redis = new Redis ();
    3. $redis->connect (' 127.0.0.1 ', 6379);
    4. $redis->set (' test ', '11111111111 ');
    5. $result = $redis->get (' test ');
    6. Var_dump ($result);

The browser shows that the installation was successful:

mac-Installing Redis

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.