mac ox 10.11 brew安装Nginx+PHP+MySQL+扩展
来源:互联网 发布:黄金价格数据 编辑:程序博客网 时间:2024/05/17 09:20
安装brew
要求:OS X 10.6以上系统,并且安装有XCode命令行工具
对于10.11的系统需要设置下local的权限为当前用户
$ sudo chown -R $(whoami):admin /usr/local
brew安装程序的过程中需要用到苹果的xcode中的 编译器,你可以到苹果的官网中免费下载安装(需要注册免费的开发者,然后才能下载),安装后到属性(Xcode – Perference–Downloads–Components–Command Line Tools)点击下载就可以了,这里使用命令安装
xcode-select --install
进入到 /usr/local 然后执行代码安装brew,本来想使用官网的那个ruby的命令安装但是奇怪不行了,总是连不上github。好吧就按照下面的命令安装(下面的代码是把他安装到 /usr/local/homebrew 后来我去掉了homebrew路径直接安装到了local上)
$ cd /usr/local$ mkdir homebrew$ curl -L https://github.com/Homebrew/homebrew/tarball/master | tar xz --strip 1 -C homebrew
上面的安装只是将Homebrew解压到本地,还需要配置环境变量才能使用brew命令
$ touch ~/.bash_profile$ open ~/.bash_profile$ export PATH=/usr/local/homebrew/bin:$PATH$ source ~/.bash_profile
检查下brew的安装情况 我的是没问题的 然后执行update 更新软件
$ brew doctor$ brew update
brew常用命令
brew –help 查看brew的帮助brew install git 安装软件brew uninstall git 卸载软件brew search git 搜索软件brew list 显示已经安装软件列表brew update 更新软件,把所有的Formula目录更新,并且会对本机已经安装并有更新的软件用*标明。brew upgrade git 更新某具体软件brew [info | home] [FORMULA...] 查看软件信息删除程序,和upgrade一样,单个软件删除和所有程序老版删除。brew cleanup git brew cleanupbrew outdated 查看那些已安装的程序需要更新brew home *—用浏览器打开brew deps * — 显示包依赖brew server * —启动web服务器,可以通过浏览器访问http://localhost:4567/ 来同网页来管理包brew -h brew —帮助
安装Nginx
$ brew search nginx$ brew install nginx
安装成功后的一些配置信息
Docroot is: /usr/local/var/wwwThe default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so thatnginx can run without sudo.nginx will load all files in /usr/local/etc/nginx/servers/.To have launchd start nginx at login: mkdir -p ~/Library/LaunchAgents ln -sfv /usr/local/opt/nginx/*.plist ~/Library/LaunchAgentsThen to load nginx now: launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx.plistOr, if you don't want/need launchctl, you can just run: nginx
根据提示设置开机启动
$ mkdir -p ~/Library/LaunchAgents$ ln -sfv /usr/local/opt/nginx/*.plist ~/Library/LaunchAgents
现在就启动nginx的方式有两种
Then to load nginx now: launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx.plistOr, if you don't want/need launchctl, you can just run: nginx
安装php
查找php
$ brew search php56
查看可以使用的选项
$ brew options homebrew/php/php56--with-cgi Enable building of the CGI executable (implies --without-fpm)--with-debug Compile with debugging symbols--with-enchant Build with enchant support--with-gmp Build with gmp support--with-homebrew-apxs Build against apxs in Homebrew prefix--with-homebrew-curl Include Curl support via Homebrew--with-homebrew-libressl Include LibreSSL instead of OpenSSL via Homebrew--with-homebrew-libxml2 Include Libxml2 support via Homebrew--with-homebrew-libxslt Include LibXSLT support via Homebrew--with-imap Include IMAP extension--with-libmysql Include (old-style) libmysql support instead of mysqlnd--with-mssql Include MSSQL-DB support--with-pdo-oci Include Oracle databases (requries ORACLE_HOME be set)--with-pear Build with PEAR--with-phpdbg Enable building of the phpdbg SAPI executable (PHP 5.4 and above)--with-postgresql Build with postgresql support--with-thread-safety Build with thread safety--without-apache Disable building of shared Apache 2.0 Handler module--without-bz2 Build without bz2 support--without-fpm Disable building of the fpm SAPI executable--without-ldap Build without LDAP support--without-legacy-mysql Do not include the deprecated mysql_ functions--without-mysql Remove MySQL/MariaDB support--without-pcntl Build without Process Control support--HEAD Install HEAD version
安装
brew install homebrew/php/php56 --without-snmp --without-apache --without-debug --with-fpm --without-intl --with-homebrew-libxslt --with-homebrew-openssl --with-imap --with-mysql --with-tidy
路径
/usr/local/php/sbin/php-fpm/usr/local/php/etc/php-fpm.conf/usr/local/php/etc/php.ini
添加环境变量
PATH="/usr/local/sbin:$PATH"
设置开机启动
mkdir -p ~/Library/LaunchAgentscp /usr/local/opt/php56/homebrew.mxcl.php56.plist ~/Library/LaunchAgents/launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
nginx 添加对php的支持
location / { root html; //index index.html index.htm; //改为⬇️ index index.php index.html index.htm; } #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} 去掉注释 fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; 改成 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
php扩展
使用brew search php56-命令,可以查看还有哪些扩展可以安装,然后执行brew install php55-XXX就可以了。
安装memcache
brew search php55-brew install homebrew/php/php55-memcachebrew tap josegonzalez/homebrew-phpbrew untap homebrew/phpinstall josegonzalez/php/php56-memcached
To have launchd start memcached at login: ln -sfv /usr/local/opt/memcached/*.plist ~/Library/LaunchAgentsThen to load memcached now: launchctl load ~/Library/LaunchAgents/homebrew.mxcl.memcached.plistOr, if you don't want/need launchctl, you can just run: /usr/local/opt/memcached/bin/memcached
重启php 和nginx
安装mysql
brew install mysql
安装完会提示运行mysql_secure_installation
请参考
http://www.jb51.net/article/47727.htm
0 0
- mac ox 10.11 brew安装Nginx+PHP+MySQL+扩展
- MAC使用brew安装nginx+php+mysql环境
- MAC使用brew安装nginx+php+mysql环境
- Nginx Mac OX上安装
- mac 10.9.5 brew安装nginx 1.6.2 php 5.6 及php扩展
- mac使用指南2-brew安装nginx mysql
- Mac 使用brew安装Nginx、MySQL、Tomcat
- MAC-brew安装 php7 nginx mysql
- Mac OS使用brew安装Nginx、MySQL、PHP-FPM的LAMP开发环境
- Mac ox 10.11 下python2.7下MySQL模块安装
- Brew’ing PHP, MySQL & Nginx on Mac OS X
- MAC使用brew搭建nginx、php、mysql环境
- mac下brew安装php扩展swoole失败
- 在 Mac OX X 下面安装 php
- mac安装nginx mysql php
- MAC OX下PHP和Nginx的配置
- Mac 通过brew 安装php
- Mac OX 10.11 安装XAMPP+cakePHP
- java反射机制(1)- 知识点总结Java Reflection API操作
- AndroidRobot目前已经开源了
- Classes and Fields in Scala
- USACO sort3
- 先来先服务(FCFS)算法
- mac ox 10.11 brew安装Nginx+PHP+MySQL+扩展
- ubuntu14.3下安装ns2.35安装详解
- 深入探讨this指针 blog.csdn./ugg/article/details/606396
- 百度地图开发总结----1.在网页上使用百度地图(默认的)
- 编程入门指南学习路线
- Android中的转屏流程
- 思维方式和思维方法
- SpringMVC的各种参数绑定方式
- c#之再战委托事件多线程1_仅仅是委托