编译php-7.1.28步骤

  • 检查环境
./configure \
--prefix=/u01/server/php-7.1.28 \
--enable-fpm \
--with-fpm-user=daemon \
--with-fpm-group=daemon \
--with-zlib-dir=/u01/server/common \
--enable-mbstring=all \
--enable-soap \
--enable-bcmath \
--enable-ftp \
--with-xmlrpc \
--enable-cgi \
--with-imap-ssl=/u01/server/common \
--with-png-dir=/u01/server/common \
--with-gd \
--with-zlib \
--with-curl=/u01/server/common \
--with-jpeg-dir=/u01/server/common \
--enable-exif \
--with-openssl=/u01/server/common \
--with-ldap=/u01/server/common \
--enable-calendar \
--enable-ctype \
--enable-pcntl \
--enable-session \
--with-bz2=/usr \
--enable-sockets \
--with-mcrypt=/u01/server/common \
--with-icu-dir=/u01/server/common \
--with-tidy=/u01/server/common \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-pdo_sqlite=/u01/server/sqlite \
--with-sqlite3=/u01/server/sqlite \
--with-iconv=/u01/server/common \
--with-libxml-dir=/u01/server/common \
--with-xsl=/u01/server/common \
--with-freetype-dir=/u01/server/common \
--with-gmp=/u01/server/common \
--with-gettext \
--enable-intl \
--with-readline=/u01/server/common \
--enable-zip \
--with-libzip=/u01/server/common \
--disable-huge-code-pages
  • 编译
make
  • 安装
make install

备注

  • bz2 == bzip2是同一个意思
  • libzip提示不可用,google了很久也没找到啥原因,后面实在没招了,硬着头皮仔细看了configure脚本里面怎么处理的,最终发现了一些蛛丝马迹

碰到的问题

  • 问题1:gcc编译工具问题
configure: error: in `/root/php-7.1.28':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
  • 解决方法
yum install glibc-headers gcc-c++
  • 问题2:提示libzip版本过低

  • 解决方法

安装新版本的libzip yum自带的不行,编译安装libzip-1.3.0版本
yum install libzip-devel.x86_64
yum remove libzip -y
  • 问题3:libzip检查失败
checking for zip_open in -lzip... no
configure: error: could not find usable libzip
  • 问题定位
  • 分析./configure脚本,发现最终会执行如下
$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5

cc -o conftest \
-I/u01/server/common/include -g -O2 -fvisibility=hidden \
-Wl,-rpath,/u01/server/common/lib -L/u01/server/common/lib -L/u01/server/common/lib -Wl,-rpath,/u01/server/common/lib -L/u01/server/common/lib -Wl,-rpath,/u01/server/sqlite/lib -L/u01/server/sqlite/lib -Wl,-rpath,/bitnami/ruby24stack-linux-x64/output/sqlite/lib -L/bitnami/ruby24stack-linux-x64/output/sqlite/lib -Wl,-rpath,/bitnami/ruby24stack-linux-x64/output/ImageMagick/lib -L/bitnami/ruby24stack-linux-x64/output/ImageMagick/lib \
conftest.c \
-lzip -lz -lexslt -ltidy -lresolv -lcrypt -lreadline -lrt -lsqlite3 -lmcrypt -lltdl -lldap -llber -lstdc++ -liconv -lgmp -lpng -lz -ljpeg -lcrypto -lssl -lcrypto -lcurl -lbz2 -lz -lsqlite3 -lcrypto -lssl -lcrypto -lrt -lm -ldl -lnsl -lxml2 -lz -liconv -lm -ldl -lcurl -lxml2 -lz -liconv -lm -ldl -lfreetype -lz -lbz2 -ldl -lm -licui18n -licuuc -licudata -ldl -lm -licuio -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lcrypt -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lxslt -lxml2 -lz -liconv -ldl -lm
  • 执行这个提示tidy这个库不存在
  • 源码编译tidy库后,这个问题解决
  • 问题4:off_t类型未定义
configure: error: off_t undefined; check your library configuration
  • 解决方法
# 添加搜索路径到配置文件
echo '/usr/local/lib64
/usr/local/lib
/usr/lib
/usr/lib64'>>/etc/ld.so.conf
# 更新配置
ldconfig -v
  • 问题5:autoconf时提示一些宏不存在
[root@localhost libzip]# autoconf
configure.ac:6: error: possibly undefined macro: AM_INIT_AUTOMAKE
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:21: error: possibly undefined macro: AM_PROG_CC_C_O
configure.ac:109: error: possibly undefined macro: AM_CONDITIONAL
  • 解决方法
[root@localhost libzip]# autoreconf --install

参考资料

最新文章

  1. mybatis There is no getter for property named 'xxxx
  2. Linux进程间通信之信号量
  3. js021-Ajax与Comet
  4. hunnu 修路
  5. POJ 2385 Apple Catching
  6. Mongodb解决不能连接到服务器的错误
  7. 脚本AI与脚本引擎
  8. Github进行项目管理的常用命令总结
  9. Linux(CentOS或RadHat)下MySQL源码安装
  10. Java中的String,StringBuilder,StringBuffer三者的区别
  11. springboot 学习进度
  12. python列表中的所有值转换为字符串,以及列表拼接成一个字符串
  13. 简单的user-based协同过滤算法示例代码
  14. [ios]ios读写文件本地数据
  15. Teamwork(The sixth day of the team)
  16. KVC(Key-Value-Coding)和KVO(Key-Value-Observer)
  17. Java反射在整个程序运行中的位置
  18. Nginx-1.6.3反向代理
  19. [转]python-元类
  20. 【leetcode刷题笔记】Unique Binary Search Trees

热门文章

  1. esp8266 串口通讯
  2. preg_replace_callback使用方法
  3. webpack2代码分割
  4. PHP自定义函数及内部函数考察点
  5. jquery中ajax使用error调试错误
  6. js页面跳转定位
  7. CSU 2018年12月月赛 B 2214: Sequence Magic
  8. SQL-Redis使用详细教程
  9. POJ 1995 (快速幂) 求(A1B1+A2B2+ ... +AHBH)mod M
  10. Uva 1572 自组合