mac编译安装php7.1

1、执行配置命令

./configure --prefix=/usr/local/php71 --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-zlib --with-jpeg-dir --with-png-dir --with-libxml-dir=/usr/bin/xml2-config --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 

执行后报错,说找不到libxml2

2、下载libxml2 下载最新版

3、再次执行php编译配置报错

configure: error: libcrypto not found!,这个是OpenSSL库找不到,需要编译安装OpenSSL

4、https://github.com/openssl/openssl  下载OpenSSL

5、进入OpenSSL源码,执行./config,然后执行make && make install

安装后目录在/usr/local/openssl
   

6、编译php依然报错

configure: error: Cannot find OpenSSL's

头文件找不到。

7、继续报错

checking whether to enable JIS-mapped Japanese font support in GD... no

configure: error: webp/decode.h not found.

需要安装支持webp。

8、下载webp并安装

安装过程中报错

configure.ac:9: error: possibly undefined macro: AC_PROG_LIBTOOL

      If this token and others are legitimate, please use m4_pattern_allow.

      See the Autoconf documentation.

提示需要安装libtool

curl -O http://mirrors.kernel.org/gnu/libtool/libtool-2.2.6b.tar.gz
tar xzvf libtool-2.2.6b.tar.gz
cd libtool-2.2.6b
./configure --prefix=/usr/local
make
sudo make install


wget https://github.com/webmproject/libwebp/archive/master.zip
安装后相关目录

/usr/local/include/webp/decode.h
/usr/local/include/webp/encode.h
/usr/local/include/webp/types.h
/usr/local/lib/libwebp.*
/usr/local/bin/cwebp
/usr/local/bin/dwebp
编译php的时候增加参数 –with-webp-dir=/usr/local/include/webp/

9、继续提示

configure: error: jpeglib.h not found

没法。。。。。。源码安装

http://ijg.org/files/下载jpegsrc.v8d.tar.gzmac下解压出文件夹jpeg-8d,把它放到桌面.

10、提示

configure: error: png.h not found.


下载地址https://sourceforge.net/projects/libpng/files/libpng16/1.6.28/


11、继续提示

If configure fails try --with-xpm-dir=

configure: error: freetype-config not found.

按装xpm时又报

checking for XPM... configure: error: Package requirements (xproto x11) were not met.

因此还得把xproto x11两个装上

下载安装freetype

http://download.csdn.net/download/luo849278597/9373917

12、继续配置php,终于验证通过。。。。要哭了

13、安装完成


可以参考下这篇文章

http://blog.csdn.net/tianyiii/article/details/50386497

你可能感兴趣的:(mac编译安装php7.1)