mac搭建mamp环境

1  先安装homebrew;

执行:cd /usr/local;

非root用户执行:

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

执行:

brew update

already up-to-date 表示成功!

可能出现错误,打开xcode,点击同意;

更过关于homebrew请到官网:

http://brew.sh/index_zh-cn.html

2  安装mysql 

$ brew install mysql

3  安装php

添加brew的PHP扩展库:

  brew update

  brew tap homebrew/dupes

  brew tap josegonzales/homebrew-php

查看php5.5的选项

brew options php55

执行安装 ,后面选项可以调整

brew install php55 --with-fpm --with-gmp --with-imap --with-tidy --with-debug --with-mysql --with-libmysql --with-apache

查看还有哪些扩展可以安装,然后执行brew install php55-XXX就可以了

brew search php55

开机自动启动

ln -sfv /usr/local/opt/php55/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php55.plist
 
摘自:http://www.jb51.net/article/53850.htm
http://www.cnblogs.com/zjl2015/p/5264633.html
 
mac中本就安装好了apache 
配置文件在/etc/apache2/httpd.config
初始根目录在/Library/WebServer/Document/中
修改http.config 文件需要管理员权限,
执行
sudo su
...#: 为超管权限 ,现在可以修改该文件的默认根目录和选择加载php.ini配置
#LoadModule php5_module libexec/apache2/libphp5.so
将前面#去掉
重启apache
sudo apachectl restart
即可
 
载自:http://www.th7.cn/Program/php/201308/148040.shtml
 
 
mac配置端口
我的mac上apache版本是2.4版本 
Linux服务器apache版本是2.2版本

linux 查看apache版本 rpm -qi httpd

Mac 查看apache版本 suso apachectl -v

Linux上配置端口方式是这样的:

<VirtualHost *:1000>

        DocumentRoot "/Users/lijundong/Documents"

        ErrorLog /Users/lijundong/Documents/logs

</VirtualHost>

<Directory '/Users/lijundong/Documents'>

        Options FollowSymLinks

        AllowOverride None

        Order allow,deny

        Allow from all

</Directory>

Mac上配置端口是这样的

<VirtualHost *:1000>

ServerName my.document.com 

DocumentRoot "/Users/lijundong/Documents"

DirectoryIndex index.html index.php 

 

<Directory "/Users/lijundong/Documents">

Options -Indexes +FollowSymlinks 

AllowOverride All 

Require all granted 

</Directory> 

 

</VirtualHost>

 

之前一直出错是因为版本不同 配置配置的方式不同。 

原文地址:https://www.cnblogs.com/jackylee92/p/5742001.html