mac brewmac brew 安装php7怎么选择版本

MAC下用homebrew安装及配置apache、php和mysql
时间: 07:04:06
&&&& 阅读:245
&&&& 评论:
&&&& 收藏:0
标签:我们用到php运行环境的时候总喜欢用集成包,其实在mac下,用homebrew也可以很快的安装这些东西,配置也很简单。
是mac下的一个包安装管理工具,使用非常简单方便。
安装homebrew
在终端中执行:
ruby -e "$(curl -fsSL /Homebrew/install/master/install)"
这样就安装好homebrew了。
安装命令行软件
如安装wget,则执行:
brew install wget
其它具体的使用方法可自行翻阅&。
安装apache php mysql
因为apache和php不在默认的仓库里,所以我们要先添加其所在的仓库。
brew tap homebrew/apache
brew tap homebrew/php
之后就是正常的安装了,安装过程homebrew会为你自行处理各种依赖。
brew install httpd24
brew install php53
brew install mysql
注意:apache在homebrew中的名字为httpd。&这些都可以指定安装的版本,这里我安装apache2.4,php5.3,mysql是最新版。&以下的路径说明都是以这个为基准,请自行修改为你所下载的版本。
配置apache
配置文件路径为/usr/local/etc/apache2/2.4/httpd.conf,以下的配置都需要在相应的地方修改。
添加php模块
# ====php module====
LoadModule php5_module /usr/local/Cellar/php53/5.3.29/libexec/apache2/libphp5.so
&IfModule mod_php5.c&
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
&IfModule mod_dir.c&
DirectoryIndex index.html index.php
&/IfModule&
&/IfModule&
修改监听端口&默认的端口为8080,我们改为80:
修改root根目录
DocumentRoot "/Users/lonewolf/Public/dev/php/app"
&Directory "/Users/lonewolf/Public/dev/php/app"&
请自行修改为你的目录
配置路径为/usr/local/Cellar/mysql/5.6.f。
到这里,我们的安装和配置就完成了,不过有一点很不好,就是启动和停止这些服务都需要在命令行下输入,有没有图形化的管理界面呢?&有的,答案是LaunchRocket,说这个之前我们先来了解一下另一个工具homebrew-cask。
homebrew-cask
是homebrew的一个扩展,用于安装图形界面mac程序,如google chrome、QQ等等。
brew install caskroom/cask/brew-cask
brew cask install google-chrome
具体的功能请翻阅官网。
LaunchRocket
是管理homebrew所安装应用的一个管理器,它在系统设置中。&安装命令:
brew cask install launchrocket
界面如下:&
不知道为什么,httpd需要选As Root才能真正运行起来。
到此,安装、配置、运行各方面都完成了。
最后介绍两个有用的工具:
1、cakebrew
是图形化管理homebrew的一个软件,也就是让你不用敲命令即可安装软件。&
2、adminer
是用php写的一个数据库管理工具,可以管理 MySQL, PostgreSQL, SQLite, MS SQL, Oracle, MongoDB等类型数据库,而且还是单文件,安装部署非常方便,支持多种语言。&
原链接地址:标签:
&&国之画&&&& &&&&chrome插件
版权所有 京ICP备号-2
迷上了代码!这是包子的博客,欢迎您的访问,O(∩_∩)O~~
因为本地要调试一个node小项目,所以在自己的mac上安装一个,并做个小笔记
这个我就不废话了,假设你的Mac上已经安装好了。
二、安装nodejs
运行brew install node 即可,但是这样安装的node是最新node,最新的好像已经6.x了,
但是这个不是我想要的版本,我希望下周最新的4系列的稳定版本。
三、安装指定版本的node
1、需要安装homebrew-version
brew tap homebrew/versions
2、查看可安装的node版本
brew install homebrew/versions/node
3、选择按一个node的版本
brew install homebrew/versions/node5
这样就可以成功安装node5.x版本
但是,我选择的4系列最新的:
brew install homebrew/versions/node4-lts
名字 (必填,如果已是注册用户请先登陆):
E-mail (必填,不会被显示在前台,仅为方便联系):
网址 (选填, 要包含http://):
评论内容 (必填):
验证码(*):你的位置: >
> mac使用brew安装nginx+php-fpm+mysql
最近在捣鼓Mac,作为一个开发人员,开发环境是必须的,当然xmapp是有这个集成包的,但是mac 这么高大上的系统怎么可以用集成包,于是打算使用命令安装nginx+php-fpm+mysql.
最开始不知道mac是用brew管理软件的,用编译的方式安装了nginx,之后发现有brew这个东西,于是删除nginx目录重新用brew安装
mac默认是没有安装brew的,感觉brew命令跟centos的yum一样,看下面的命令就知道了
第一步安装brew
ruby -e "$(curl -fsSL /Homebrew/install/master/install)"
网上有很多失效的链接,上面的链接我安装的时候是可行的
brew install nginx
会自动安装依赖关系,方便
sudo nginx #启动nginx服务
sudo nginx -s reload #重启nginx服务
配置文件路径/usr/local/etc/nginx/nginx.conf
安装之后默认的端口是8080
brew install mysql
mysql默认密码是空的
mysql.server start #启动mysql服务
mysql.server stop #关闭mysql服务
配置文件路径 /usr/local/Cellar/mysql/
安装php-fpm
不是用mac自带的php使用brew安装的php
brew tap homebrew/dupes
brew tap josegonzalez/homebrew-phpbr
brew search php #查询php的版本,下面命令php70就是版本
brew install php70 --with-imap --with-tidy --with-debug --with-pgsql --with-mysql --with-fpm
最后因为mac自带php所以要修改一个配置,使用brew安装的php版本
vi ~/.bash_profile
export PATH="$(brew --prefix php70)/sbin:$PATH"
上面添加的内容php70要修改成你安装的版本
source ./.bash_profile
如果没有.bash_profile看有没有.bashrc文件
sudo php-fpm #启动php-fpm
配置文件/usr/local/etc/php/7.0/php.ini
最后创建网站目录
修改nginx的配置文件,.php的文件用php-fpm去解析
location ~ \.php$ {
fastcgi_intercept_
fastcgi_pass
127.0.0.1:9000;
fastcgi_index
fastcgi_param
SCRIPT_FILENAME
/Users/qiucarson/www$fastcgi_script_
/usr/local/etc/nginx/fastcgi_
添加上面的配置,注意:上面的/Users/qiucarson/www路径修改成自己的目录
都这里配置都好了,可以看一下phpinfo
QQ交流群:(满) 如无特别说明,本站文章皆为原创,若要转载,务必请注明以下原文信息:转载保留版权:&
本文链接地址:赏
与本文相关的文章
木有头像就木有JJ!按步骤申请Gravatar头像吧!mac 10.9.5 brew安装nginx 1.6.2 php 5.6 及php扩展
发布时间: 10:55:28
1、关闭并删除系统自带的
sudo apachectl stop
#关闭apache,如果事先没开启过,可以忽略报错信息
sudo rm /usr/sbin/apachectl sudo rm /usr/sbin/httpd sudo rm -r /etc/apache2/
2、删除自带的php
sudo rm -r /usr/bin/php
3、安装&Command Line Tools
xcode-select --install
4、安装brew
ruby -e &$(curl -fsSL /Homebrew/install/master/install)&brew doctorbrew update brew upgrade
5、安装php
brew tap homebrew/dupes brew tap homebrew/phpbrew install php56 --without-apache --with-fpm --with-mysql添加自启动
mkdir -p ~/Library/LaunchAgentsln -sfv /usr/local/opt/php56/homebrew.mxcl.php56.plist ~/Library/LaunchAgents为了后面管理方便,将命令 alias 下
nano ~/.bash_aliasesalias php-fpm.start=&launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist& alias php-fpm.stop=&launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist& alias php-fpm.restart='php-fpm.stop && php-fpm.start'
nano ~/.bash_profile[[ -f ~/.bash_aliases ]] && . ~/.bash_aliases source .bash_profile //更新文件 这样就可以用快捷命令来管理php-fpm了
php-fpm.start php-fpm.stop php-fpm.restart
6、安装php扩展
brew install php56-redis brew install php56-amqp
7、安装nginx
brew install nginx配置nginx
nano /usr/local/etc/nginx/nginx.conf&pre name=&code& class=&html&&worker_processes  1;events {    worker_connections  128;}http {    include       mime.    include       vhost/*.    default_type  application/octet-     sendfile          tcp_nopush        tcp_nodelay        keepalive_timeout  65;     gzip }
添加vhostmkdir/usr/local/etc/nginx/vhost
nano /usr/local/etc/nginx/vhost/default.confserver {
#charset koi8-r;
#access_log
logs/host.access.
location / {
/Users/wby/Documents/PHPProjects/operator_sz_web/
index.html index.htm index.
try_files $uri $uri/ /index.php?$query_
#error_page
error_page
500 502 503 504
location = /50x.html {
/Users/wby/Documents/PHPProjects/
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
fastcgi_intercept_
fastcgi_pass
127.0.0.1:9000;
fastcgi_index
fastcgi_param
SCRIPT_FILENAME
/Users/wby/Documents/PHPProjects/operator_sz_web/public$fastcgi_script_
fastcgi_param
SCRIPT_NAME
$fastcgi_script_
/usr/local/etc/nginx/fastcgi_
}nginx //启动nginx -s stop
//停止nginx -s reload
//重新加载
【注意可能会涉及到一些文件和文件夹的用户和权限问题】
【数据库是直接连的服务器,所以我就不装mysql了】
参考了以下内容:
http://tabalt.net/blog/install-nginx-mysql-php-fpm-by-brew-on-mac/
http://blog.frd.mn/install-nginx-php-fpm-mysql-and-phpmyadmin-on-os-x-mavericks-using-homebrew/
版权声明:本文为博主原创文章,未经博主允许不得转载。
来源:http://blog.csdn.net/wby462520/article/details/温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
真诚 幽默 善良
LOFTER精选
网易考拉推荐
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
php-version是一个帮助管理从brew安装的php版本切换的工具。安装简单$brew install php-version
然后执行$source $(brew --prefix php-version)/php-version.sh && php-version 5
直接执行php-version就可以看到现有的版本,比如我自己的$ php-version
然后使用以下命令切换即可$php-version 5.6.5
再看php的版本,已经切换好了。
阅读(562)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
在LOFTER的更多文章
loftPermalink:'',
id:'fks_',
blogTitle:'Mac 下 php多版本切换',
blogAbstract:'php-version是一个帮助管理从brew安装的php版本切换的工具。',
blogTag:'',
blogUrl:'blog/static/',
isPublished:1,
istop:false,
modifyTime:0,
publishTime:1,
permalink:'blog/static/',
commentCount:0,
mainCommentCount:0,
recommendCount:0,
bsrk:-100,
publisherId:0,
recomBlogHome:false,
currentRecomBlog:false,
attachmentsFileIds:[],
groupInfo:{},
friendstatus:'none',
followstatus:'unFollow',
pubSucc:'',
visitorProvince:'',
visitorCity:'',
visitorNewUser:false,
postAddInfo:{},
mset:'000',
remindgoodnightblog:false,
isBlackVisitor:false,
isShowYodaoAd:false,
hostIntro:'真诚 幽默 善良',
hmcon:'1',
selfRecomBlogCount:'0',
lofter_single:''
{list a as x}
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}}

我要回帖

更多关于 mac brew php71 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信