Install Homebrew
Open the terminal and enter
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
, then you can use
brew install ****
to install what you need Depend on it.
Install PHP7.1 (FPM method)
brew install php@7.1
Since OSX already comes with its own PHP environment, you need to modify the system path and run the version installed by brew first. In Add to ~/.bashrc
:
export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
Loading and starting of PHP-FPM
After installation, you can start and stop php-fpm through the following commands
php-fpm -D killall php-fpm
Install Nginx
brew install nginx
After installation, you can start and shut down through
nginx nginx -s quit
, and also support operations such as reloading configuration files
nginx -s reload|reopen|stop|quit
Start at this time After installing php-fpm and starting Nginx, you can run the php program through http://localhost
Install the extension
Use pecl to install
/usr/local/Cellar/php\@7.1/7.1.23/pecl install redis /usr/local/Cellar/php\@7.1/7.1.23/pecl install mongodb /usr/local/Cellar/php\@7.1/7.1.23/pecl install memcahced
Use it directly after installation. There is no need to configure the php.ini file (it has been automatically configured^_^).