美文网首页
Mac编译安装PHP7.1.8

Mac编译安装PHP7.1.8

作者: 田佳伟 | 来源:发表于2017-08-24 15:31 被阅读0次

1、下载稳定版本的PHP

wget -c http://mirrors.sohu.com/php/php-7.1.8.tar.gz

2、解压编译

tar -zxvf php-7.1.8.tar.gz

./configure --prefix=/usr/local/php/7.1.8 \
--with-config-file-path=/usr/local/php/7.1.8/etc \
--with-config-file-scan-dir=/usr/local/php/7.1.8/etc/conf.d \
--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 \
--enable-mysqlnd 
遇到的问题:
  • apxs报错的问题
Sorry, I cannot run apxs. Possible reasons follow:

1. Perl is not installed
2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs
3. Apache was not built using --enable-so (the apxs usage page is displayed)

解决方案:查找httpd安装目录下的bin目录里的 apxs ,尽量不要写/usr/bin/apxs

  • 由于Mac自带的openssl没法升级(我没找到升级的办法),导致版本较低,报错:
configure: error: OpenSSL version 1.0.1 or greater required.

解决方案:由于Mac自带的openssl没法升级(我没找到升级的办法),用

brew install openssl

安装最新版的openssl,然后在参数中加上brew安装的ssl的路径

--with-openssl=/usr/local/Cellar/openssl@1.1/1.1.0e
  • --with-gettext报错
configure: error: Cannot locate header file libintl.h 

解决方案:

brew install gettext

打开PHP的 configure文件,修改文件的

for i in $PHP_GETTEXT /usr/local /usr/ ;do

改成

for i in $PHP_GETTEXT /usr/local /usr/ usr/local/opt/gettext;do
  • libiconv问题,报错如下:
checking for iconv... no
checking for libiconv... no
configure: error: Please specify the install prefix of iconv with --with-iconv=<DIR>

解决方案:
安装 libiconv (字符编码转换库)
网站地址: http://www.gnu.org/software/libiconv/
当前版本: https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz

$ wget [https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz
$ tar zxvf libiconv-1.15.tar.gz
$ cd libiconv-1.15
$ ./configure --prefix=/usr/local/lib/libiconv
$ make
$ sudo make install

安装

make && sudo make install

相关文章

  • Mac编译安装PHP7.1.8

    1、下载稳定版本的PHP 2、解压编译 遇到的问题: apxs报错的问题 解决方案:查找httpd安装目录下的bi...

  • Mac 安装MongoDB

    在Mac上安装MongoDB 在Mac OS上面安装MongoDB,你可以通过编译源代码来安装 ,也可以在Mac ...

  • 在Mac上安装MongoDB

    在Mac上安装MongoDB 在Mac OS上面安装MongoDB,你可以通过编译源代码来安装 ,也可以在Mac ...

  • Mac 上源码编译并搭建直播推流服务器nginx + rtmp

    mac OS下编译、安装FFmpeg 下载 Nginx 源码 nginx-rtmp-module 编译安装Ngin...

  • Mesos 安装

    安装 系统要求: 64位的linux或mac系统 安装: 1.源码编译安装(centos 7.0) 编译环境准备 ...

  • ffmpeg初体验之下载安装

    下载 1.在mac下,优先安装brew 2.安装ffmpeg 3.安装编译FFmpeg所需依赖 编译 详见官网ff...

  • Mac安装Jadx反编译工具

    Mac安装Jadx反编译工具 准备工作 Mac一台 步骤 01 clone 仓库 编译 02 运行使用jadx-g...

  • nasm

    nasm用在mac平台的汇编开发。 安装 编译指令 −f 指定编译类型,mac下指定macho64格式。

  • Mac下安装OpenMP并完成编译

    OpenMP在Mac上的安装,涉及到一些编译器的历史。。。 OpenMP环境添加(Mac) 安装错误 安装错误参考...

  • FFmpeg学习之一(FFmpeg源码编译)

    Mac下 FFmpeg源码编译 安装 可以通过如下三种方式安装ffmpeg 终端安装 (借助homebrew): ...

网友评论

      本文标题:Mac编译安装PHP7.1.8

      本文链接:https://www.haomeiwen.com/subject/oawsdxtx.html