mac mamp安装PHP7.0

mac mamp安装PHP7.0需要编译安装,流程如下

# MAMP
mkdir -p /Applications/MAMP/bin/php/php7.0.6/include/php
cd /Applications/MAMP/bin/php/php7.0.6/include/php

# Download PHP
wget http://fr2.php.net/get/php-7.0.6.tar.bz2/from/this/mirror

# Untar
tar -xjf php-7.0.6.tar.bz2

# Open
cd php-7.0.6

# Configure
./configure  \
--prefix=/Applications/MAMP/bin/php/php7.0.6  \
--exec-prefix=/Applications/MAMP/bin/php/php7.0.6  \
--sysconfdir=/Applications/MAMP/bin/php/php7.0.6/conf  \
--libexecdir=/Applications/MAMP/bin/php/php7.0.6/modules \
--with-config-file-path=/Applications/MAMP/bin/php/php7.0.6/conf  \
--enable-ftp  \
--enable-gd-native-ttf  \
--enable-mbstring=all  \
--enable-sockets  \
--enable-bcmath  \
--enable-soap  \
--enable-calendar  \
--enable-exif  \
--enable-zip  \
--enable-opcache  \
--enable-cgi  \
--enable-intl  \
--enable-pcntl \
--enable-wddx  \
--with-apxs2 \
--with-gd \
--with-jpeg-dir=/usr/local/opt/jpeg  \
--with-png-dir=/usr/local/opt/libpng  \
--with-zlib  \
--with-zlib-dir=/usr/local/opt/zlib  \
--with-freetype-dir=/usr/local/opt/freetype  \
--with-bz2=/usr  \
--with-ldap  \
--with-mysqli=mysqlnd  \
--with-curl=/usr/local/opt/curl  \
--with-imap=shared,/usr/local/opt/imap-uw/2007f  \
--with-kerberos  \
--with-pgsql=shared,/usr/local/opt/postgresql  \
--with-libxml-dir=/usr/local/opt/libxml2  \
--with-gettext=shared,/usr/local/opt/gettext  \
--with-xsl=/usr/local/opt/libxslt  \
--with-pdo-mysql=mysqlnd  \
--with-mcrypt=shared,/usr/local/opt/mcrypt  \
--with-openssl=shared,/usr/local/opt/openssl  \
--with-iconv=shared,/usr/local/opt/libiconv  \
--with-tidy=shared  \
--with-icu-dir=/usr/local/opt/icu4c  \
--with-libexpat-dir=/usr/local/opt/expat  \
--with-readline=shared,/usr/local/opt/readline

# Make
make

# Install
make install


编译安装的时候报错,

屏幕快照 2016-06-04 上午12.16.35.png

编译报错openssl不存在,但是到/usr/local/显示openssl存在。搜索了一下这个问题到知乎上看到有人提问。

https://www.zhihu.com/question/24192936


在非root权限里面终端输入:

brew install openssl

如果速度很慢的话替换一下brew源。

https://www.zhihu.com/question/31360766

https://lug.ustc.edu.cn/wiki/mirrors/help/brew.git

替换homebrew默认源

cd /usr/local
git remote set-url origin git://mirrors.ustc.edu.cn/brew.git

中科大镜像

1
2
3
cd /usr/local/
git remote set-url origin http://mirrors.ustc.edu.cn/homebrew.git
brew update

清华大学镜像

1
2
3
cd /usr/local
git remote set-url origin git://mirrors.tuna.tsinghua.edu.cn/homebrew.git
brew update

如果速度还是很慢,可以尝试以下操作:

1
2
3
4
5
6
cd ~/tmp
git clone git://mirrors.tuna.tsinghua.edu.cn/homebrew.git
rm -rf /usr/local/.git
rm -rf /usr/local/Library
cp -R homebrew/.git /usr/local/
cp -R homebrew/Library /usr/local/

然后重试update。

使用homebrew-science或者homebrew-python

1
2
3
4
5
6
7
cd /usr/local/Library/Taps/homebrew/homebrew-science
git remote set-url origin git://mirrors.tuna.tsinghua.edu.cn/homebrew-science.git
 
cd /usr/local/Library/Taps/homebrew/homebrew-python
git remote set-url origin git://mirrors.tuna.tsinghua.edu.cn/homebrew-python.git
 
brew update



已有2位网友发表了看法:

  • root root 2016-06-04 01:29:20 回复Ta
  • 有很多东西不需要就不必要编译那么多。
    ./configure --prefix=/Applications/MAMP/bin/php/php7.0.7 --exec-prefix=/Applications/MAMP/bin/php/php7.0.7 --sysconfdir=/Applications/MAMP/bin/php/php7.0.7/conf --libexecdir=/Applications/MAMP/bin/php/php7.0.7/modules --with-config-file-path=/Applications/MAMP/bin/php/php7.0.7/conf --with-apxs2=/usr/sbin/apxs --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysqli --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --disable-fileinfo --enable-maintainer-zts
  • root root 2016-06-04 01:51:55 回复Ta
  • 还一个更便捷的方法直接安装最新版本的mamp 自带php7.0
    http://downloads8.mamp.info/MAMP-PRO/releases/3.5/MAMP_MAMP_PRO_3.5.pkg

发表评论:

◎欢迎参与讨论,请在这儿发表您的观点。

«   2020年4月   »
12345
6789101112
13141516171819
20212223242526
27282930
about关于我

root.wang&老王SEO

邮箱:8#ie3.cn

微博:weibo.com/mldh

lofter

PHP攻城师

SEO攻城师

python爱好者

数据挖掘爱好者

智能硬件爱好者

摄影爱好者

网站分类
搜索
文章归档
友情链接