无法在这个位置找到: head2.htm
当前位置: 建站首页 > 新闻动态 > 行业新闻 >

Mac下配备PHP+Nginx+Redis自然环境

时间:2021-03-27 22:20来源:未知 作者:jianzhan 点击:
Mac下是自身安裝了Apache+PHP的,可是Mac OS版本号每一次变动后都必须再次配备下自然环境,参照:Mac升級系统软件macOS Sierra后PHP不编译程序1.安裝HomebrewMac沒有自带 Homebrew,安裝Homebrew 在终

Mac下是自身安裝了Apache+PHP的,可是Mac OS版本号每一次变动后都必须再次配备下自然环境,参照:Mac升級系统软件macOS Sierra后PHP不编译程序

1.安裝Homebrew

Mac沒有自带 Homebrew,安裝Homebrew 在终端设备实行:

ruby -e "$(curl -fsSL Homebrew/install/master/install)"

假如提醒安裝xcode指令行专用工具,在App Store中免费下载全新Xcode,随后依据提醒安裝xcode指令行专用工具,终端设备键入:

xcode-select --install

取得成功后续续安裝Homebrew

2.安裝Nginx

取得成功安裝brew后,在终端设备实行:

brew install nginx

安裝取得成功后,查询nginx信息内容,在终端设备实行:

< nginx 下列为提醒信息内容: nginx: stable 1.12.2 (bottled), devel 1.13.6, HEAD Docroot is: /usr/local/var/www The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that nginx can run without sudo. nginx will load all files in /usr/local/etc/nginx/servers/. To have launchd start nginx now and restart at login: brew services start nginx Or, if you don't want/need a background service you can just run: nginx

Mac是内置Apache的,和Nginx会矛盾吗?回答不是会,由于默认设置端口号不一样,Apache默认设置80端口号,Nginx默认设置8080端口号
ok,终端设备实行:

sudo nginx

访问器浏览:localhost:8080

Nginx有关指令

//起动 nginx服务
sudo nginx
//再次载入配备|重新启动|终止|撤出 nginx
nginx -s reload|reopen|stop|quit
//检测配备是不是有英语的语法不正确
nginx -t
3.安裝PHP56

macOSX内置PHP,会追随系统软件升級,现阶段macOS v10.13.x 追随PHP早已是PHP7.0,因此大家還是必须安裝PHP56,实行:

brew install php56 --build-from-source

安裝取得成功,提醒:

The php.ini file can be found in:
 /usr//5.6/php.ini
✩✩✩✩ Extensions ✩✩✩✩
If you are having issues with piling, ensure that you are using the brew version, by placing /usr/local/bin before /usr/sbin in your PATH:
 PATH="/usr/local/bin:$PATH"
PHP56 Extensions will piled against this PHP. Please install them using --without-homebrew-php piling against system PHP.
✩✩✩✩ PHP CLI ✩✩✩✩
If you wish to swap the PHP you use mand line, you should add the following to ~/.bashrc, ~/.zshrc, ~/.profile or your shell's equivalent configuration file:
 export PATH="$(brew --prefix 56)/bin:$PATH"
✩✩✩✩ FPM ✩✩✩✩
To launch php-fpm on startup:
 mkdir -p ~/Library/LaunchAgents
 cp /usr/56/homebrew.mxcl.php56.plist ~/Library/LaunchAgents/
 launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
The control script is located at /usr/56-fpm
OS X 10.8 e with php-fpm pre-installed, to ensure you are using the brew version you need to make sure /usr/local/sbin is before /usr/sbin in your PATH:
 PATH="/usr/local/sbin:$PATH"
You may also need to edit the plist to use the correct "UserName".
Please note that the plist was called 'homebrew-php.josegonzalez.php56.plist' in old versions of this formula.
With the release of macOS Sierra the Apache module is now not built by default. If you want to build it on your system you have to install php with the --with-httpd option. See brew options php56 for more details.
To have launchd start 56 now and restart at login:
 brew services start 56

配备php.ini

sudo vim /usr//5.6/php.ini

设定启动起动php-fpm:

mkdir -p ~/Library/LaunchAgents
cp /usr/56/homebrew.mxcl.php56.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist

php56-fpm 起动/终止 :

/usr/56-fpm {start|stop|force-quit|restart|reload|status}

如今大家先实行php56 -v来查询版本号要如何办呢?实行:

sudo ln -s /usr/56/5.6. /usr/56

设定一下标记连接(非常于windows便捷方法) ,如今php56立即偏向了/usr/56/5.6. 【参照连接】Linux自然环境自变量和标记连接
设定进行,查询PHP版本号:

php56 -v
4. 安裝Redis

终端设备实行:

brew search redis
查寻結果:
hiredis 56-redis redis 
53-redis 70-redis redis-leveldb
54-redis 71-redis 
55-redis 72-redis 

随后(留意区别下php的redis拓展)

brew install redis
To have launchd start redis now and restart at login:
 brew services start redis
Or, if you don't want/need a background service you can just run:
 redis-server /usr/local/etc/redis.conf

打开redis:

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

企业网站建设_seo优化_seo_仿站_手机软件开发设计_网页页面制作_营销推广型企业网站建设_互联网营销推广业务外包—武汉市麦芒 - Powered by  鄂ICP备号-1 (责任编辑:admin)
织梦二维码生成器
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
无法在这个位置找到: ajaxfeedback.htm
栏目列表
推荐内容


扫描二维码分享到微信