一首先安装 Homebrew
$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
$ brew install git
$ brew update
二安装 MySQL
1,安装
$ brew install mysql
2,设置开机自启动
$ ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
3,安装完成之后开启MySQL安全机制
三 安装nginx
四 安装php
1,添加brew的PHP扩展库:
brew update
brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php
可以使用brew options php55命令来查看安装php5.5的选项,这里我用下面的选项安装:
brew install php55 --with-fpm --with-gmp --with-imap --with-tidy --with-debug --with-mysql --with-libmysql
可能遇到错误:Error: Formulae found in multiple taps
解决方法:
brew untap josegonzalez/homebrew-php
brew untap homebrew/php brew tap --repair brew update
在重新安装php
PHP编译过程中如果遇到configure: error: Cannot find OpenSSL's <evp.h>错误,执行xcode-select --install重新安装一下Xcode Command Line Tools 在GitHub HomeBrew上有关于这个讨论:
For future reference of anybody looking for Command Line Tools with Xcode 5, open up a Terminal window and type xcode-select --install. A window will appear informing you command line tools are required. Click Install and you should be good to go
等待PHP编译完成,开始安装PHP常用扩展,扩展安装过程中brew会自动安装依赖包,例如php55-pdo-pgsql 会自动装上postgresql,这里我安装以下PHP扩展:
brew install php55-apcu\
php55-gearman\
php55-geoip\
php55-gmagick\
php55-imagick\
php55-intl\
php55-mcrypt\
php55-memcache\
php55-memcached\
php55-mongo\
php55-opcache\
php55-pdo-pgsql\
php55-phalcon\
php55-redis\
php55-sphinx\
php55-swoole\
php55-uuid\
php55-xdebug;
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
sudo lsof -i -n -P|grep 8080查看端口是否被占用 如果占用kill pid就行了
浙公网安备 33010602011771号