Mac has a specific package management tool homebrew, also known as Brew, where the PHP installation is the brew
1 Installing PHP
Brew install [email protected].
BRW installation will automatically manage dependencies, so you don't have to install dependencies first.
After the installation is complete, two echo statements will be used to set the PHP path to the environment variable path.
2 Installing the Redis extension
On the internet for half a day, a lot of people use: Brew Install Php70-redis installed successfully, I have not been successful here, can not find the package. Later, it was installed with the source code, see the following steps:
Download Php-redis, Address: Https://nodeload.github.com/nicolasff/phpredis/zip/master
Extract:tar -zxvf phpredis-master.zip
Access directory: CD Phpredis-master
Execute phpize:/usr/local/cellar/php\@7.0/7.0.29_1/bin/phpize//Note here is the PHP phpize you want to install
Compile:./configure --with-php-config=/usr/bin/php-config // 如果只有一个php就直接./configure;如果有多个php版本就选需要安装扩展的那个php-config
Installation: Make && make install
Add extension to profile: Open php config file/etc/php.ini, add codeextension=redis.so (如果找不到php.ini文件执行php --ini找到php.ini)
Then restarting FPM has the redis extension.
Mac installs PHP and Redis extensions