搜索
您的当前位置:首页正文

TODO:macOS编译PHP7.1

来源:二三娱乐

TODO:macOS编译PHP7.1

本文主要介绍在macOS上编译PHP7.1,有兴趣的朋友可以去尝试一下。

1.下载PHP7.1源码,建议到PHP官网下载纯净到源码包php-7.1.0.tar.gz

2.解压php-7.1.0.tar.gz包

3.创建配置

./configure --prefix=/usr/local/php7 --with-apxs=/usr/sbin/apxs --enable-fpm --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

4.编译代码

make

make test

5.安装php

make install

6.顺利的花这样就把php7.1编译好了,把php7对应的执行文件拷贝到/usr/bin/ 即可在终端使用了

sudo cp /usr/local/php7/bin/ph* /usr/bin/

8.安装autoconf

9.openssl版本问题

configure: error: OpenSSL version 1.0.1 or greater required.

安装更高版本的openssl或者下载openssl源码来编译,简单的方法就是使用brew来安装

10.Cannot find libz,这个需要安装xcode-select,在终端输入xcode-select --install

11.Cannot locate header file libintl.h

安装gettext

编辑php源码configure文件

改成

12.mcrypt.h not found. Please reinstall libmcrypt.

安装libmcrypt


wxgzh:ludong86

Top