Heim  >  Artikel  >  Backend-Entwicklung  >  So installieren Sie PHP7 FPM auf einem Mac

So installieren Sie PHP7 FPM auf einem Mac

藏色散人
藏色散人Original
2022-01-18 09:44:183666Durchsuche

mac安装php7 fpm的方法:1、安装Homebrew;2、通过“brew install php@7.1”安装PHP7.1;3、加载启动PHP-FPM;4、安装Nginx;5、安装扩展即可。

So installieren Sie PHP7 FPM auf einem Mac

本文操作环境:macOS10.15系统、PHP7.1版、macbook pro 2020电脑

Mac下安装MNMP(Nginx+PHP7)环境

安装Homebrew

打开终端输入

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

之后就可以使用

brew install ****

来安装所需要的依赖了。


安装PHP7.1(FPM方式)

brew install php@7.1

由于OSX已经自带了PHP环境,因此需要修改系统路径,优先运行brew安装的版本,在~/.bashrc里加入:

export PATH="/usr/local/bin:/usr/local/sbin:$PATH"

PHP-FPM的加载与启动

安装完毕后可以通过以下指令启动和停止php-fpm

php-fpm -D
killall php-fpm

安装Nginx

brew install nginx

安装完毕后可以通过

nginx
nginx -s quit

启动和关闭,同时也支持重载配置文件等操作

nginx -s reload|reopen|stop|quit

此时启动了php-fpm并且启动了Nginx后,就可以通过http://localhost来运行php程序了


安装扩展

使用pecl的方式安装

/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

安装好后直接使用,不需要配置php.ini文件(已经自动配置好了^_^)。

推荐学习:《PHP视频教程

Das obige ist der detaillierte Inhalt vonSo installieren Sie PHP7 FPM auf einem Mac. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn