mac上编译安装lnmp环境(php7.0)

系统环境:OS X EI Capitan 10.11.6 (15G31)
web环境:php7.0.13+nginx1.11.6+mysql5.7(解压版)
1.php的扩展安装
1.1png安装(gd库)
tar zxvf libpng-1.6.26.tar.xz
cd libpng-1.6.26
./configure --prefix=/www/server/extension/php/libpng
make &make install
1.2jpeg安装(gd库)
tar zxvf jpegsrc.v9.tar.gz
cd jpeg-9/
./configure --prefix=/www/server/extension/php/libjpeg
make && make install
1.3libiconv(字符编码)
tar zxvf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/www/server/extension/php/libiconv
make && make install
1.4mhash
tcd
cd mhash-0.9.9.9
./configure --prefix=/www/server/extension/php/libmhash
make && make install
1.5libmcrypt
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure --prefix=/www/server/extension/php/libmcrypt
make && make install
1.6openssl安装
tar zxvf openssl-1.0.2f.tar.gz
cd openssl-1.0.2f
./config --prefix=/www/server/extension/php/openssl
make && make install
1.8libxml2
tar zxvf libxml2-sources-2.9.2.tar
cd libxml2-2.9.2
./configure --prefix=/www/server/extension/php/limxml2
make && make install
1.9 curl 安装
tar zxvf curl-7.46.0.tar.gz
cd curl-7.46.0
./configure --prefix=/www/server/extension/php/curl --with-ssl=/www/server/extension/php/openssl/
make && make install
1.20freetype
tar zxvf freetype-2.1.10.tar.bz2
cd freetype-2.1.10
./configure --prefix=/www/server/extension/php/freetype

2.0安装php
编译参数设置
./configure \
--prefix=/www/server/php/php7.0 \
--with-config-file-path=/www/server/php/php7.0 \
--enable-pdo \
--with-pdo-mysql \
--with-mysql-sock=/tmp/mysql.sock \
--enable-opcache \
--enable-cgi \
--enable-fpm \
--enable-sockets \
--enable-mbstring \
--enable-mbregex \
--enable-bcmath \
--enable-session \
--enable-xml \
--enable-zip \
--with-zlib \
--with-gd \
--with-freetype-dir=/www/server/extension/php/freetype \
--with-png-dir=/www/server/extension/php/libpng \
--with-jpeg-dir=/www/server/extension/php/libjpeg \
--with-curl=/www/server/extension/php/curl \
--with-mhash=/www/server/extension/php/libmhash \
--with-mcrypt=/www/server/extension/php/libmcrypt \
--with-iconv=/www/server/extension/php/libiconv
到此php的安装结束了,遇到的问题就是编译php时候加入ssl问题,可能导致编译失败或者报错,去除就是了!
注意:启动的时候非当前用户启动时候用sudo哦,和centos不一样,centos一般都是root,特殊情况就时给个和root权限一样的帐号,很少有单独的那种用户!

你可能感兴趣的:(mac下手动编译php)